diff --git a/src/Migrate/Migrate.Autorest/Az.Migrate.format.ps1xml b/src/Migrate/Migrate.Autorest/Az.Migrate.format.ps1xml index 7685de2c559b..d0cc17da37d6 100644 --- a/src/Migrate/Migrate.Autorest/Az.Migrate.format.ps1xml +++ b/src/Migrate/Migrate.Autorest/Az.Migrate.format.ps1xml @@ -23,9 +23,18 @@ + + + + + + + + + @@ -38,6 +47,9 @@ + + + @@ -62,6 +74,9 @@ + + + @@ -71,6 +86,9 @@ + + + @@ -86,6 +104,9 @@ + + + @@ -107,6 +128,9 @@ + + + @@ -135,9 +159,18 @@ DatabaseName + + DeploymentId + + + EmailConfigurationName + EventName + + FabricAgentName + FabricName @@ -150,6 +183,9 @@ JobName + + Location + LogicalNetworkName @@ -174,6 +210,9 @@ NetworkName + + OperationId + OperationStatusName @@ -183,6 +222,9 @@ ProtectableItemName + + ProtectedItemName + ProtectionContainerName @@ -198,6 +240,9 @@ ReplicatedProtectedItemName + + ReplicationExtensionName + ResourceGroupName @@ -219,6 +264,9 @@ SubscriptionId + + VaultName + VaultSettingName @@ -233,6 +281,142 @@ + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorDetail + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorDetail + + + + + + + + + + + + + + + + + + Code + + + Message + + + Target + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.OperationAutoGenerated + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.OperationAutoGenerated + + + + + + + + + + + + + + + + + + + + + ActionType + + + IsDataAction + + + Name + + + Origin + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.OperationDisplayAutoGenerated + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.OperationDisplayAutoGenerated + + + + + + + + + + + + + + + + + + + + + Description + + + Operation + + + Provider + + + Resource + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.OperationListResult + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.OperationListResult + + + + + + + + + + + + NextLink + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.A2AAddDisksInput @@ -26523,5 +26707,4775 @@ + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHCIDiskInput + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHCIDiskInput + + + + + + + + + + + + + + + + + + + + + + + + DiskFileFormat + + + DiskId + + + DiskSizeGb + + + IsDynamic + + + IsOSDisk + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHCINicInput + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHCINicInput + + + + + + + + + + + + + + + + + + + + + NicId + + + TargetNetworkId + + + TestNetworkId + + + SelectionTypeForFailover + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHciClusterProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHciClusterProperties + + + + + + + + + + + + + + + + + + ClusterName + + + ResourceName + + + StorageAccountName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHciFabricModelCustomProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHciFabricModelCustomProperties + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + ApplianceName + + + AzStackHciSiteId + + + FabricContainerId + + + FabricResourceId + + + MigrationHubUri + + + MigrationSolutionId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.CheckNameAvailabilityModel + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.CheckNameAvailabilityModel + + + + + + + + + + + + Name + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.CheckNameAvailabilityResponseModel + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.CheckNameAvailabilityResponseModel + + + + + + + + + + + + + + + + + + Message + + + NameAvailable + + + Reason + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.DeploymentPreflightResource + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.DeploymentPreflightResource + + + + + + + + + + + + + + + + + + ApiVersion + + + Location + + + Name + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.DraModel + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.DraModel + + + + + + + + + + + + Name + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.DraModelCollection + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.DraModelCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.DraModelCustomProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.DraModelCustomProperties + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.DraModelProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.DraModelProperties + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CorrelationId + + + IsResponsive + + + LastHeartbeat + + + MachineId + + + MachineName + + + ProvisioningState + + + VersionNumber + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.DraModelSystemData + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.DraModelSystemData + + + + + + + + + + + + + + + + + + + + + + + + + + + CreatedAt + + + CreatedBy + + + CreatedByType + + + LastModifiedAt + + + LastModifiedBy + + + LastModifiedByType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EmailConfigurationModel + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EmailConfigurationModel + + + + + + + + + + + + Name + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EmailConfigurationModelCollection + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EmailConfigurationModelCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EmailConfigurationModelProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EmailConfigurationModelProperties + + + + + + + + + + + + + + + + + + CustomEmailAddress + + + Locale + + + SendToOwner + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EmailConfigurationModelSystemData + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EmailConfigurationModelSystemData + + + + + + + + + + + + + + + + + + + + + + + + + + + CreatedAt + + + CreatedBy + + + CreatedByType + + + LastModifiedAt + + + LastModifiedBy + + + LastModifiedByType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ErrorModel + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ErrorModel + + + + + + + + + + + + + + + + + + + + + + + + + + + Caus + + + Code + + + CreationTime + + + Message + + + Recommendation + + + Severity + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EventModel + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EventModel + + + + + + + + + + + + Name + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EventModelCollection + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EventModelCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EventModelCustomProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EventModelCustomProperties + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EventModelProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EventModelProperties + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CorrelationId + + + Description + + + EventName + + + EventType + + + ResourceName + + + ResourceType + + + Severity + + + TimeOfOccurrence + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EventModelSystemData + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EventModelSystemData + + + + + + + + + + + + + + + + + + + + + + + + + + + CreatedAt + + + CreatedBy + + + CreatedByType + + + LastModifiedAt + + + LastModifiedBy + + + LastModifiedByType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModel + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModel + + + + + + + + + + + + + + + Location + + + Name + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelCollection + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelCustomProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelCustomProperties + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelProperties + + + + + + + + + + + + + + + + + + + + + Health + + + ProvisioningState + + + ServiceEndpoint + + + ServiceResourceId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelSystemData + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelSystemData + + + + + + + + + + + + + + + + + + + + + + + + + + + CreatedAt + + + CreatedBy + + + CreatedByType + + + LastModifiedAt + + + LastModifiedBy + + + LastModifiedByType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelTags + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelUpdate + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelUpdate + + + + + + + + + + + + Name + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelUpdateSystemData + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelUpdateSystemData + + + + + + + + + + + + + + + + + + + + + + + + + + + CreatedAt + + + CreatedBy + + + CreatedByType + + + LastModifiedAt + + + LastModifiedBy + + + LastModifiedByType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelUpdateTags + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelUpdateTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FailoverProtectedItemProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FailoverProtectedItemProperties + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + NetworkName + + + ProtectedItemName + + + RecoveryPointId + + + RecoveryPointTime + + + Subnet + + + TestVMName + + + VMName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FailoverWorkflowModelCustomProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FailoverWorkflowModelCustomProperties + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HealthErrorModel + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HealthErrorModel + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AffectedResourceCorrelationId + + + AffectedResourceType + + + Category + + + Caus + + + Code + + + CreationTime + + + HealthCategory + + + IsCustomerResolvable + + + Message + + + Recommendation + + + Severity + + + Source + + + Summary + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVMigrateFabricModelCustomProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVMigrateFabricModelCustomProperties + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + FabricContainerId + + + FabricResourceId + + + HyperVSiteId + + + MigrationHubUri + + + MigrationSolutionId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHcidiskInput + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHcidiskInput + + + + + + + + + + + + + + + + + + + + + + + + + + + DiskFileFormat + + + DiskId + + + DiskSizeGb + + + IsDynamic + + + IsOSDisk + + + StorageContainerId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHcieventModelCustomProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHcieventModelCustomProperties + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + EventSourceFriendlyName + + + ProtectedItemFriendlyName + + + ServerType + + + SourceApplianceName + + + TargetApplianceName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHcinicInput + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHcinicInput + + + + + + + + + + + + + + + + + + + + + + + + NetworkName + + + NicId + + + SelectionTypeForFailover + + + TargetNetworkId + + + TestNetworkId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHciplannedFailoverModelCustomProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHciplannedFailoverModelCustomProperties + + + + + + + + + + + + + + + InstanceType + + + ShutdownSourceVM + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHcipolicyModelCustomProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHcipolicyModelCustomProperties + + + + + + + + + + + + + + + + + + + + + InstanceType + + + AppConsistentFrequencyInMinute + + + CrashConsistentFrequencyInMinute + + + RecoveryPointHistoryInMinute + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHciprotectedDiskProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHciprotectedDiskProperties + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CapacityInByte + + + DiskType + + + IsDynamic + + + IsOSDisk + + + MigrateDiskName + + + SeedDiskName + + + SourceDiskId + + + SourceDiskName + + + StorageContainerId + + + StorageContainerLocalPath + + + TestMigrateDiskName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHciprotectedItemModelCustomProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHciprotectedItemModelCustomProperties + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + ActiveLocation + + + CustomLocationRegion + + + FabricDiscoveryMachineId + + + FailoverRecoveryPointId + + + FirmwareType + + + HyperVGeneration + + + InitialReplicationProgressPercentage + + + IsDynamicRam + + + LastRecoveryPointId + + + LastRecoveryPointReceived + + + LastReplicationUpdateTime + + + OSName + + + OSType + + + ResyncProgressPercentage + + + RunAsAccountId + + + SourceApplianceName + + + SourceCpuCore + + + SourceDraName + + + SourceMemoryInMegaByte + + + SourceVMName + + + StorageContainerId + + + TargetApplianceName + + + TargetArcClusterCustomLocationId + + + TargetAzStackHciClusterName + + + TargetCpuCore + + + TargetDraName + + + TargetHciClusterId + + + TargetLocation + + + TargetMemoryInMegaByte + + + TargetNetworkId + + + TargetResourceGroupId + + + TargetVMBiosId + + + TargetVMName + + + TestNetworkId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHciprotectedNicProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHciprotectedNicProperties + + + + + + + + + + + + + + + + + + + + + + + + + + + MacAddress + + + NetworkName + + + NicId + + + SelectionTypeForFailover + + + TargetNetworkId + + + TestNetworkId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHcirecoveryPointModelCustomProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHcirecoveryPointModelCustomProperties + + + + + + + + + + + + + + + InstanceType + + + DiskId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHcireplicationExtensionModelCustomProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHcireplicationExtensionModelCustomProperties + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + AsrServiceUri + + + AzStackHciFabricArmId + + + AzStackHciSiteId + + + GatewayServiceUri + + + HyperVFabricArmId + + + HyperVSiteId + + + RcmServiceUri + + + ResourceGroup + + + ResourceLocation + + + SourceGatewayServiceId + + + SourceStorageContainerName + + + StorageAccountId + + + StorageAccountSasSecretName + + + SubscriptionId + + + TargetGatewayServiceId + + + TargetStorageContainerName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IdentityModel + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IdentityModel + + + + + + + + + + + + + + + + + + + + + + + + AadAuthority + + + ApplicationId + + + Audience + + + ObjectId + + + TenantId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.InnerHealthErrorModel + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.InnerHealthErrorModel + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Category + + + Caus + + + Code + + + CreationTime + + + HealthCategory + + + IsCustomerResolvable + + + Message + + + Recommendation + + + Severity + + + Source + + + Summary + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.OperationModel + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.OperationModel + + + + + + + + + + + + + + + + + + IsDataAction + + + Name + + + Origin + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.OperationModelCollection + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.OperationModelCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.OperationModelProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.OperationModelProperties + + + + + + + + + + + + + + + + + + + + + Description + + + Operation + + + Provider + + + Resource + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.OperationStatusAutoGenerated + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.OperationStatusAutoGenerated + + + + + + + + + + + + + + + + + + + + + EndTime + + + Name + + + StartTime + + + Status + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PlannedFailoverModelCustomProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PlannedFailoverModelCustomProperties + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PolicyModel + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PolicyModel + + + + + + + + + + + + Name + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PolicyModelCollection + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PolicyModelCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PolicyModelCustomProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PolicyModelCustomProperties + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PolicyModelProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PolicyModelProperties + + + + + + + + + + + + ProvisioningState + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PolicyModelSystemData + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PolicyModelSystemData + + + + + + + + + + + + + + + + + + + + + + + + + + + CreatedAt + + + CreatedBy + + + CreatedByType + + + LastModifiedAt + + + LastModifiedBy + + + LastModifiedByType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemDynamicMemoryConfig + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemDynamicMemoryConfig + + + + + + + + + + + + + + + + + + MaximumMemoryInMegaByte + + + MinimumMemoryInMegaByte + + + TargetMemoryBufferPercentage + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemJobProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemJobProperties + + + + + + + + + + + + + + + + + + + + + + + + + + + DisplayName + + + EndTime + + + Name + + + ScenarioName + + + StartTime + + + State + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModel + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModel + + + + + + + + + + + + Name + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelCollection + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelCustomProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelCustomProperties + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelProperties + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AllowedJob + + + CorrelationId + + + DraId + + + FabricId + + + FabricObjectId + + + FabricObjectName + + + LastSuccessfulPlannedFailoverTime + + + LastSuccessfulTestFailoverTime + + + LastSuccessfulUnplannedFailoverTime + + + PolicyName + + + ProtectionState + + + ProtectionStateDescription + + + ProvisioningState + + + ReplicationExtensionName + + + ReplicationHealth + + + ResyncRequired + + + ResynchronizationState + + + SourceFabricProviderId + + + TargetDraId + + + TargetFabricId + + + TargetFabricProviderId + + + TestFailoverState + + + TestFailoverStateDescription + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelPropertiesCurrentJob + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelPropertiesCurrentJob + + + + + + + + + + + + + + + + + + + + + + + + + + + DisplayName + + + EndTime + + + Name + + + ScenarioName + + + StartTime + + + State + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelPropertiesLastFailedEnableProtectionJob + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelPropertiesLastFailedEnableProtectionJob + + + + + + + + + + + + + + + + + + + + + + + + + + + DisplayName + + + EndTime + + + Name + + + ScenarioName + + + StartTime + + + State + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelPropertiesLastFailedPlannedFailoverJob + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelPropertiesLastFailedPlannedFailoverJob + + + + + + + + + + + + + + + + + + + + + + + + + + + DisplayName + + + EndTime + + + Name + + + ScenarioName + + + StartTime + + + State + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelPropertiesLastTestFailoverJob + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelPropertiesLastTestFailoverJob + + + + + + + + + + + + + + + + + + + + + + + + + + + DisplayName + + + EndTime + + + Name + + + ScenarioName + + + StartTime + + + State + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelSystemData + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelSystemData + + + + + + + + + + + + + + + + + + + + + + + + + + + CreatedAt + + + CreatedBy + + + CreatedByType + + + LastModifiedAt + + + LastModifiedBy + + + LastModifiedByType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.RecoveryPointModel + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.RecoveryPointModel + + + + + + + + + + + + Name + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.RecoveryPointModelCollection + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.RecoveryPointModelCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.RecoveryPointModelCustomProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.RecoveryPointModelCustomProperties + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.RecoveryPointModelProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.RecoveryPointModelProperties + + + + + + + + + + + + + + + RecoveryPointTime + + + RecoveryPointType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.RecoveryPointModelSystemData + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.RecoveryPointModelSystemData + + + + + + + + + + + + + + + + + + + + + + + + + + + CreatedAt + + + CreatedBy + + + CreatedByType + + + LastModifiedAt + + + LastModifiedBy + + + LastModifiedByType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ReplicationExtensionModel + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ReplicationExtensionModel + + + + + + + + + + + + Name + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ReplicationExtensionModelCollection + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ReplicationExtensionModelCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ReplicationExtensionModelCustomProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ReplicationExtensionModelCustomProperties + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ReplicationExtensionModelProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ReplicationExtensionModelProperties + + + + + + + + + + + + ProvisioningState + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ReplicationExtensionModelSystemData + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ReplicationExtensionModelSystemData + + + + + + + + + + + + + + + + + + + + + + + + + + + CreatedAt + + + CreatedBy + + + CreatedByType + + + LastModifiedAt + + + LastModifiedBy + + + LastModifiedByType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.StorageContainerProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.StorageContainerProperties + + + + + + + + + + + + + + + ClusterSharedVolumePath + + + Name + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel + + + + + + + + + + + + + + + + + + + + + + + + + + + CreatedAt + + + CreatedBy + + + CreatedByType + + + LastModifiedAt + + + LastModifiedBy + + + LastModifiedByType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.TaskModel + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.TaskModel + + + + + + + + + + + + + + + + + + + + + EndTime + + + StartTime + + + State + + + TaskName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.TaskModelCustomProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.TaskModelCustomProperties + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.TestFailoverCleanupWorkflowModelCustomProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.TestFailoverCleanupWorkflowModelCustomProperties + + + + + + + + + + + + + + + InstanceType + + + Comment + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.TestFailoverWorkflowModelCustomProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.TestFailoverWorkflowModelCustomProperties + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VaultModel + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VaultModel + + + + + + + + + + + + + + + Location + + + Name + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VaultModelCollection + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VaultModelCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VaultModelProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VaultModelProperties + + + + + + + + + + + + + + + + + + ProvisioningState + + + ServiceResourceId + + + VaultType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VaultModelSystemData + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VaultModelSystemData + + + + + + + + + + + + + + + + + + + + + + + + + + + CreatedAt + + + CreatedBy + + + CreatedByType + + + LastModifiedAt + + + LastModifiedBy + + + LastModifiedByType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VaultModelTags + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VaultModelTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VaultModelUpdate + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VaultModelUpdate + + + + + + + + + + + + Name + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VaultModelUpdateSystemData + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VaultModelUpdateSystemData + + + + + + + + + + + + + + + + + + + + + + + + + + + CreatedAt + + + CreatedBy + + + CreatedByType + + + LastModifiedAt + + + LastModifiedBy + + + LastModifiedByType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VaultModelUpdateTags + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VaultModelUpdateTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareDraModelCustomProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareDraModelCustomProperties + + + + + + + + + + + + + + + InstanceType + + + BiosId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareMigrateFabricModelCustomProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareMigrateFabricModelCustomProperties + + + + + + + + + + + + + + + + + + InstanceType + + + MigrationSolutionId + + + VmwareSiteId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareToAzStackHcidiskInput + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareToAzStackHcidiskInput + + + + + + + + + + + + + + + + + + + + + + + + + + + DiskFileFormat + + + DiskId + + + DiskSizeGb + + + IsDynamic + + + IsOSDisk + + + StorageContainerId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareToAzStackHcinicInput + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareToAzStackHcinicInput + + + + + + + + + + + + + + + + + + + + + + + + + + + Label + + + NetworkName + + + NicId + + + SelectionTypeForFailover + + + TargetNetworkId + + + TestNetworkId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareToAzStackHciplannedFailoverModelCustomProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareToAzStackHciplannedFailoverModelCustomProperties + + + + + + + + + + + + + + + InstanceType + + + ShutdownSourceVM + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareToAzStackHcipolicyModelCustomProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareToAzStackHcipolicyModelCustomProperties + + + + + + + + + + + + + + + + + + + + + InstanceType + + + AppConsistentFrequencyInMinute + + + CrashConsistentFrequencyInMinute + + + RecoveryPointHistoryInMinute + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareToAzStackHciprotectedDiskProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareToAzStackHciprotectedDiskProperties + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CapacityInByte + + + DiskType + + + IsDynamic + + + IsOSDisk + + + MigrateDiskName + + + SeedDiskName + + + SourceDiskId + + + SourceDiskName + + + StorageContainerId + + + StorageContainerLocalPath + + + TestMigrateDiskName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareToAzStackHciprotectedItemModelCustomProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareToAzStackHciprotectedItemModelCustomProperties + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + ActiveLocation + + + CustomLocationRegion + + + FabricDiscoveryMachineId + + + FailoverRecoveryPointId + + + FirmwareType + + + HyperVGeneration + + + InitialReplicationProgressPercentage + + + IsDynamicRam + + + LastRecoveryPointId + + + LastRecoveryPointReceived + + + LastReplicationUpdateTime + + + MigrationProgressPercentage + + + OSName + + + OSType + + + PerformAutoResync + + + ResumeProgressPercentage + + + ResumeRetryCount + + + ResyncProgressPercentage + + + ResyncRequired + + + ResyncRetryCount + + + ResyncState + + + RunAsAccountId + + + SourceApplianceName + + + SourceCpuCore + + + SourceDraName + + + SourceMemoryInMegaByte + + + SourceVMName + + + StorageContainerId + + + TargetApplianceName + + + TargetArcClusterCustomLocationId + + + TargetAzStackHciClusterName + + + TargetCpuCore + + + TargetDraName + + + TargetHciClusterId + + + TargetLocation + + + TargetMemoryInMegaByte + + + TargetNetworkId + + + TargetResourceGroupId + + + TargetVMBiosId + + + TargetVMName + + + TestNetworkId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareToAzStackHciprotectedNicProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareToAzStackHciprotectedNicProperties + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IsPrimaryNic + + + Label + + + MacAddress + + + NetworkName + + + NicId + + + SelectionTypeForFailover + + + TargetNetworkId + + + TestNetworkId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareToAzStackHcireplicationExtensionModelCustomProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareToAzStackHcireplicationExtensionModelCustomProperties + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InstanceType + + + AsrServiceUri + + + AzStackHciFabricArmId + + + AzStackHciSiteId + + + GatewayServiceUri + + + RcmServiceUri + + + ResourceGroup + + + ResourceLocation + + + SourceGatewayServiceId + + + SourceStorageContainerName + + + StorageAccountId + + + StorageAccountSasSecretName + + + SubscriptionId + + + TargetGatewayServiceId + + + TargetStorageContainerName + + + VmwareFabricArmId + + + VmwareSiteId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModel + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModel + + + + + + + + + + + + Name + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCollection + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomProperties + + + + + + + + + + + + InstanceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetails + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetails + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelProperties + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelProperties + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ActivityId + + + AllowedAction + + + DisplayName + + + EndTime + + + ObjectId + + + ObjectInternalId + + + ObjectInternalName + + + ObjectName + + + ObjectType + + + ReplicationProviderId + + + SourceFabricProviderId + + + StartTime + + + State + + + TargetFabricProviderId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelSystemData + + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelSystemData + + + + + + + + + + + + + + + + + + + + + + + + + + + CreatedAt + + + CreatedBy + + + CreatedByType + + + LastModifiedAt + + + LastModifiedBy + + + LastModifiedByType + + + + + + \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/Az.Migrate.psd1 b/src/Migrate/Migrate.Autorest/Az.Migrate.psd1 index 125055facfec..7f8413274072 100644 --- a/src/Migrate/Migrate.Autorest/Az.Migrate.psd1 +++ b/src/Migrate/Migrate.Autorest/Az.Migrate.psd1 @@ -1,154 +1,24 @@ -# -# Module manifest for module 'Az.Migrate' -# -# Generated by: Microsoft Corporation -# -# Generated on: 06/29/2023 -# - @{ - -# Script module or binary module file associated with this manifest. -RootModule = './Az.Migrate.psm1' - -# Version number of this module. -ModuleVersion = '2.2.0' - -# Supported PSEditions -CompatiblePSEditions = 'Core', 'Desktop' - -# ID used to uniquely identify this module -GUID = 'c638312b-9fd1-4611-a5cc-11a8caa5b698' - -# 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: Migrate cmdlets' - -# 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 = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '2.12.4'; }) - -# Assemblies that must be loaded prior to importing this module -RequiredAssemblies = './bin/Az.Migrate.private.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 = './Az.Migrate.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 = 'Get-AzMigrateDiscoveredServer', 'Get-AzMigrateJob', - 'Get-AzMigrateProject', 'Get-AzMigrateReplicationFabric', - 'Get-AzMigrateReplicationPolicy', - 'Get-AzMigrateReplicationProtectionContainer', - 'Get-AzMigrateReplicationProtectionContainerMapping', - 'Get-AzMigrateReplicationRecoveryServicesProvider', - 'Get-AzMigrateRunAsAccount', 'Get-AzMigrateServerReplication', - 'Get-AzMigrateSite', 'Get-AzMigrateSolution', - 'Initialize-AzMigrateReplicationInfrastructure', - 'New-AzMigrateDiskMapping', 'New-AzMigrateNicMapping', - 'New-AzMigrateProject', 'New-AzMigrateReplicationPolicy', - 'New-AzMigrateReplicationProtectionContainerMapping', - 'New-AzMigrateServerReplication', 'New-AzMigrateTestNicMapping', - 'Register-AzMigrateProjectTool', 'Remove-AzMigrateProject', - 'Remove-AzMigrateServerReplication', - 'Restart-AzMigrateServerReplication', - 'Resume-AzMigrateServerReplication', 'Set-AzMigrateDiskMapping', - 'Set-AzMigrateServerReplication', 'Start-AzMigrateServerMigration', - 'Start-AzMigrateTestMigration', - 'Start-AzMigrateTestMigrationCleanup', - 'Suspend-AzMigrateServerReplication' - -# 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 = @() - -# 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 = '*' - -# 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 = @{ - + GUID = 'c638312b-9fd1-4611-a5cc-11a8caa5b698' + RootModule = './Az.Migrate.psm1' + ModuleVersion = '1.0.1' + CompatiblePSEditions = 'Core', 'Desktop' + Author = 'Microsoft Corporation' + CompanyName = 'Microsoft Corporation' + Copyright = 'Microsoft Corporation. All rights reserved.' + Description = 'Microsoft Azure PowerShell: Migrate cmdlets' + PowerShellVersion = '5.1' + DotNetFrameworkVersion = '4.7.2' + RequiredAssemblies = './bin/Az.Migrate.private.dll' + FormatsToProcess = './Az.Migrate.format.ps1xml' + FunctionsToExport = 'Get-AzMigrateDiscoveredServer', 'Get-AzMigrateHCIJob', 'Get-AzMigrateHCIReplicationFabric', 'Get-AzMigrateHCIServerReplication', 'Get-AzMigrateJob', 'Get-AzMigrateProject', 'Get-AzMigrateReplicationFabric', 'Get-AzMigrateReplicationPolicy', 'Get-AzMigrateReplicationProtectionContainer', 'Get-AzMigrateReplicationProtectionContainerMapping', 'Get-AzMigrateReplicationRecoveryServicesProvider', 'Get-AzMigrateRunAsAccount', 'Get-AzMigrateServerReplication', 'Get-AzMigrateSite', 'Get-AzMigrateSolution', 'Initialize-AzMigrateHCIReplicationInfrastructure', 'Initialize-AzMigrateReplicationInfrastructure', 'New-AzMigrateDiskMapping', 'New-AzMigrateHCIDiskMappingObject', 'New-AzMigrateHCINicMappingObject', 'New-AzMigrateHCIServerReplication', 'New-AzMigrateNicMapping', 'New-AzMigrateProject', 'New-AzMigrateReplicationPolicy', 'New-AzMigrateReplicationProtectionContainerMapping', 'New-AzMigrateServerReplication', 'New-AzMigrateTestNicMapping', 'Register-AzMigrateProjectTool', 'Remove-AzMigrateHCIServerReplication', 'Remove-AzMigrateProject', 'Remove-AzMigrateServerReplication', 'Restart-AzMigrateServerReplication', 'Resume-AzMigrateServerReplication', 'Set-AzMigrateDiskMapping', 'Set-AzMigrateHCIServerReplication', 'Set-AzMigrateServerReplication', 'Start-AzMigrateHCIServerMigration', 'Start-AzMigrateServerMigration', 'Start-AzMigrateTestMigration', 'Start-AzMigrateTestMigrationCleanup', 'Suspend-AzMigrateServerReplication', '*' + AliasesToExport = '*' + PrivateData = @{ PSData = @{ - - # Tags applied to this module. These help with module discovery in online galleries. - Tags = 'Azure','ResourceManager','ARM','PSModule','Migrate' - - # 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 = '* Fixed key vault SPN Id coming as null for some users -* Added support for Windows Server OS upgrade while migrating the server to Azure using Azure Migrate -* Updated OsUpgradeVersion parameter for Azure Migrate' - - # 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 = '' - + Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'Migrate' + LicenseUri = 'https://aka.ms/azps-license' + ProjectUri = 'https://github.com/Azure/azure-powershell' + ReleaseNotes = '' + } + } } - diff --git a/src/Migrate/Migrate.Autorest/README.md b/src/Migrate/Migrate.Autorest/README.md index 749da2c821fb..8a9dd79f6d53 100644 --- a/src/Migrate/Migrate.Autorest/README.md +++ b/src/Migrate/Migrate.Autorest/README.md @@ -48,17 +48,22 @@ In this directory, run AutoRest: ``` yaml skip-semantics-validation: true +commit: 0dd49a444195fef7f3555cad038cb7665cbd928c require: - - $(this-folder)/../readme.azure.noprofile.md + - $(this-folder)/../../readme.azure.noprofile.md input-file: - - $(repo)/specification/migrate/resource-manager/Microsoft.OffAzure/stable/2020-01-01/migrate.json - - $(repo)/specification/migrateprojects/resource-manager/Microsoft.Migrate/preview/2018-09-01-preview/migrate.json - - $(repo)/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-01-01/service.json + - $(repo)/specification/migrate/resource-manager/Microsoft.OffAzure/stable/2020-01-01/migrate.json + - $(repo)/specification/migrateprojects/resource-manager/Microsoft.Migrate/preview/2018-09-01-preview/migrate.json + - $(repo)/specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-01-01/service.json + - $(repo)/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/recoveryservicesdatareplication.json module-version: 1.0.1 title: Migrate subject-prefix: 'Migrate' +use-extension: + "@autorest/powershell": "3.x" + directive: # Correct some swagger operationIds - from: Microsoft.OffAzure/stable/2020-01-01/migrate.json @@ -101,6 +106,22 @@ directive: - ProtectionContainerMappingProviderSpecificDetails - MigrateProjectProperties - FabricProperties + - FabricModelProperties + - FabricModelCustomProperties + - AzStackHCIFabricModelCustomProperties + - HyperVMigrateFabricModelCustomProperties + - VMwareMigrateFabricModelCustomProperties + - PolicyModelProperties + - ReplicationExtensionModelProperties + - ProtectedItemModelProperties + - ProtectedItemModelCustomProperties + - HyperVToAzStackHCIProtectedItemModelCustomProperties + - VMwareToAzStackHCIProtectedItemModelCustomProperties + - PlannedFailoverModelProperties + - WorkflowModelProperties + - WorkflowModelCustomProperties + - TaskModel + - TaskModelCustomProperties # Remove variants not in scope - from: Microsoft.RecoveryServices/stable/2023-01-01/service.json where: @@ -220,10 +241,6 @@ directive: verb: New$|Remove$|Update$ subject: ^Site remove: true - - from: Microsoft.OffAzure/stable/2020-01-01/migrate.json - where: - subject: ^HyperV - remove: true - from: Microsoft.OffAzure/stable/2020-01-01/migrate.json where: subject: ^Job|^VMwareOperationsStatus @@ -240,7 +257,12 @@ directive: - from: Microsoft.Migrate/preview/2018-09-01-preview/migrate.json where: verb: Set$|Remove$|Update$ - subject: ^Solution|ProjectSummary$ + subject: ProjectSummary$ + remove: true + - from: Microsoft.Migrate/preview/2018-09-01-preview/migrate.json + where: + verb: Remove$|Update$ + subject: ^Solution remove: true - from: Microsoft.Migrate/preview/2018-09-01-preview/migrate.json where: @@ -257,7 +279,7 @@ directive: remove: true - from: Microsoft.RecoveryServices/stable/2023-01-01/service.json where: - subject: ^Commit|^Planned|^Renew|^Reprotect|^Unplanned|VaultHealth$|ComputeSize$|FabricConsistency$ + subject: ^Commit|^Renew|^Reprotect|^Unplanned|VaultHealth$|ComputeSize$|FabricConsistency$ remove: true - from: Microsoft.RecoveryServices/stable/2023-01-01/service.json where: @@ -294,7 +316,74 @@ directive: verb: New subject: ^ReplicationVaultSetting|^SupportedOperatingSystem|^ReplicationProtectionIntent remove: true + - from: Microsoft.OffAzure/stable/2020-01-01/migrate.json + where: + verb: Get + subject: ^HyperV(Cluster|Host|Job|OperationsStatus)$ + remove: true + - from: Microsoft.OffAzure/stable/2020-01-01/migrate.json + where: + verb: Set + subject: ^HyperV(Cluster|Host)$ + remove: true + - from: Microsoft.OffAzure/stable/2020-01-01/migrate.json + where: + verb: New|Remove|Update + subject: ^HyperV + remove: true + - from: Microsoft.DataReplication/preview/2021-02-16-preview/recoveryservicesdatareplication.json + where: + verb: Test|Invoke + subject: NameAvailability$|DeploymentPreflight + remove: true + - from: Microsoft.DataReplication/preview/2021-02-16-preview/recoveryservicesdatareplication.json + where: + verb: Get|New + subject: ^EmailConfiguration + remove: true + - from: Microsoft.DataReplication/preview/2021-02-16-preview/recoveryservicesdatareplication.json + where: + verb: Get + subject: ^(Dra|ProtectedItem|Vault|Workflow)OperationStatus$ + remove: true + - from: Microsoft.DataReplication/preview/2021-02-16-preview/recoveryservicesdatareplication.json + where: + verb: Get + subject: ^FabricOperationsStatus$ + remove: true + - from: Microsoft.DataReplication/preview/2021-02-16-preview/recoveryservicesdatareplication.json + where: + verb: New + subject: ^(Dra|Vault) + remove: true + - from: Microsoft.DataReplication/preview/2021-02-16-preview/recoveryservicesdatareplication.json + where: + verb: Update + subject: ^Vault + remove: true + - from: Microsoft.RecoveryServices/stable/2023-01-01/service.json + where: + verb: Invoke + subject: ^PlannedReplication + remove: true + # Rename cmdlets for AzStackHCI + - from: Microsoft.DataReplication/preview/2021-02-16-preview/recoveryservicesdatareplication.json + where: + verb: Get + subject: ^Fabric$ + set: + subject: HCIReplicationFabric # Hide cmldets used by custom + - from: Microsoft.Migrate/preview/2018-09-01-preview/migrate.json + where: + verb: Set$ + subject: ^Solution + hide: true + - from: Microsoft.RecoveryServices/stable/2023-01-01/service.json + where: + verb: Get$ + subject: ToAzureMigrate$ + hide: true - from: Microsoft.RecoveryServices/stable/2023-01-01/service.json where: verb: Get$ @@ -340,6 +429,15 @@ directive: verb: Resume$ subject: ^ReplicationMigrationItemReplication hide: true + - from: Microsoft.RecoveryServices/stable/2023-01-01/service.json + where: + subject: ^Planned + hide: true + - from: Microsoft.OffAzure/stable/2020-01-01/migrate.json + where: + verb: Get + subject: ^HyperV(Site|RunAsAccount)$ + hide: true # Hide cmdlets not to be visible to user. - from: Microsoft.Migrate/preview/2018-09-01-preview/migrate.json where: @@ -369,6 +467,11 @@ directive: verb: New$ variant: ^CreateViaIdentity hide: true + - from: Microsoft.DataReplication/preview/2021-02-16-preview/recoveryservicesdatareplication.json + where: + verb: Get$|Invoke$|New$|Remove$|Test$|Update$ + subject: ^Dra|^Fabric|^Policy|^EmailConfiguration|^ProtectedItem|^ReplicationExtension|^Vault|^Workflow + hide: true - where: verb: New$|Set$|Update$ subject: Site$|VCenter$ diff --git a/src/Migrate/Migrate.Autorest/UX/Microsoft.DataReplication/replicationFabrics.json b/src/Migrate/Migrate.Autorest/UX/Microsoft.DataReplication/replicationFabrics.json new file mode 100644 index 000000000000..9d3d7946fb94 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/UX/Microsoft.DataReplication/replicationFabrics.json @@ -0,0 +1,47 @@ +{ + "resourceType": "replicationFabrics", + "apiVersion": "2021-02-16-preview", + "learnMore": { + "url": "https://learn.microsoft.com/powershell/module/az.migrate" + }, + "commands": [ + { + "name": "Get-AzMigrateHCIReplicationFabric", + "description": "Gets the details of the fabric.", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}", + "help": { + "learnMore": { + "url": "https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratehcireplicationfabric" + }, + "parameterSets": [ + { + "parameters": [ + "-Name ", + "-ResourceGroupName ", + "[-SubscriptionId ]" + ] + } + ] + }, + "examples": [ + { + "description": "Gets the details of the fabric.", + "parameters": [ + { + "name": "-Name", + "value": "[Path.fabricName]" + }, + { + "name": "-ResourceGroupName", + "value": "[Path.resourceGroupName]" + }, + { + "name": "-SubscriptionId", + "value": "[Path.subscriptionId]" + } + ] + } + ] + } + ] +} diff --git a/src/Migrate/Migrate.Autorest/build-module.ps1 b/src/Migrate/Migrate.Autorest/build-module.ps1 index 737a58e36efb..8a247d557ab3 100644 --- a/src/Migrate/Migrate.Autorest/build-module.ps1 +++ b/src/Migrate/Migrate.Autorest/build-module.ps1 @@ -143,7 +143,8 @@ if($NoDocs) { $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 + $addComplexInterfaceInfo = ![System.Convert]::ToBoolean('true') + Export-ProxyCmdlet -ModuleName $moduleName -ModulePath $modulePaths -ExportsFolder $exportsFolder -InternalFolder $internalFolder -ModuleDescription $moduleDescription -DocsFolder $docsFolder -ExamplesFolder $examplesFolder -ModuleGuid $guid -AddComplexInterfaceInfo:$addComplexInterfaceInfo } Write-Host -ForegroundColor Green 'Creating format.ps1xml...' @@ -162,4 +163,10 @@ Export-TestStub -ModuleName $moduleName -ExportsFolder $exportsFolder -OutputFol Write-Host -ForegroundColor Green 'Creating example stubs...' Export-ExampleStub -ExportsFolder $exportsFolder -OutputFolder $examplesFolder +if (Test-Path (Join-Path $PSScriptRoot 'generate-portal-ux.ps1')) +{ + Write-Host -ForegroundColor Green 'Creating ux metadata...' + . (Join-Path $PSScriptRoot 'generate-portal-ux.ps1') +} + Write-Host -ForegroundColor Green '-------------Done-------------' diff --git a/src/Migrate/Migrate.Autorest/custom/AzStackHCIDiskInput.cs b/src/Migrate/Migrate.Autorest/custom/AzStackHCIDiskInput.cs new file mode 100644 index 000000000000..779629268edc --- /dev/null +++ b/src/Migrate/Migrate.Autorest/custom/AzStackHCIDiskInput.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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + public class AzStackHCIDiskInput + { + public AzStackHCIDiskInput( + string diskId, + bool isDynamic, + long diskSizeGB, + string diskFileFormat, + bool isOsDisk) + { + DiskId = diskId; + IsDynamic = isDynamic; + DiskSizeGb = diskSizeGB; + DiskFileFormat = diskFileFormat; + IsOSDisk = isOsDisk; + } + + /// Gets or sets the type of the virtual hard disk, vhd or vhdx. + public string DiskFileFormat { get; set; } + + /// Gets or sets the disk Id. + public string DiskId { get; set; } + + /// Gets or sets the disk size in GB. + public long DiskSizeGb { get; set; } + + /// + /// Gets or sets a value indicating whether dynamic sizing is enabled on the virtual hard + /// disk. + /// + public bool? IsDynamic { get; set; } + + /// Gets or sets a value indicating whether disk is os disk. + public bool IsOSDisk { get; set; } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/custom/AzStackHCINicInput.cs b/src/Migrate/Migrate.Autorest/custom/AzStackHCINicInput.cs new file mode 100644 index 000000000000..44929f7ddf97 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/custom/AzStackHCINicInput.cs @@ -0,0 +1,32 @@ +// 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.Migrate.Models.Api20210216Preview +{ + public class AzStackHCINicInput + { + public AzStackHCINicInput( + string nicId, + string targetNetworkId, + string testNetworkId, + string selectionTypeForFailover) + { + NicId = nicId; + TargetNetworkId = targetNetworkId; + TestNetworkId = testNetworkId; + SelectionTypeForFailover = selectionTypeForFailover; + } + + /// Gets or sets the NIC Id. + public string NicId { get; set; } + + /// Gets or sets the target network Id within AzStackHCI Cluster. + public string TargetNetworkId { get; set; } + + /// Gets or sets the target test network Id within AzStackHCI Cluster. + public string TestNetworkId { get; set; } + + /// Gets or sets the selection type of the NIC. + public string SelectionTypeForFailover { get; set; } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/custom/Get-AzMigrateDiscoveredServer.ps1 b/src/Migrate/Migrate.Autorest/custom/Get-AzMigrateDiscoveredServer.ps1 index 1dd26a2c2cf7..e0cb94cc8db0 100644 --- a/src/Migrate/Migrate.Autorest/custom/Get-AzMigrateDiscoveredServer.ps1 +++ b/src/Migrate/Migrate.Autorest/custom/Get-AzMigrateDiscoveredServer.ps1 @@ -23,8 +23,10 @@ https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratediscovered #> function Get-AzMigrateDiscoveredServer { - [OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVMwareMachine])] - [CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] + [OutputType( + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVMwareMachine], + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVMachine])] + [CmdletBinding(DefaultParameterSetName = 'List', PositionalBinding = $false, SupportsShouldProcess, ConfirmImpact = 'Medium')] param ( [Parameter(Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] @@ -38,30 +40,38 @@ function Get-AzMigrateDiscoveredServer { # Specifies the resource group name. ${ResourceGroupName}, - [Parameter(ParameterSetName='Get', Mandatory)] - [Parameter(ParameterSetName='GetInSite', Mandatory)] + [Parameter(ParameterSetName = 'Get', Mandatory)] + [Parameter(ParameterSetName = 'GetInSite', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [System.String] - # Specifies the VMware machine name. This is an internal Name. For users, use display name. + # Specifies the source machine name. This is an internal Name. For users, use display name. ${Name}, - [Parameter(ParameterSetName='List')] - [Parameter(ParameterSetName='ListInSite')] + [Parameter(ParameterSetName = 'List')] + [Parameter(ParameterSetName = 'ListInSite')] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [System.String] - # Specifies the VMware machine display name. + # Specifies the source machine display name. ${DisplayName}, - [Parameter(ParameterSetName='GetInSite', Mandatory)] - [Parameter(ParameterSetName='ListInSite', Mandatory)] + [Parameter(ParameterSetName = 'GetInSite', Mandatory)] + [Parameter(ParameterSetName = 'ListInSite', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [System.String] # Specifies the appliance name. This internally maps to a site. ${ApplianceName}, [Parameter()] + [ValidateSet("VMware", "HyperV")] + [ArgumentCompleter( { "VMware", "HyperV" })] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Specifies the source machine type. Currently, only HyperV and VMware are supported. + ${SourceMachineType} = "VMware", + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script = '(Get-AzContext).Subscription.Id')] [System.String[]] # Specifies the subscription id. ${SubscriptionId} @@ -69,117 +79,159 @@ function Get-AzMigrateDiscoveredServer { process { $parameterSet = $PSCmdlet.ParameterSetName + $hasApplianceName = $PSBoundParameters.ContainsKey("ApplianceName") $discoverySolutionName = "Servers-Discovery-ServerDiscovery" - $discoverySolution = Get-AzMigrateSolution -SubscriptionId $SubscriptionId -ResourceGroupName $ResourceGroupName -MigrateProjectName $ProjectName -Name $discoverySolutionName - if ($discoverySolution.Name -ne $discoverySolutionName) { + $discoverySolution = Az.Migrate\Get-AzMigrateSolution -SubscriptionId $SubscriptionId -ResourceGroupName $ResourceGroupName -MigrateProjectName $ProjectName -Name $discoverySolutionName + if ($discoverySolution.Name -ne $discoverySolutionName) + { throw "Server Discovery Solution not found." } $appMap = @{} - if ($null -ne $discoverySolution.DetailExtendedDetail["applianceNameToSiteIdMapV2"]) { + if ($null -ne $discoverySolution.DetailExtendedDetail["applianceNameToSiteIdMapV2"]) + { $appMapV2 = $discoverySolution.DetailExtendedDetail["applianceNameToSiteIdMapV2"] | ConvertFrom-Json # Fetch all appliance from V2 map first. Then these can be updated if found again in V3 map. - foreach ($item in $appMapV2) { + foreach ($item in $appMapV2) + { $appMap[$item.ApplianceName] = $item.SiteId } } - if ($null -ne $discoverySolution.DetailExtendedDetail["applianceNameToSiteIdMapV3"]) { + if ($null -ne $discoverySolution.DetailExtendedDetail["applianceNameToSiteIdMapV3"]) + { $appMapV3 = $discoverySolution.DetailExtendedDetail["applianceNameToSiteIdMapV3"] | ConvertFrom-Json - foreach ($item in $appMapV3) { + foreach ($item in $appMapV3) + { $t = $item.psobject.properties $appMap[$t.Name] = $t.Value.SiteId } } if ($null -eq $discoverySolution.DetailExtendedDetail["applianceNameToSiteIdMapV2"] -And - $null -eq $discoverySolution.DetailExtendedDetail["applianceNameToSiteIdMapV3"] ) { + $null -eq $discoverySolution.DetailExtendedDetail["applianceNameToSiteIdMapV3"] ) + { throw "Server Discovery Solution missing Appliance Details. Invalid Solution." } # Regex to match site name. - $r = '(?<=/Microsoft.OffAzure/VMwareSites/).*$' - $siteNameTmp = "" - if ($parameterSet -match "Site") { - #Fetch by site scenario. This is when site name filter is provided. - $siteFound = 0 - foreach ($kvp in $appMap.GetEnumerator()) { - if ($kvp.Key -eq $ApplianceName) { - $siteArmId = $kvp.Value - if ($siteArmId -match $r) { - $siteNameTmp = $Matches[0] - $siteFound = 1 - if ($parameterSet -eq 'GetInSite') { - return Get-AzMigrateMachine -Name $Name -ResourceGroupName $ResourceGroupName -SiteName $siteNameTmp -SubscriptionId $SubscriptionId - } - elseif ($parameterSet -eq 'ListInSite') { - $siteMachines = Get-AzMigrateMachine -ResourceGroupName $ResourceGroupName -SiteName $siteNameTmp -SubscriptionId $SubscriptionId - - if ($DisplayName) { - $filteredMachines = $siteMachines | Where-Object {$_.DisplayName -match $DisplayName} - return $filteredMachines - } - else { - return $siteMachines - } - } - } + if ($SourceMachineType -eq "VMware") + { + $siteRegex = "(?<=/Microsoft.OffAzure/VMwareSites/).*$" + } + else { + $siteRegex = "(?<=/Microsoft.OffAzure/HyperVSites/).*$" + } + + if ($parameterSet -match 'Get') + { + # Get or GetInSite + foreach ($kvp in $appMap.GetEnumerator()) + { + if (($kvp.Value -match $siteRegex) -and + (-not (($parameterSet -eq 'GetInSite') -and ($kvp.Key -ne $ApplianceName)))) + { + $siteNameTmp = $Matches[0] + if ($SourceMachineType -eq "VMware") + { + $machine = Az.Migrate.Internal\Get-AzMigrateMachine ` + -Name $Name ` + -ResourceGroupName $ResourceGroupName ` + -SiteName $siteNameTmp ` + -SubscriptionId $SubscriptionId ` + -ErrorVariable notPresent ` + -ErrorAction SilentlyContinue + } + else { + # HyperV + $machine = Az.Migrate.Internal\Get-AzMigrateHyperVMachine ` + -MachineName $Name ` + -ResourceGroupName $ResourceGroupName ` + -SiteName $siteNameTmp ` + -SubscriptionId $SubscriptionId ` + -ErrorVariable notPresent ` + -ErrorAction SilentlyContinue + } + + # Remove server marked as Deleted. + if ($null -ne $machine -and $machine.IsDeleted) + { + $machine = $null + } + + if ($null -ne $machine) + { + return $machine + } } } - if ($siteFound -eq 0) { - throw "Appiance: $ApplianceName not found in project $ProjectName." + $errorMsg = "No machine with machine Name '$Name' of Type '$SourceMachineType' found in Project '$ProjectName'" + if ($hasApplianceName) + { + $errorMsg += " with Appliance '$ApplianceName'" } + + throw $errorMsg } else { - # Fetch across project. All machines or by name. - $projectSdsMachines = [System.Collections.ArrayList]::new() + # List or ListInSite + $allMachines = [System.Collections.ArrayList]::new() + foreach ($kvp in $appMap.GetEnumerator()) + { + if (($kvp.Value -match $siteRegex) -and + (-not (($parameterSet -eq 'ListInSite') -and ($kvp.Key -ne $ApplianceName)))) + { + $siteNameTmp = $Matches[0] + if ($SourceMachineType -eq "VMware") + { + $machines = Az.Migrate.Internal\Get-AzMigrateMachine ` + -ResourceGroupName $ResourceGroupName ` + -SiteName $siteNameTmp ` + -SubscriptionId $SubscriptionId + } + else { + # HyperV + $machines = Az.Migrate.Internal\Get-AzMigrateHyperVMachine ` + -ResourceGroupName $ResourceGroupName ` + -SiteName $siteNameTmp ` + -SubscriptionId $SubscriptionId + } - if ($parameterSet -eq 'List') { - foreach ($kvp in $appMap.GetEnumerator()) { - $siteArmId = $kvp.Value - - if ($siteArmId -match $r) { - $siteNameTmp = $Matches[0] - $siteMachines = Get-AzMigrateMachine -ResourceGroupName $ResourceGroupName -SiteName $siteNameTmp -SubscriptionId $SubscriptionId - if ($null -ne $siteMachines) { - $projectSdsMachines.AddRange($siteMachines) - } + if ($null -ne $machines) + { + $allMachines.AddRange($machines) } } + } - if ($DisplayName) { - $filteredMachines = $projectSdsMachines | Where-Object {$_.DisplayName -match $DisplayName} - return $filteredMachines - } - else { - return $projectSdsMachines - } + # Remove servers marked as Deleted. + $allMachines = $allMachines | Where-Object { !$_.IsDeleted } + + if ($allMachines.Count -gt 0 -and $DisplayName) + { + $allMachines = $allMachines | Where-Object { $_.DisplayName -match $DisplayName } } - elseif ($parameterSet -eq 'Get') { - foreach ($kvp in $appMap.GetEnumerator()) { - $siteArmId = $kvp.Value - - if ($siteArmId -match $r) { - $siteNameTmp = $Matches[0] - - try { - $siteMachine = Get-AzMigrateMachine -Name $Name -ResourceGroupName $ResourceGroupName -SiteName $siteNameTmp -SubscriptionId $SubscriptionId - if ($null -ne $siteMachine) { - return $siteMachine - } - } - catch { - $theError = $_ - Write-Host $theError - } - } + + if ($allMachines.Count -eq 0) + { + $errorMsg = "No machine of Type '$SourceMachineType' found in Project '$ProjectName'" + if ($hasApplianceName) + { + $errorMsg += " with Appliance '$ApplianceName'" + } + + if ($DisplayName) + { + $errorMsg += " with matching machine DisplayName '$DisplayName'" } - throw "Machine with Id $Name not found in project $ProjectName." + throw $errorMsg } + + return $allMachines } } } \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/custom/Get-AzMigrateHCIJob.ps1 b/src/Migrate/Migrate.Autorest/custom/Get-AzMigrateHCIJob.ps1 new file mode 100644 index 000000000000..f360c51a956e --- /dev/null +++ b/src/Migrate/Migrate.Autorest/custom/Get-AzMigrateHCIJob.ps1 @@ -0,0 +1,188 @@ + +# ---------------------------------------------------------------------------------- +# +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Retrieves the status of an Azure Migrate job. +.Description +The Get-AzMigrateHCIJob cmdlet retrives the status of an Azure Migrate job. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratehcijob +#> +function Get-AzMigrateHCIJob { + [OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel])] + [CmdletBinding(DefaultParameterSetName = 'ListByName', PositionalBinding = $false)] + param( + [Parameter(ParameterSetName = 'GetById', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the job id for which the details needs to be retrieved. + ${ID}, + + [Parameter(ParameterSetName = 'GetByName', Mandatory)] + [Parameter(ParameterSetName = 'ListByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName = 'GetByName', Mandatory)] + [Parameter(ParameterSetName = 'ListByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the migrate project. + ${ProjectName}, + + [Parameter(ParameterSetName = 'GetByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Job identifier + ${Name}, + + [Parameter(ParameterSetName = 'GetByInputObject', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # Specifies the job object of the replicating server. + ${InputObject}, + + [Parameter(ParameterSetName = 'ListById', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the Resource Group of the Azure Migrate Project in the current subscription. + ${ResourceGroupID}, + + [Parameter(ParameterSetName = 'ListById', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the Azure Migrate Project in which servers are replicating. + ${ProjectID}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script = '(Get-AzContext).Subscription.Id')] + [System.String] + # Azure Subscription ID. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} + ) + + process { + $parameterSet = $PSCmdlet.ParameterSetName + $null = $PSBoundParameters.Remove('ID') + $null = $PSBoundParameters.Remove('ResourceGroupName') + $null = $PSBoundParameters.Remove('ProjectName') + $null = $PSBoundParameters.Remove('Name') + $null = $PSBoundParameters.Remove('InputObject') + $null = $PSBoundParameters.Remove('ResourceGroupID') + $null = $PSBoundParameters.Remove('ProjectID') + + if (($parameterSet -match 'Name') -or ($parameterSet -eq 'ListById')) { + if ($parameterSet -eq 'ListById') { + $ProjectIdArray = $ProjectID.Split("/") + if ($ProjectIdArray.Length -lt 9) { + throw "Invalid Project ID '$ProjectID'" + } + $ProjectName = $ProjectIdArray[8] + $ResourceGroupName = $ResourceGroupID.Split("/")[4] + } + $null = $PSBoundParameters.Add("ResourceGroupName", $ResourceGroupName) + $null = $PSBoundParameters.Add("Name", "Servers-Migration-ServerMigration_DataReplication") + $null = $PSBoundParameters.Add("MigrateProjectName", $ProjectName) + + $solution = Az.Migrate\Get-AzMigrateSolution @PSBoundParameters + if ($solution -and ($solution.Count -ge 1)) { + $vaultId = $solution.DetailExtendedDetail["vaultId"] + $vaultIdArray = $vaultId.Split("/") + if ($vaultIdArray.Length -lt 9) { + throw "Invalid Vault ID '$vaultId'" + } + $vaultName = $vaultIdArray[8] + } + else { + throw "Solution not found." + } + + $null = $PSBoundParameters.Remove("ResourceGroupName") + $null = $PSBoundParameters.Remove("Name") + $null = $PSBoundParameters.Remove("MigrateProjectName") + } + else { + if ($parameterSet -eq 'GetByInputObject') { + $ID = $InputObject.Id + } + $jobIdArray = $ID.split('/') + if ($jobIdArray.Length -lt 11) { + throw "Invalid Job ID '$ID'" + } + $ResourceGroupName = $jobIdArray[4] + $vaultName = $jobIdArray[8] + $Name = $jobIdArray[10] + } + + $null = $PSBoundParameters.Add('ResourceGroupName', $ResourceGroupName) + $null = $PSBoundParameters.Add('VaultName', $vaultName) + if ($parameterSet -match 'Get') { + $null = $PSBoundParameters.Add('JobName', $Name) + } + + return Az.Migrate.Internal\Get-AzMigrateWorkflow @PSBoundParameters -ErrorVariable notPresent -ErrorAction SilentlyContinue + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/custom/Get-AzMigrateHCIServerReplication.ps1 b/src/Migrate/Migrate.Autorest/custom/Get-AzMigrateHCIServerReplication.ps1 new file mode 100644 index 000000000000..25a19d1ba311 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/custom/Get-AzMigrateHCIServerReplication.ps1 @@ -0,0 +1,280 @@ + +# ---------------------------------------------------------------------------------- +# +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Retrieves the details of the replicating server. +.Description +The Get-AzMigrateHCIServerReplication cmdlet retrieves the object for the replicating server. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratehciserverreplication +#> +function Get-AzMigrateHCIServerReplication { + [OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel])] + [CmdletBinding(DefaultParameterSetName = 'ListByName', PositionalBinding = $false)] + param( + [Parameter(ParameterSetName = 'GetByItemID', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the replicating server ARM ID. + ${TargetObjectID}, + + [Parameter(ParameterSetName = 'ListByName', Mandatory)] + [Parameter(ParameterSetName = 'GetByMachineName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the Resource Group of the Azure Migrate Project in the current subscription. + ${ResourceGroupName}, + + [Parameter(ParameterSetName = 'ListByName', Mandatory)] + [Parameter(ParameterSetName = 'GetByMachineName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the Azure Migrate project in the current subscription. + ${ProjectName}, + + [Parameter(ParameterSetName = 'GetBySDSID', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the machine ID of the discovered server. + ${DiscoveredMachineId}, + + [Parameter(ParameterSetName = 'GetByInputObject', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # Specifies the machine object of the replicating server. + ${InputObject}, + + [Parameter(ParameterSetName = 'ListById', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the Resource Group of the Azure Migrate Project in the current subscription. + ${ResourceGroupID}, + + [Parameter(ParameterSetName = 'ListById', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the Azure Migrate Project in which servers are replicating. + ${ProjectID}, + + [Parameter(ParameterSetName = 'GetByMachineName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the display name of the replicating machine. + ${MachineName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script = '(Get-AzContext).Subscription.Id')] + [System.String] + # Azure Subscription ID. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} + ) + + process { + Import-Module $PSScriptRoot\Helper\AzStackHCICommonSettings.ps1 + + $parameterSet = $PSCmdlet.ParameterSetName + $null = $PSBoundParameters.Remove('TargetObjectID') + $null = $PSBoundParameters.Remove('ResourceGroupName') + $null = $PSBoundParameters.Remove('ProjectName') + $null = $PSBoundParameters.Remove('DiscoveredMachineId') + $null = $PSBoundParameters.Remove('InputObject') + $null = $PSBoundParameters.Remove('ResourceGroupID') + $null = $PSBoundParameters.Remove('ProjectID') + $null = $PSBoundParameters.Remove('MachineName') + + if ($parameterSet -eq 'GetBySDSID') { + $machineIdArray = $DiscoveredMachineId.Split("/") + if ($machineIdArray.Length -lt 11) { + throw "Invalid machine ID '$DiscoveredMachineId'" + } + $siteType = $machineIdArray[7] + $siteName = $machineIdArray[8] + $ResourceGroupName = $machineIdArray[4] + $ProtectedItemName = $machineIdArray[10] + + $null = $PSBoundParameters.Add('ResourceGroupName', $ResourceGroupName) + $null = $PSBoundParameters.Add('SiteName', $siteName) + + if (($siteType -ne $SiteTypes.HyperVSites) -and ($siteType -ne $SiteTypes.VMwareSites)) { + throw "Unknown machine site '$siteName' with Type '$siteType'." + } + + # Occasionally, Get Machine Site will not return machine site even when the site exist, + # hence retry get machine site. + $attempts = 4 + for ($i = 1; $i -le $attempts; $i++) { + try { + if ($siteType -eq $SiteTypes.VMwareSites) { + $siteObject = Az.Migrate\Get-AzMigrateSite @PSBoundParameters -ErrorVariable notPresent -ErrorAction SilentlyContinue + } + elseif ($siteType -eq $SiteTypes.HyperVSites) { + $siteObject = Az.Migrate.Internal\Get-AzMigrateHyperVSite @PSBoundParameters -ErrorVariable notPresent -ErrorAction SilentlyContinue + } + + if ($null -eq $siteObject) { + throw "Machine site not found." + } + else { + $ProjectName = $siteObject.DiscoverySolutionId.Split("/")[8] + } + + break; + } + catch { + if ($i -lt $attempts) + { + Write-Host "Machine site not found. Retrying in 30 seconds..." + Start-Sleep -Seconds 30 + } + else + { + throw "Machine site '$siteName' with Type '$siteType' not found." + } + } + } + + $null = $PSBoundParameters.Remove('SiteName') + + $null = $PSBoundParameters.Add("Name", "Servers-Migration-ServerMigration_DataReplication") + $null = $PSBoundParameters.Add("MigrateProjectName", $ProjectName) + + $solution = Az.Migrate\Get-AzMigrateSolution @PSBoundParameters + if ($solution -and ($solution.Count -ge 1)) { + $VaultName = $solution.DetailExtendedDetail.AdditionalProperties.vaultId.Split("/")[8] + } + else { + throw "Solution not found." + } + + $null = $PSBoundParameters.Remove("Name") + $null = $PSBoundParameters.Remove("MigrateProjectName") + + $null = $PSBoundParameters.Add("VaultName", $VaultName) + $null = $PSBoundParameters.Add("Name", $ProtectedItemName) + + return Az.Migrate.Internal\Get-AzMigrateProtectedItem @PSBoundParameters -ErrorVariable notPresent -ErrorAction SilentlyContinue + } + + if (($parameterSet -match 'List') -or ($parameterSet -eq 'GetByMachineName')) { + # Retrieve ResourceGroupName, ProjectName if ListByID + if ($parameterSet -eq 'ListByID') { + $resourceGroupIdArray = $ResourceGroupID.Split('/') + if ($resourceGroupIdArray.Length -lt 5) { + throw "Invalid resource group Id '$ResourceGroupID'." + } + + $ResourceGroupName = $resourceGroupIdArray[4] + + $projectIdArray = $ProjectID.Split('/') + if ($projectIdArray.Length -lt 9) { + throw "Invalid migrate project Id '$ProjectID'." + } + + $ProjectName = $projectIdArray[8] + } + + $null = $PSBoundParameters.Add("ResourceGroupName", $ResourceGroupName) + $null = $PSBoundParameters.Add("Name", "Servers-Migration-ServerMigration_DataReplication") + $null = $PSBoundParameters.Add("MigrateProjectName", $ProjectName) + + $solution = Az.Migrate\Get-AzMigrateSolution @PSBoundParameters + if ($solution -and ($solution.Count -ge 1)) { + $VaultName = $solution.DetailExtendedDetail.AdditionalProperties.vaultId.Split("/")[8] + } + else { + throw "Solution not found." + } + + $null = $PSBoundParameters.Remove("Name") + $null = $PSBoundParameters.Remove("MigrateProjectName") + $null = $PSBoundParameters.Add("VaultName", $VaultName) + + $replicatingItems = Az.Migrate.Internal\Get-AzMigrateProtectedItem @PSBoundParameters -ErrorVariable notPresent -ErrorAction SilentlyContinue + + if ($parameterSet -eq "GetByMachineName") { + $replicatingItems = $replicatingItems | Where-Object { $_.Property.FabricObjectName -eq $MachineName } + } + return $replicatingItems + } + + if (($parameterSet -eq "GetByInputObject") -or ($parameterSet -eq "GetByItemID")) { + if ($parameterSet -eq 'GetByInputObject') { + $TargetObjectID = $InputObject.Id + } + $objectIdArray = $TargetObjectID.Split("/") + if ($objectIdArray.Length -lt 11) { + throw "Invalid target object ID '$TargetObjectID'." + } + + $ResourceGroupName = $objectIdArray[4] + $VaultName = $objectIdArray[8] + $ProtectedItemName = $objectIdArray[10] + $null = $PSBoundParameters.Add("ResourceGroupName", $ResourceGroupName) + $null = $PSBoundParameters.Add("VaultName", $VaultName) + $null = $PSBoundParameters.Add("Name", $ProtectedItemName) + + return Az.Migrate.Internal\Get-AzMigrateProtectedItem @PSBoundParameters -ErrorVariable notPresent -ErrorAction SilentlyContinue + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/custom/Helper/AzStackHCICommonSettings.ps1 b/src/Migrate/Migrate.Autorest/custom/Helper/AzStackHCICommonSettings.ps1 new file mode 100644 index 000000000000..b358ef4b966e --- /dev/null +++ b/src/Migrate/Migrate.Autorest/custom/Helper/AzStackHCICommonSettings.ps1 @@ -0,0 +1,78 @@ +$AzStackHCIInstanceTypes = @{ + HyperVToAzStackHCI = "HyperVToAzStackHCI"; + VMwareToAzStackHCI = "VMwareToAzStackHCI"; +} + +# Fabric instances +$FabricInstanceTypes = @{ + HyperVInstance = "HyperVMigrate"; + VMwareInstance = "VMwareMigrate"; + AzStackHCIInstance = "AzStackHCI"; +} + +$ReplicationDetails = @{ + PolicyDetails = @{ + DefaultCrashConsistentFrequencyInMinutes = 60; + DefaultAppConsistentFrequencyInMinutes = 240; + DefaultRecoveryPointHistoryInMinutes = 4320; + }; + ReplicationPollDelaySeconds = 180; + ReplicationTimeoutSeconds = 1800; +} + +$ApiVersions = @{ + ReplicationPolicy = "2021-02-16-preview"; + ReplicationFabric = "2021-02-16-preview"; + ReplicationExtension = "2021-02-16-preview"; + StorageAccount = "2021-09-01"; + HyperVSites = "2020-01-01"; + ProtectedItem = "2021-02-16-preview"; + AzStackHCI = "2021-09-01-preview"; +} + +# Role definition GUIDs for storage account creation +$RoleDefinitionIds = @{ + ContributorId = "b24988ac-6180-42a0-ab88-20f7382dd24c"; + StorageBlobDataContributorId = "ba92f5b4-2d11-453d-a403-e96b0029c9fe"; +} + +$RunAsAccountCredentialTypes = @{ + HyperVFabric = "HyperVFabric"; + VMwareFabric = "VMwareFabric"; + DomainCredential = "DomainCredential"; +} + +$SiteTypes = @{ + HyperVSites = "HyperVSites"; + VMwareSites = "VMwareSites"; +} + +$RAMConfig = @{ + GbToMb = 1024; + MinTargetMemoryInMB = 1024; # 1 GB + MaxTargetMemoryGen1InMB = 1048576; # 1 TB + MaxTargetMemoryGen2InMB = 12582912; # 12 TB + DefaultMinDynamicMemoryInMB = 1024; # 1 GB + DefaultMaxDynamicMemoryInMB = 1048576; # 1 TB + DefaultTargetMemoryBufferPercentage = 20; # 20 % + MinTargetMemoryBufferPercentage = 5; # 5 % + MaxTargetMemoryBufferPercentage = 2000; # 2000 % +} + +enum ProvisioningState +{ + Canceled + Creating + Deleting + Deleted + Failed + Succeeded + Updating +} + +enum StorageAccountProvisioningState +{ + Creating + ResolvingDNS + Succeeded +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/custom/Helper/CommonHelper.ps1 b/src/Migrate/Migrate.Autorest/custom/Helper/CommonHelper.ps1 new file mode 100644 index 000000000000..ac37011924e3 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/custom/Helper/CommonHelper.ps1 @@ -0,0 +1,179 @@ +function CheckResourceGraphModuleDependency { + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.DoNotExportAttribute()] + param() + + process { + $module = Get-Module -ListAvailable | Where-Object { $_.Name -eq "Az.ResourceGraph" } + if ($null -eq $module) { + $message = "Az.ResourceGraph Module must be installed to run this command. Please run 'Install-Module -Name Az.ResourceGraph' to install and continue." + throw $message + } + } +} + +function CheckResourcesModuleDependency { + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.DoNotExportAttribute()] + param() + + process { + $module = Get-Module -ListAvailable | Where-Object { $_.Name -eq "Az.Resources" } + if ($null -eq $module) { + $message = "Az.Resources Module must be installed to run this command. Please run 'Install-Module -Name Az.Resources' to install and continue." + throw $message + } + } +} + +function CheckStorageModuleDependency { + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.DoNotExportAttribute()] + param() + + process { + $module = Get-Module -ListAvailable | Where-Object { $_.Name -eq "Az.Storage" } + if ($null -eq $module) { + $message = "Az.Storage Module must be installed to run this command. Please run 'Install-Module -Name Az.Storage' to install and continue." + throw $message + } + } +} + +function GetHCIClusterARGQuery { + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.DoNotExportAttribute()] + param( + [Parameter(Mandatory)] + [System.String] + # Specifies HCI Cluster Id. + ${HCIClusterID} + ) + + process { + $query = @" +resources | where type == 'microsoft.extendedlocation/customlocations' +| mv-expand ClusterId = properties['clusterExtensionIds'] +| extend ClusterId = toupper(tostring(ClusterId)) +| extend CustomLocation = toupper(tostring(id)) +| extend resourceBridgeID = toupper(tostring(properties['hostResourceId'])) +| extend customLocationRegion = location +| join ( + kubernetesconfigurationresources + | where type == 'microsoft.kubernetesconfiguration/extensions' + | where properties['ConfigurationSettings']['HCIClusterID'] =~ '$HCIClusterID' + | project ClusterId = id + | extend ClusterId = toupper(tostring(ClusterId)) +) on ClusterId +| join ( + resources + | where type == 'microsoft.resourceconnector/appliances' + | where properties['provisioningState'] == 'Succeeded' + | extend statusOfTheBridge = properties['status'] + | extend resourceBridgeID = toupper(tostring(id)) +) on resourceBridgeID +"@ + return $query + } +} + +function IsReservedOrTrademarked { + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.DoNotExportAttribute()] + param( + [Parameter(Mandatory)] + [System.String] + # Specifies VM name. + ${Value} + ) + + $uppercased = $Value.ToUpper(); + + # cannot be exactly one of these, but could be slighlty differnet (e.g. hololens2) + $reservedWords = @( + "ACCESS", + "APP_CODE", + "APP_THEMES", + "APP_DATA", + "APP_GLOBALRESOURCES", + "APP_LOCALRESOURCES", + "APP_WEBREFERENCES", + "APP_BROWSERS", + "AZURE", + "BING", + "BIZSPARK", + "BIZTALK", + "CORTANA", + "DIRECTX", + "DOTNET", + "DYNAMICS", + "EXCEL", + "EXCHANGE", + "FOREFRONT", + "GROOVE", + "HOLOLENS", + "HYPERV", + "KINECT", + "LYNC", + "MSDN", + "O365", + "OFFICE", + "OFFICE365", + "ONEDRIVE", + "ONENOTE", + "OUTLOOK", + "POWERPOINT", + "SHAREPOINT", + "SKYPE", + "VISIO", + "VISUALSTUDIO" + ) + + # The following words can't be used as either a whole word or a substring in the name: + $microsoft = "MICROSOFT"; + $windows = "WINDOWS"; + + # The following words can't be used at the start of a resource name, but can be used later in the name: + $startLogin = "LOGIN"; + $startXbox = "XBOX"; + + if ($uppercased.startsWith($startLogin) -or $uppercased.startsWith($startXbox)) { + return $true; + } + + if ($uppercased.contains($microsoft) -or $uppercased.contains($windows)) { + return $true; + } + + foreach ($reservedName in $reservedWords) { + if ($uppercased -eq $reservedName) { + return $true; + } + } + + return $false; +} + +function GenerateHashForArtifact { + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.DoNotExportAttribute()] + param( + [Parameter(Mandatory)] + [System.String] + # Specifies resource group name. + ${Artifact} + ) + + $hashCode = 0 + $artifactLength = $Artifact.Length + $tempItemLength = 0 + if ($artifactLength -gt 0) { + while ($tempItemLength -lt $artifactLength) { + $hashCode = ((($hashCode -shl 5) - $hashCode) + $Artifact[$tempItemLength++] -bor 0) + + # Treat as Double, then convert to Bytes, then convert back to Int32 to match JavaScript behavior + $hashCode = [System.BitConverter]::ToInt32([System.BitConverter]::GetBytes($hashCode), 0) + } + } + + if ($hashCode -lt 0) { + return -1 * $hashCode + } + else { + return $hashCode + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/custom/Initialize-AzMigrateHCIReplicationInfrastructure.ps1 b/src/Migrate/Migrate.Autorest/custom/Initialize-AzMigrateHCIReplicationInfrastructure.ps1 new file mode 100644 index 000000000000..fb6e1e790348 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/custom/Initialize-AzMigrateHCIReplicationInfrastructure.ps1 @@ -0,0 +1,1108 @@ + +# ---------------------------------------------------------------------------------- +# +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Initializes the infrastructure for the migrate project. +.Description +The Initialize-AzMigrateHCIReplicationInfrastructure cmdlet initializes the infrastructure for the migrate project in AzStackHCI scenario. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/initialize-azmigratehcireplicationinfrastructure +#> + +function Initialize-AzMigrateHCIReplicationInfrastructure { + [OutputType([System.Boolean], ParameterSetName = 'AzStackHCI')] + [CmdletBinding(DefaultParameterSetName = 'AzStackHCI', PositionalBinding = $false, SupportsShouldProcess, ConfirmImpact = 'Medium')] + param( + [Parameter(Mandatory)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the Resource Group of the Azure Migrate Project in the current subscription. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the name of the Azure Migrate project to be used for server migration. + ${ProjectName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the Storage Account ARM Id to be used for private endpoint scenario. + ${CacheStorageAccountId}, + + [Parameter()] + [System.String] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script = '(Get-AzContext).Subscription.Id')] + # Azure Subscription ID. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the source appliance name for the AzStackHCI scenario. + ${SourceApplianceName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the target appliance name for the AzStackHCI scenario. + ${TargetApplianceName}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} + ) + + process { + Import-Module $PSScriptRoot\Helper\AzStackHCICommonSettings.ps1 + Import-Module $PSScriptRoot\Helper\CommonHelper.ps1 + + CheckResourcesModuleDependency + CheckStorageModuleDependency + Import-Module Az.Resources + Import-Module Az.Storage + + $context = Get-AzContext + # Get SubscriptionId + if ([string]::IsNullOrEmpty($SubscriptionId)) { + Write-Host "No -SubscriptionId provided. Using the one from Get-AzContext." + + $SubscriptionId = $context.Subscription.Id + if ([string]::IsNullOrEmpty($SubscriptionId)) { + throw "Please login to Azure to select a subscription." + } + } + Write-Host "*Selected Subscription Id: '$($SubscriptionId)'." + + # Get resource group + $resourceGroup = Get-AzResourceGroup -Name $ResourceGroupName -ErrorVariable notPresent -ErrorAction SilentlyContinue + if ($null -eq $resourceGroup) { + throw "Resource group '$($ResourceGroupName)' does not exist in the subscription. Please create the resource group and try again." + } + Write-Host "*Selected Resource Group: '$($ResourceGroupName)'." + + # Verify user validity + $userObject = Get-AzADUser -UserPrincipalName $context.Subscription.ExtendedProperties.Account + + if (-not $userObject) { + $userObject = Get-AzADUser -Mail $context.Subscription.ExtendedProperties.Account + } + + if (-not $userObject) { + $mailNickname = "{0}#EXT#" -f $($context.Account.Id -replace '@', '_') + + $userObject = Get-AzADUser | + Where-Object { $_.MailNickname -eq $mailNickname } + } + + if (-not $userObject) { + $userObject = Get-AzADServicePrincipal -ApplicationID $context.Account.Id + } + + if (-not $userObject) { + throw 'User Object Id Not Found!' + } + + # Get Migrate Project + $migrateProject = Az.Migrate\Get-AzMigrateProject ` + -Name $ProjectName ` + -ResourceGroupName $ResourceGroupName ` + -ErrorVariable notPresent ` + -ErrorAction SilentlyContinue + if ($null -eq $migrateProject) { + throw "Migrate project '$($ProjectName)' not found." + } + + # Access Discovery Service + $discoverySolutionName = "Servers-Discovery-ServerDiscovery" + $discoverySolution = Az.Migrate\Get-AzMigrateSolution ` + -SubscriptionId $SubscriptionId ` + -ResourceGroupName $ResourceGroupName ` + -MigrateProjectName $ProjectName ` + -Name $discoverySolutionName ` + -ErrorVariable notPresent ` + -ErrorAction SilentlyContinue + if ($discoverySolution.Name -ne $discoverySolutionName) { + throw "Server Discovery Solution not found." + } + + # Get Appliances Mapping + $appMap = @{} + if ($null -ne $discoverySolution.DetailExtendedDetail["applianceNameToSiteIdMapV2"]) { + $appMapV2 = $discoverySolution.DetailExtendedDetail["applianceNameToSiteIdMapV2"] | ConvertFrom-Json + # Fetch all appliance from V2 map first. Then these can be updated if found again in V3 map. + foreach ($item in $appMapV2) { + $appMap[$item.ApplianceName.ToLower()] = $item.SiteId + } + } + + if ($null -ne $discoverySolution.DetailExtendedDetail["applianceNameToSiteIdMapV3"]) { + $appMapV3 = $discoverySolution.DetailExtendedDetail["applianceNameToSiteIdMapV3"] | ConvertFrom-Json + foreach ($item in $appMapV3) { + $t = $item.psobject.properties + $appMap[$t.Name.ToLower()] = $t.Value.SiteId + } + } + + if ($null -eq $discoverySolution.DetailExtendedDetail["applianceNameToSiteIdMapV2"] -And + $null -eq $discoverySolution.DetailExtendedDetail["applianceNameToSiteIdMapV3"] ) { + throw "Server Discovery Solution missing Appliance Details. Invalid Solution." + } + + $hyperVSiteTypeRegex = "(?<=/Microsoft.OffAzure/HyperVSites/).*$" + $vmwareSiteTypeRegex = "(?<=/Microsoft.OffAzure/VMwareSites/).*$" + + # Validate SourceApplianceName & TargetApplianceName + $sourceSiteId = $appMap[$SourceApplianceName.ToLower()] + $targetSiteId = $appMap[$TargetApplianceName.ToLower()] + if ($sourceSiteId -match $hyperVSiteTypeRegex -and $targetSiteId -match $hyperVSiteTypeRegex) { + $instanceType = $AzStackHCIInstanceTypes.HyperVToAzStackHCI + } + elseif ($sourceSiteId -match $vmwareSiteTypeRegex -and $targetSiteId -match $hyperVSiteTypeRegex) { + $instanceType = $AzStackHCIInstanceTypes.VMwareToAzStackHCI + } + else { + throw "Error encountered in matching the given source appliance name '$SourceApplianceName' and target appliance name '$TargetApplianceName'. Please verify the VM site type to be either for HyperV or VMware for both source and target appliances, and the appliance names are correct." + } + + # Get Data Replication Service, or the AMH solution + $amhSolution = Az.Migrate\Get-AzMigrateSolution ` + -ResourceGroupName $ResourceGroupName ` + -MigrateProjectName $ProjectName ` + -Name "Servers-Migration-ServerMigration_DataReplication" ` + -SubscriptionId $SubscriptionId ` + -ErrorVariable notPresent ` + -ErrorAction SilentlyContinue + if ($null -eq $amhSolution) { + throw "No Data Replication Service Solution found. Please verify your appliance setup." + } + + # Get Source and Target Fabrics + $allFabrics = Az.Migrate\Get-AzMigrateHCIReplicationFabric -ResourceGroupName $ResourceGroupName + foreach ($fabric in $allFabrics) { + if ($fabric.Property.CustomProperty.MigrationSolutionId -ne $amhSolution.Id) { + continue + } + + if (($instanceType -eq $AzStackHCIInstanceTypes.HyperVToAzStackHCI) -and + ($fabric.Property.CustomProperty.InstanceType -ceq $FabricInstanceTypes.HyperVInstance)) { + $sourceFabric = $fabric + } + elseif (($instanceType -eq $AzStackHCIInstanceTypes.VMwareToAzStackHCI) -and + ($fabric.Property.CustomProperty.InstanceType -ceq $FabricInstanceTypes.VMwareInstance)) { + $sourceFabric = $fabric + } + elseif ($fabric.Property.CustomProperty.InstanceType -ceq $FabricInstanceTypes.AzStackHCIInstance) { + $targetFabric = $fabric + } + + if (($null -ne $sourceFabric) -and ($null -ne $targetFabric)) { + break + } + } + + if ($null -eq $sourceFabric) { + throw "Source Fabric not found. Please verify your appliance setup." + } + Write-Host "*Selected Source Fabric: '$($sourceFabric.Name)'." + + if ($null -eq $targetFabric) { + throw "Target Fabric not found. Please verify your appliance setup." + } + Write-Host "*Selected Target Fabric: '$($targetFabric.Name)'." + + # Get Source and Target Dras from Fabrics + $sourceDras = Az.Migrate.Internal\Get-AzMigrateDra ` + -FabricName $sourceFabric.Name ` + -ResourceGroupName $ResourceGroupName ` + -ErrorVariable notPresent ` + -ErrorAction SilentlyContinue + if ($null -eq $sourceDras) { + throw "Source Dra found. Please verify your appliance setup." + } + $sourceDra = $sourceDras[0] + Write-Host "*Selected Source Dra: '$($sourceDra.Name)'." + + $targetDras = Az.Migrate.Internal\Get-AzMigrateDra ` + -FabricName $targetFabric.Name ` + -ResourceGroupName $ResourceGroupName ` + -ErrorVariable notPresent ` + -ErrorAction SilentlyContinue + if ($null -eq $targetDras) { + throw "Source Dra found. Please verify your appliance setup." + } + $targetDra = $targetDras[0] + Write-Host "*Selected Target Dra: '$($targetDra.Name)'." + + # Get Replication Vault + $replicationVaultName = $amhSolution.DetailExtendedDetail["vaultId"].Split("/")[8] + $replicationVault = Az.Migrate.Internal\Get-AzMigrateVault ` + -ResourceGroupName $ResourceGroupName ` + -Name $replicationVaultName + if ($null -eq $replicationVault) { + throw "No Replication Vault found in Resource Group '$($ResourceGroupName)'." + } + + # Put Policy + $policyName = $replicationVault.Name + $instanceType + "policy" + $policy = Az.Migrate.Internal\Get-AzMigratePolicy ` + -ResourceGroupName $ResourceGroupName ` + -Name $policyName ` + -VaultName $replicationVault.Name ` + -SubscriptionId $SubscriptionId ` + -ErrorVariable notPresent ` + -ErrorAction SilentlyContinue + + # Default policy is found + if ($null -ne $policy) { + # Give time for create/update to reach a terminal state. Timeout after 10min + if ($policy.Property.ProvisioningState -eq [ProvisioningState]::Creating -or + $policy.Property.ProvisioningState -eq [ProvisioningState]::Updating) { + Write-Host "Policy '$($policyName)' found in Provisioning State '$($policy.Property.ProvisioningState)'." + + for ($i = 0; $i -lt 20; $i++) { + Start-Sleep -Seconds 30 + $policy = Az.Migrate.Internal\Get-AzMigratePolicy -InputObject $policy + + if (-not ( + $policy.Property.ProvisioningState -eq [ProvisioningState]::Creating -or + $policy.Property.ProvisioningState -eq [ProvisioningState]::Updating)) { + break + } + } + + # Make sure Policy is no longer in Creating or Updating state + if ($policy.Property.ProvisioningState -eq [ProvisioningState]::Creating -or + $policy.Property.ProvisioningState -eq [ProvisioningState]::Updating) { + throw "Policy '$($policyName)' times out with Provisioning State: '$($policy.Property.ProvisioningState)'. Please re-run this command or contact support if help needed." + } + } + + # Check and remove if policy is in a bad terminal state + if ($policy.Property.ProvisioningState -eq [ProvisioningState]::Canceled -or + $policy.Property.ProvisioningState -eq [ProvisioningState]::Failed) { + Write-Host "Policy '$($policyName)' found but in an unusable terminal Provisioning State '$($policy.Property.ProvisioningState)'.`nRemoving policy..." + + # Remove policy + try { + Az.Migrate.Internal\Remove-AzMigratePolicy -InputObject $policy | Out-Null + } + catch { + if ($_.Exception.Message -notmatch "Status: OK") { + throw $_.Exception.Message + } + } + + Start-Sleep -Seconds 30 + $policy = Az.Migrate.Internal\Get-AzMigratePolicy ` + -InputObject $policy ` + -ErrorVariable notPresent ` + -ErrorAction SilentlyContinue + + # Make sure Policy is no longer in Canceled or Failed state + if ($null -ne $policy -and + ($policy.Property.ProvisioningState -eq [ProvisioningState]::Canceled -or + $policy.Property.ProvisioningState -eq [ProvisioningState]::Failed)) { + throw "Failed to change the Provisioning State of policy '$($policyName)'by removing. Please re-run this command or contact support if help needed." + } + } + + # Give time to remove policy. Timeout after 10min + if ($null -eq $policy -and $policy.Property.ProvisioningState -eq [ProvisioningState]::Deleting) { + Write-Host "Policy '$($policyName)' found in Provisioning State '$($policy.Property.ProvisioningState)'." + + for ($i = 0; $i -lt 20; $i++) { + Start-Sleep -Seconds 30 + $policy = Az.Migrate.Internal\Get-AzMigratePolicy ` + -InputObject $policy ` + -ErrorVariable notPresent ` + -ErrorAction SilentlyContinue + + if ($null -eq $policy -or $policy.Property.ProvisioningState -eq [ProvisioningState]::Deleted) { + break + } + elseif ($policy.Property.ProvisioningState -eq [ProvisioningState]::Deleting) { + continue + } + + throw "Policy '$($policyName)' has an unexpected Provisioning State of '$($policy.Property.ProvisioningState)' during removal process. Please re-run this command or contact support if help needed." + } + + # Make sure Policy is no longer in Deleting state + if ($null -ne $policy -and $policy.Property.ProvisioningState -eq [ProvisioningState]::Deleting) { + throw "Policy '$($policyName)' times out with Provisioning State: '$($policy.Property.ProvisioningState)'. Please re-run this command or contact support if help needed." + } + } + + # Indicate policy was removed + if ($null -eq $policy -or $policy.Property.ProvisioningState -eq [ProvisioningState]::Deleted) { + Write-Host "Policy '$($policyName)' was removed." + } + } + + # Refresh local policy object if exists + if ($null -ne $policy) { + $policy = Az.Migrate.Internal\Get-AzMigratePolicy -InputObject $policy + } + + # Create policy if not found or previously deleted + if ($null -eq $policy -or $policy.Property.ProvisioningState -eq [ProvisioningState]::Deleted) { + Write-Host "Creating Policy..." + + $params = @{ + InstanceType = $instanceType; + RecoveryPointHistoryInMinute = $ReplicationDetails.PolicyDetails.DefaultRecoveryPointHistoryInMinutes; + CrashConsistentFrequencyInMinute = $ReplicationDetails.PolicyDetails.DefaultCrashConsistentFrequencyInMinutes; + AppConsistentFrequencyInMinute = $ReplicationDetails.PolicyDetails.DefaultAppConsistentFrequencyInMinutes; + } + + # Setup Policy deployment parameters + $policyProperties = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PolicyModelProperties]::new() + if ($instanceType -eq $AzStackHCIInstanceTypes.HyperVToAzStackHCI) { + $policyCustomProperties = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHcipolicyModelCustomProperties]::new() + } + elseif ($instanceType -eq $AzStackHCIInstanceTypes.VMwareToAzStackHCI) { + $policyCustomProperties = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareToAzStackHcipolicyModelCustomProperties]::new() + } + else { + throw "Instance type '$($instanceType)' is not supported. Currently, for AzStackHCI scenario, only HyperV and VMware as the source is supported." + } + $policyCustomProperties.InstanceType = $params.InstanceType + $policyCustomProperties.RecoveryPointHistoryInMinute = $params.RecoveryPointHistoryInMinute + $policyCustomProperties.CrashConsistentFrequencyInMinute = $params.CrashConsistentFrequencyInMinute + $policyCustomProperties.AppConsistentFrequencyInMinute = $params.AppConsistentFrequencyInMinute + $policyProperties.CustomProperty = $policyCustomProperties + + try { + Az.Migrate.Internal\New-AzMigratePolicy ` + -Name $policyName ` + -ResourceGroupName $ResourceGroupName ` + -VaultName $replicationVaultName ` + -Property $policyProperties ` + -SubscriptionId $SubscriptionId ` + -NoWait | Out-Null + } + catch { + if ($_.Exception.Message -notmatch "Status: OK") { + throw $_.Exception.Message + } + } + + # Check Policy creation status every 30s. Timeout after 10min + for ($i = 0; $i -lt 20; $i++) { + Start-Sleep -Seconds 30 + $policy = Az.Migrate.Internal\Get-AzMigratePolicy ` + -ResourceGroupName $ResourceGroupName ` + -Name $policyName ` + -VaultName $replicationVault.Name ` + -SubscriptionId $SubscriptionId ` + -ErrorVariable notPresent ` + -ErrorAction SilentlyContinue + if ($null -eq $policy) { + throw "Unexpected error occurred during policy creation. Please re-run this command or contact support if help needed." + } + + # Stop if policy reaches a terminal state + if ($policy.Property.ProvisioningState -eq [ProvisioningState]::Succeeded -or + $policy.Property.ProvisioningState -eq [ProvisioningState]::Deleted -or + $policy.Property.ProvisioningState -eq [ProvisioningState]::Canceled -or + $policy.Property.ProvisioningState -eq [ProvisioningState]::Failed) { + break + } + } + + # Make sure Policy is in a terminal state + if (-not ( + $policy.Property.ProvisioningState -eq [ProvisioningState]::Succeeded -or + $policy.Property.ProvisioningState -eq [ProvisioningState]::Deleted -or + $policy.Property.ProvisioningState -eq [ProvisioningState]::Canceled -or + $policy.Property.ProvisioningState -eq [ProvisioningState]::Failed)) { + throw "Policy '$($policyName)' times out with Provisioning State: '$($policy.Property.ProvisioningState)' during creation process. Please re-run this command or contact support if help needed." + } + } + + if ($policy.Property.ProvisioningState -ne [ProvisioningState]::Succeeded) { + throw "Policy '$($policyName)' has an unexpected Provisioning State of '$($policy.Property.ProvisioningState)'. Please re-run this command or contact support if help needed." + } + + $policy = Az.Migrate.Internal\Get-AzMigratePolicy ` + -ResourceGroupName $ResourceGroupName ` + -Name $policyName ` + -VaultName $replicationVault.Name ` + -SubscriptionId $SubscriptionId ` + -ErrorVariable notPresent ` + -ErrorAction SilentlyContinue + if ($null -eq $policy) { + throw "Unexpected error occurred during policy creation. Please re-run this command or contact support if help needed." + } + elseif ($policy.Property.ProvisioningState -ne [ProvisioningState]::Succeeded) { + throw "Policy '$($policyName)' has an unexpected Provisioning State of '$($policy.Property.ProvisioningState)'. Please re-run this command or contact support if help needed." + } + else { + Write-Host "*Selected Policy: '$($policyName)'." + } + + # Put Cache Storage Account + $amhSolution = Az.Migrate\Get-AzMigrateSolution ` + -ResourceGroupName $ResourceGroupName ` + -MigrateProjectName $ProjectName ` + -Name "Servers-Migration-ServerMigration_DataReplication" ` + -SubscriptionId $SubscriptionId ` + -ErrorVariable notPresent ` + -ErrorAction SilentlyContinue + if ($null -eq $amhSolution) { + throw "No Data Replication Service Solution found. Please verify your appliance setup." + } + + $amhStoredStorageAccountId = $amhSolution.DetailExtendedDetail["replicationStorageAccountId"] + + # Record of rsa found in AMH solution + if (![string]::IsNullOrEmpty($amhStoredStorageAccountId)) { + $amhStoredStorageAccountName = $amhStoredStorageAccountId.Split("/")[8] + $amhStoredStorageAccount = Get-AzStorageAccount ` + -ResourceGroupName $ResourceGroupName ` + -Name $amhStoredStorageAccountName ` + -ErrorVariable notPresent ` + -ErrorAction SilentlyContinue + + # Wait for amhStoredStorageAccount to reach a terminal state + if ($null -ne $amhStoredStorageAccount -and + $null -ne $amhStoredStorageAccount.ProvisioningState -and + $amhStoredStorageAccount.ProvisioningState -ne [StorageAccountProvisioningState]::Succeeded) { + # Check rsa state every 30s if not Succeeded already. Timeout after 10min + for ($i = 0; $i -lt 20; $i++) { + Start-Sleep -Seconds 30 + $amhStoredStorageAccount = Get-AzStorageAccount ` + -ResourceGroupName $ResourceGroupName ` + -Name $amhStoredStorageAccountName ` + -ErrorVariable notPresent ` + -ErrorAction SilentlyContinue + # Stop if amhStoredStorageAccount is not found or in a terminal state + if ($null -eq $amhStoredStorageAccount -or + $null -eq $amhStoredStorageAccount.ProvisioningState -or + $amhStoredStorageAccount.ProvisioningState -eq [StorageAccountProvisioningState]::Succeeded) { + break + } + } + } + + # amhStoredStorageAccount exists and in Succeeded state + if ($null -ne $amhStoredStorageAccount -and + $amhStoredStorageAccount.ProvisioningState -eq [StorageAccountProvisioningState]::Succeeded) { + # Use amhStoredStorageAccount and ignore user provided Cache Storage Account Id + if (![string]::IsNullOrEmpty($CacheStorageAccountId) -and $amhStoredStorageAccount.Id -ne $CacheStorageAccountId) { + Write-Host "A Cache Storage Account '$($amhStoredStorageAccountName)' has been linked already. The given -CacheStorageAccountId '$($CacheStorageAccountId)' will be ignored." + } + + $cacheStorageAccount = $amhStoredStorageAccount + } + elseif ($null -eq $amhStoredStorageAccount -or $null -eq $amhStoredStorageAccount.ProvisioningState) { + # amhStoredStorageAccount is found but in a bad state, so log to ask user to remove + if ($null -ne $amhStoredStorageAccount -and $null -eq $amhStoredStorageAccount.ProvisioningState) { + Write-Host "A previously linked Cache Storage Account with Id '$($amhStoredStorageAccountId)' is found but in a unusable state. Please remove it manually and re-run this command." + } + + # amhStoredStorageAccount is not found or in a bad state but AMH has a record of it, so remove the record + if ($amhSolution.DetailExtendedDetail.ContainsKey("replicationStorageAccountId")) { + $amhSolution.DetailExtendedDetail.Remove("replicationStorageAccountId") | Out-Null + $amhSolution.DetailExtendedDetail.Add("replicationStorageAccountId", $null) | Out-Null + Az.Migrate.Internal\Set-AzMigrateSolution ` + -MigrateProjectName $ProjectName ` + -Name $amhSolution.Name ` + -ResourceGroupName $ResourceGroupName ` + -DetailExtendedDetail $amhSolution.DetailExtendedDetail.AdditionalProperties | Out-Null + } + } + else { + throw "A linked Cache Storage Account with Id '$($amhStoredStorageAccountId)' times out with Provisioning State: '$($amhStoredStorageAccount.ProvisioningState)'. Please re-run this command or contact support if help needed." + } + + $amhSolution = Az.Migrate\Get-AzMigrateSolution ` + -ResourceGroupName $ResourceGroupName ` + -MigrateProjectName $ProjectName ` + -Name "Servers-Migration-ServerMigration_DataReplication" ` + -SubscriptionId $SubscriptionId ` + -ErrorVariable notPresent ` + -ErrorAction SilentlyContinue + # Check if AMH record is removed + if (($null -eq $amhStoredStorageAccount -or $null -eq $amhStoredStorageAccount.ProvisioningState) -and + ![string]::IsNullOrEmpty($amhSolution.DetailExtendedDetail["replicationStorageAccountId"])) { + throw "Unexpected error occurred in unlinking Cache Storage Account with Id '$($amhSolution.DetailExtendedDetail["replicationStorageAccountId"])'. Please re-run this command or contact support if help needed." + } + } + + # No linked Cache Storage Account found in AMH solution but user provides a Cache Storage Account Id + if ($null -eq $cacheStorageAccount -and ![string]::IsNullOrEmpty($CacheStorageAccountId)) { + $userProvidedStorageAccountIdSegs = $CacheStorageAccountId.Split("/") + if ($userProvidedStorageAccountIdSegs.Count -ne 9) { + throw "Invalid Cache Storage Account Id '$($CacheStorageAccountId)' provided. Please provide a valid one." + } + + $userProvidedStorageAccountName = ($userProvidedStorageAccountIdSegs[8]).ToLower() + + # Check if user provided Cache Storage Account exists + $userProvidedStorageAccount = Get-AzStorageAccount ` + -ResourceGroupName $ResourceGroupName ` + -Name $userProvidedStorageAccountName ` + -ErrorVariable notPresent ` + -ErrorAction SilentlyContinue + + # Wait for userProvidedStorageAccount to reach a terminal state + if ($null -ne $userProvidedStorageAccount -and + $null -ne $userProvidedStorageAccount.ProvisioningState -and + $userProvidedStorageAccount.ProvisioningState -ne [StorageAccountProvisioningState]::Succeeded) { + # Check rsa state every 30s if not Succeeded already. Timeout after 10min + for ($i = 0; $i -lt 20; $i++) { + Start-Sleep -Seconds 30 + $userProvidedStorageAccount = Get-AzStorageAccount ` + -ResourceGroupName $ResourceGroupName ` + -Name $userProvidedStorageAccountName ` + -ErrorVariable notPresent ` + -ErrorAction SilentlyContinue + # Stop if userProvidedStorageAccount is not found or in a terminal state + if ($null -eq $userProvidedStorageAccount -or + $null -eq $userProvidedStorageAccount.ProvisioningState -or + $userProvidedStorageAccount.ProvisioningState -eq [StorageAccountProvisioningState]::Succeeded) { + break + } + } + } + + if ($null -ne $userProvidedStorageAccount -and + $userProvidedStorageAccount.ProvisioningState -eq [StorageAccountProvisioningState]::Succeeded) { + $cacheStorageAccount = $userProvidedStorageAccount + } + elseif ($null -eq $userProvidedStorageAccount) { + throw "Cache Storage Account with Id '$($CacheStorageAccountId)' is not found. Please re-run this command without -CacheStorageAccountId to create one automatically or re-create the Cache Storage Account yourself and try again." + } + elseif ($null -eq $userProvidedStorageAccount.ProvisioningState) { + throw "Cache Storage Account with Id '$($CacheStorageAccountId)' is found but in an unusable state. Please re-run this command without -CacheStorageAccountId to create one automatically or re-create the Cache Storage Account yourself and try again." + } + else { + throw "Cache Storage Account with Id '$($CacheStorageAccountId)' is found but times out with Provisioning State: '$($userProvidedStorageAccount.ProvisioningState)'. Please re-run this command or contact support if help needed." + } + } + + # No Cache Storage Account found or provided, so create one + if ($null -eq $cacheStorageAccount) { + $suffix = (GenerateHashForArtifact -Artifact "$($sourceSiteId)/$($SourceApplianceName)").ToString() + if ($suffixHash.Length -gt 14) { + $suffix = $suffixHash.Substring(0, 14) + } + $cacheStorageAccountName = "migratersa" + $suffix + $cacheStorageAccountId = "/subscriptions/$($SubscriptionId)/resourceGroups/$($ResourceGroupName)/providers/Microsoft.Storage/storageAccounts/$($cacheStorageAccountName)" + + # Check if default Cache Storage Account already exists, which it shoudln't + $cacheStorageAccount = Get-AzStorageAccount ` + -ResourceGroupName $ResourceGroupName ` + -Name $cacheStorageAccountName ` + -ErrorVariable notPresent ` + -ErrorAction SilentlyContinue + if ($null -ne $cacheStorageAccount) { + throw "Unexpected error encountered: Cache Storage Account '$($cacheStorageAccountName)' already exists. Please re-run this command to create a different one or contact support if help needed." + } + + Write-Host "Creating Cache Storage Account with default name '$($cacheStorageAccountName)'..." + + $params = @{ + name = $cacheStorageAccountName; + location = $migrateProject.Location; + migrateProjectName = $migrateProject.Name; + skuName = "Standard_LRS"; + tags = @{ "Migrate Project" = $migrateProject.Name }; + kind = "StorageV2"; + encryption = @{ services = @{blob = @{ enabled = $true }; file = @{ enabled = $true } } }; + } + + # Create Cache Storage Account + $cacheStorageAccount = New-AzStorageAccount ` + -ResourceGroupName $ResourceGroupName ` + -Name $params.name ` + -SkuName $params.skuName ` + -Location $params.location ` + -Kind $params.kind ` + -Tags $params.tags ` + -AllowBlobPublicAccess $true + + if ($null -ne $cacheStorageAccount -and + $null -ne $cacheStorageAccount.ProvisioningState -and + $cacheStorageAccount.ProvisioningState -ne [StorageAccountProvisioningState]::Succeeded) { + # Check rsa state every 30s if not Succeeded already. Timeout after 10min + for ($i = 0; $i -lt 20; $i++) { + Start-Sleep -Seconds 30 + $cacheStorageAccount = Get-AzStorageAccount ` + -ResourceGroupName $ResourceGroupName ` + -Name $params.name ` + -ErrorVariable notPresent ` + -ErrorAction SilentlyContinue + # Stop if cacheStorageAccount is not found or in a terminal state + if ($null -eq $cacheStorageAccount -or + $null -eq $cacheStorageAccount.ProvisioningState -or + $cacheStorageAccount.ProvisioningState -eq [StorageAccountProvisioningState]::Succeeded) { + break + } + } + } + + if ($null -eq $cacheStorageAccount -or $null -eq $cacheStorageAccount.ProvisioningState) { + throw "Unexpected error occurs during Cache Storgae Account creation process. Please re-run this command or provide -CacheStorageAccountId of the one created own your own." + } + elseif ($cacheStorageAccount.ProvisioningState -ne [StorageAccountProvisioningState]::Succeeded) { + throw "Cache Storage Account with Id '$($cacheStorageAccount.Id)' times out with Provisioning State: '$($cacheStorageAccount.ProvisioningState)' during creation process. Please remove it manually and re-run this command or contact support if help needed." + } + } + + # Sanity check + if ($null -eq $cacheStorageAccount -or + $null -eq $cacheStorageAccount.ProvisioningState -or + $cacheStorageAccount.ProvisioningState -ne [StorageAccountProvisioningState]::Succeeded) { + throw "Unexpected error occurs during Cache Storgae Account selection process. Please re-run this command or contact support if help needed." + } + + $params = @{ + contributorRoleDefId = [System.Guid]::parse($RoleDefinitionIds.ContributorId); + storageBlobDataContributorRoleDefId = [System.Guid]::parse($RoleDefinitionIds.StorageBlobDataContributorId); + sourceAppAadId = $sourceDra.ResourceAccessIdentityObjectId; + targetAppAadId = $targetDra.ResourceAccessIdentityObjectId; + } + + # Grant Source Dra AAD App access to Cache Storage Account as "Contributor" + $hasAadAppAccess = Get-AzRoleAssignment ` + -ObjectId $params.sourceAppAadId ` + -RoleDefinitionId $params.contributorRoleDefId ` + -Scope $cacheStorageAccount.Id ` + -ErrorVariable notPresent ` + -ErrorAction SilentlyContinue + if ($null -eq $hasAadAppAccess) { + New-AzRoleAssignment ` + -ObjectId $params.sourceAppAadId ` + -RoleDefinitionId $params.contributorRoleDefId ` + -Scope $cacheStorageAccount.Id | Out-Null + } + + # Grant Source Dra AAD App access to Cache Storage Account as "StorageBlobDataContributor" + $hasAadAppAccess = Get-AzRoleAssignment ` + -ObjectId $params.sourceAppAadId ` + -RoleDefinitionId $params.storageBlobDataContributorRoleDefId ` + -Scope $cacheStorageAccount.Id ` + -ErrorVariable notPresent ` + -ErrorAction SilentlyContinue + if ($null -eq $hasAadAppAccess) { + New-AzRoleAssignment ` + -ObjectId $params.sourceAppAadId ` + -RoleDefinitionId $params.storageBlobDataContributorRoleDefId ` + -Scope $cacheStorageAccount.Id | Out-Null + } + + # Grant Target Dra AAD App access to Cache Storage Account as "Contributor" + $hasAadAppAccess = Get-AzRoleAssignment ` + -ObjectId $params.targetAppAadId ` + -RoleDefinitionId $params.contributorRoleDefId ` + -Scope $cacheStorageAccount.Id ` + -ErrorVariable notPresent ` + -ErrorAction SilentlyContinue + if ($null -eq $hasAadAppAccess) { + New-AzRoleAssignment ` + -ObjectId $params.targetAppAadId ` + -RoleDefinitionId $params.contributorRoleDefId ` + -Scope $cacheStorageAccount.Id | Out-Null + } + + # Grant Target Dra AAD App access to Cache Storage Account as "StorageBlobDataContributor" + $hasAadAppAccess = Get-AzRoleAssignment ` + -ObjectId $params.targetAppAadId ` + -RoleDefinitionId $params.storageBlobDataContributorRoleDefId ` + -Scope $cacheStorageAccount.Id ` + -ErrorVariable notPresent ` + -ErrorAction SilentlyContinue + if ($null -eq $hasAadAppAccess) { + New-AzRoleAssignment ` + -ObjectId $params.targetAppAadId ` + -RoleDefinitionId $params.storageBlobDataContributorRoleDefId ` + -Scope $cacheStorageAccount.Id | Out-Null + } + + # Give time for role assignments to be created. Times out after 2min + $rsaPermissionGranted = $false + for ($i = 0; $i -lt 4; $i++) { + # Check Source Dra AAD App access to Cache Storage Account as "Contributor" + $hasAadAppAccess = Get-AzRoleAssignment ` + -ObjectId $params.sourceAppAadId ` + -RoleDefinitionId $params.contributorRoleDefId ` + -Scope $cacheStorageAccount.Id ` + -ErrorVariable notPresent ` + -ErrorAction SilentlyContinue + $rsaPermissionGranted = $null -ne $hasAadAppAccess + + # Check Source Dra AAD App access to Cache Storage Account as "StorageBlobDataContributor" + $hasAadAppAccess = Get-AzRoleAssignment ` + -ObjectId $params.sourceAppAadId ` + -RoleDefinitionId $params.storageBlobDataContributorRoleDefId ` + -Scope $cacheStorageAccount.Id ` + -ErrorVariable notPresent ` + -ErrorAction SilentlyContinue + $rsaPermissionGranted = $rsaPermissionGranted -and ($null -ne $hasAadAppAccess) + + # Check Target Dra AAD App access to Cache Storage Account as "Contributor" + $hasAadAppAccess = Get-AzRoleAssignment ` + -ObjectId $params.targetAppAadId ` + -RoleDefinitionId $params.contributorRoleDefId ` + -Scope $cacheStorageAccount.Id ` + -ErrorVariable notPresent ` + -ErrorAction SilentlyContinue + $rsaPermissionGranted = $rsaPermissionGranted -and ($null -ne $hasAadAppAccess) + + # Check Target Dra AAD App access to Cache Storage Account as "StorageBlobDataContributor" + $hasAadAppAccess = Get-AzRoleAssignment ` + -ObjectId $params.targetAppAadId ` + -RoleDefinitionId $params.storageBlobDataContributorRoleDefId ` + -Scope $cacheStorageAccount.Id ` + -ErrorVariable notPresent ` + -ErrorAction SilentlyContinue + $rsaPermissionGranted = $rsaPermissionGranted -and ($null -ne $hasAadAppAccess) + + if ($rsaPermissionGranted) { + break + } + + Start-Sleep -Seconds 30 + } + + if (!$rsaPermissionGranted) { + throw "Failed to grant Cache Storage Account permissions. Please re-run this command or contact support if help needed." + } + + $amhSolution = Az.Migrate\Get-AzMigrateSolution ` + -ResourceGroupName $ResourceGroupName ` + -MigrateProjectName $ProjectName ` + -Name "Servers-Migration-ServerMigration_DataReplication" ` + -SubscriptionId $SubscriptionId + if ($amhSolution.DetailExtendedDetail.ContainsKey("replicationStorageAccountId")) { + $amhStoredStorageAccountId = $amhSolution.DetailExtendedDetail["replicationStorageAccountId"] + if ([string]::IsNullOrEmpty($amhStoredStorageAccountId)) { + # Remove "replicationStorageAccountId" key + $amhSolution.DetailExtendedDetail.Remove("replicationStorageAccountId") | Out-Null + } + elseif ($amhStoredStorageAccountId -ne $cacheStorageAccount.Id) { + # Record of rsa mismatch + throw "Unexpected error occurred in linking Cache Storage Account with Id '$($cacheStorageAccount.Id)'. Please re-run this command or contact support if help needed." + } + } + + # Update AMH record with chosen Cache Storage Account + if (!$amhSolution.DetailExtendedDetail.ContainsKey("replicationStorageAccountId")) { + $amhSolution.DetailExtendedDetail.Add("replicationStorageAccountId", $cacheStorageAccount.Id) + Az.Migrate.Internal\Set-AzMigrateSolution ` + -MigrateProjectName $ProjectName ` + -Name $amhSolution.Name ` + -ResourceGroupName $ResourceGroupName ` + -DetailExtendedDetail $amhSolution.DetailExtendedDetail.AdditionalProperties | Out-Null + } + + Write-Host "*Selected Cache Storage Account: '$($cacheStorageAccount.StorageAccountName)' in Resource Group '$($ResourceGroupName)' at Location '$($cacheStorageAccount.Location)' for Migrate Project '$($migrateProject.Name)'." + + # Put replication extension + $replicationExtensionName = ($sourceFabric.Id -split '/')[-1] + "-" + ($targetFabric.Id -split '/')[-1] + "-MigReplicationExtn" + $replicationExtension = Az.Migrate.Internal\Get-AzMigrateReplicationExtension ` + -ResourceGroupName $ResourceGroupName ` + -Name $replicationExtensionName ` + -VaultName $replicationVaultName ` + -SubscriptionId $SubscriptionId ` + -ErrorVariable notPresent ` + -ErrorAction SilentlyContinue + + # Remove replication extension if does not match the selected Cache Storage Account + if ($null -ne $replicationExtension -and $replicationExtension.Property.CustomProperty.StorageAccountId -ne $cacheStorageAccount.Id) { + Write-Host "Replication Extension '$($replicationExtensionName)' found but linked to a different Cache Storage Account '$($replicationExtension.Property.CustomProperty.StorageAccountId)'." + + try { + Az.Migrate.Internal\Remove-AzMigrateReplicationExtension -InputObject $replicationExtension | Out-Null + } + catch { + if ($_.Exception.Message -notmatch "Status: OK") { + throw $_.Exception.Message + } + } + + Write-Host "Removing Replication Extension and waiting for 2 minutes..." + Start-Sleep -Seconds 120 + $replicationExtension = Az.Migrate.Internal\Get-AzMigrateReplicationExtension ` + -InputObject $replicationExtension ` + -ErrorVariable notPresent ` + -ErrorAction SilentlyContinue + + if ($null -eq $replicationExtension) { + Write-Host "Replication Extension '$($replicationExtensionName)' was removed." + } + } + + # Replication extension exists + if ($null -ne $replicationExtension) { + # Give time for create/update to reach a terminal state. Timeout after 10min + if ($replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Creating -or + $replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Updating) { + Write-Host "Replication Extension '$($replicationExtensionName)' found in Provisioning State '$($replicationExtension.Property.ProvisioningState)'." + + for ($i = 0; $i -lt 20; $i++) { + Start-Sleep -Seconds 30 + $replicationExtension = Az.Migrate.Internal\Get-AzMigrateReplicationExtension ` + -InputObject $replicationExtension ` + -ErrorVariable notPresent ` + -ErrorAction SilentlyContinue + + if (-not ( + $replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Creating -or + $replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Updating)) { + break + } + } + + # Make sure replication extension is no longer in Creating or Updating state + if ($replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Creating -or + $replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Updating) { + throw "Replication Extension '$($replicationExtensionName)' times out with Provisioning State: '$($replicationExtension.Property.ProvisioningState)'. Please re-run this command or contact support if help needed." + } + } + + # Check and remove if replication extension is in a bad terminal state + if ($replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Canceled -or + $replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Failed) { + Write-Host "Replication Extension '$($replicationExtensionName)' found but in an unusable terminal Provisioning State '$($replicationExtension.Property.ProvisioningState)'.`nRemoving Replication Extension..." + + # Remove replication extension + try { + Az.Migrate.Internal\Remove-AzMigrateReplicationExtension -InputObject $replicationExtension | Out-Null + } + catch { + if ($_.Exception.Message -notmatch "Status: OK") { + throw $_.Exception.Message + } + } + + Start-Sleep -Seconds 30 + $replicationExtension = Az.Migrate.Internal\Get-AzMigrateReplicationExtension ` + -InputObject $replicationExtension ` + -ErrorVariable notPresent ` + -ErrorAction SilentlyContinue + + # Make sure replication extension is no longer in Canceled or Failed state + if ($null -ne $replicationExtension -and + ($replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Canceled -or + $replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Failed)) { + throw "Failed to change the Provisioning State of Replication Extension '$($replicationExtensionName)'by removing. Please re-run this command or contact support if help needed." + } + } + + # Give time to remove replication extension. Timeout after 10min + if ($null -ne $replicationExtension -and + $replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Deleting) { + Write-Host "Replication Extension '$($replicationExtensionName)' found in Provisioning State '$($replicationExtension.Property.ProvisioningState)'." + + for ($i = 0; $i -lt 20; $i++) { + Start-Sleep -Seconds 30 + $replicationExtension = Az.Migrate.Internal\Get-AzMigrateReplicationExtension ` + -InputObject $replicationExtension ` + -ErrorVariable notPresent ` + -ErrorAction SilentlyContinue + + if ($null -eq $replicationExtension -or $replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Deleted) { + break + } + elseif ($replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Deleting) { + continue + } + + throw "Replication Extension '$($replicationExtensionName)' has an unexpected Provisioning State of '$($replicationExtension.Property.ProvisioningState)' during removal process. Please re-run this command or contact support if help needed." + } + + # Make sure replication extension is no longer in Deleting state + if ($null -ne $replicationExtension -and $replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Deleting) { + throw "Replication Extension '$($replicationExtensionName)' times out with Provisioning State: '$($replicationExtension.Property.ProvisioningState)'. Please re-run this command or contact support if help needed." + } + } + + # Indicate replication extension was removed + if ($null -eq $replicationExtension -or $replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Deleted) { + Write-Host "Replication Extension '$($replicationExtensionName)' was removed." + } + } + + # Refresh local replication extension object if exists + if ($null -ne $replicationExtension) { + $replicationExtension = Az.Migrate.Internal\Get-AzMigrateReplicationExtension -InputObject $replicationExtension + } + + # Create replication extension if not found or previously deleted + if ($null -eq $replicationExtension -or $replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Deleted) { + Write-Host "Waiting 2 minutes for permissions to sync before creating Replication Extension..." + Start-Sleep -Seconds 120 + + Write-Host "Creating Replication Extension..." + $params = @{ + InstanceType = $instanceType; + SourceFabricArmId = $sourceFabric.Id; + TargetFabricArmId = $targetFabric.Id; + StorageAccountId = $cacheStorageAccount.Id; + StorageAccountSasSecretName = $null; + } + + # Setup Replication Extension deployment parameters + $replicationExtensionProperties = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ReplicationExtensionModelProperties]::new() + + if ($instanceType -eq $AzStackHCIInstanceTypes.HyperVToAzStackHCI) { + $replicationExtensionCustomProperties = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHcireplicationExtensionModelCustomProperties]::new() + $replicationExtensionCustomProperties.HyperVFabricArmId = $params.SourceFabricArmId + + } + elseif ($instanceType -eq $AzStackHCIInstanceTypes.VMwareToAzStackHCI) { + $replicationExtensionCustomProperties = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareToAzStackHcireplicationExtensionModelCustomProperties]::new() + $replicationExtensionCustomProperties.VMwareFabricArmId = $params.SourceFabricArmId + } + else { + throw "Currently, for AzStackHCI scenario, only HyperV and VMware as the source is supported." + } + $replicationExtensionCustomProperties.InstanceType = $params.InstanceType + $replicationExtensionCustomProperties.AzStackHCIFabricArmId = $params.TargetFabricArmId + $replicationExtensionCustomProperties.StorageAccountId = $params.StorageAccountId + $replicationExtensionCustomProperties.StorageAccountSasSecretName = $params.StorageAccountSasSecretName + $replicationExtensionProperties.CustomProperty = $replicationExtensionCustomProperties + + try { + Az.Migrate.Internal\New-AzMigrateReplicationExtension ` + -Name $replicationExtensionName ` + -ResourceGroupName $ResourceGroupName ` + -VaultName $replicationVaultName ` + -Property $replicationExtensionProperties ` + -SubscriptionId $SubscriptionId ` + -NoWait | Out-Null + } + catch { + if ($_.Exception.Message -notmatch "Status: OK") { + throw $_.Exception.Message + } + } + + # Check replication extension creation status every 30s. Timeout after 10min + for ($i = 0; $i -lt 20; $i++) { + Start-Sleep -Seconds 30 + $replicationExtension = Az.Migrate.Internal\Get-AzMigrateReplicationExtension ` + -ResourceGroupName $ResourceGroupName ` + -Name $replicationExtensionName ` + -VaultName $replicationVaultName ` + -SubscriptionId $SubscriptionId ` + -ErrorVariable notPresent ` + -ErrorAction SilentlyContinue + if ($null -eq $replicationExtension) { + throw "Unexpected error occurred during Replication Extension creation. Please re-run this command or contact support if help needed." + } + + # Stop if replication extension reaches a terminal state + if ($replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Succeeded -or + $replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Deleted -or + $replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Canceled -or + $replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Failed) { + break + } + } + + # Make sure replicationExtension is in a terminal state + if (-not ( + $replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Succeeded -or + $replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Deleted -or + $replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Canceled -or + $replicationExtension.Property.ProvisioningState -eq [ProvisioningState]::Failed)) { + throw "Replication Extension '$($replicationExtensionName)' times out with Provisioning State: '$($replicationExtension.Property.ProvisioningState)' during creation process. Please re-run this command or contact support if help needed." + } + } + + if ($replicationExtension.Property.ProvisioningState -ne [ProvisioningState]::Succeeded) { + throw "Replication Extension '$($replicationExtensionName)' has an unexpected Provisioning State of '$($replicationExtension.Property.ProvisioningState)'. Please re-run this command or contact support if help needed." + } + + $replicationExtension = Az.Migrate.Internal\Get-AzMigrateReplicationExtension ` + -ResourceGroupName $ResourceGroupName ` + -Name $replicationExtensionName ` + -VaultName $replicationVaultName ` + -SubscriptionId $SubscriptionId ` + -ErrorVariable notPresent ` + -ErrorAction SilentlyContinue + if ($null -eq $replicationExtension) { + throw "Unexpected error occurred during Replication Extension creation. Please re-run this command or contact support if help needed." + } + elseif ($replicationExtension.Property.ProvisioningState -ne [ProvisioningState]::Succeeded) { + throw "Replication Extension '$($replicationExtensionName)' has an unexpected Provisioning State of '$($replicationExtension.Property.ProvisioningState)'. Please re-run this command or contact support if help needed." + } + else { + Write-Host "*Selected Replication Extension: '$($replicationExtensionName)'." + } + + if ($PassThru) { + return $true + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/custom/New-AzMigrateHCIDiskMappingObject.ps1 b/src/Migrate/Migrate.Autorest/custom/New-AzMigrateHCIDiskMappingObject.ps1 new file mode 100644 index 000000000000..5e73f5696f24 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/custom/New-AzMigrateHCIDiskMappingObject.ps1 @@ -0,0 +1,79 @@ + +# ---------------------------------------------------------------------------------- +# +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Creates a new disk mapping +.Description +The New-AzMigrateHCIDiskMappingObject cmdlet creates a mapping of the source disk attached to the server to be migrated +.Link +https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratehcidiskmappingobject +#> +function New-AzMigrateHCIDiskMappingObject { + [OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHCIDiskInput])] + [CmdletBinding(PositionalBinding = $false)] + param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the disk ID of the disk attached to the discovered server to be migrated. + ${DiskID}, + + [Parameter(Mandatory)] + [ValidateSet("true" , "false")] + [ArgumentCompleter( { "true" , "false" })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies whether the disk contains the Operating System for the source server to be migrated. + ${IsOSDisk}, + + [Parameter(Mandatory)] + [ValidateSet("true" , "false")] + [ArgumentCompleter( { "true" , "false" })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies whether the disk is dynamic. + ${IsDynamic}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.Int64] + # Specifies the disk size in GB. + ${Size}, + + [Parameter(Mandatory)] + [ValidateSet("VHD", "VHDX")] + [ArgumentCompleter( { "VHD", "VHDX" })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the disk format. + ${Format} + ) + + process { + $isDynamicDisk = [System.Convert]::ToBoolean($IsDynamic) + $osDisk = [System.Convert]::ToBoolean($IsOSDisk) + + $DiskObject = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHCIDiskInput]::new( + $DiskID, + $isDynamicDisk, + $Size, + $Format, + $osDisk + ) + + return $DiskObject + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/custom/New-AzMigrateHCINicMappingObject.ps1 b/src/Migrate/Migrate.Autorest/custom/New-AzMigrateHCINicMappingObject.ps1 new file mode 100644 index 000000000000..5640d529b518 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/custom/New-AzMigrateHCINicMappingObject.ps1 @@ -0,0 +1,71 @@ + +# ---------------------------------------------------------------------------------- +# +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Creates an object to update NIC properties of a replicating server. +.Description +The New-AzMigrateHCINicMappingObject cmdlet creates a mapping of the source NIC attached to the server to be migrated. This object is provided as an input to the Set-AzMigrateServerReplication cmdlet to update the NIC and its properties for a replicating server. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratehcinicmappingobject +#> +function New-AzMigrateHCINicMappingObject { + [OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHCINicInput])] + [CmdletBinding(PositionalBinding = $false)] + param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the ID of the NIC to be updated. + ${NicID}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the logical network ARM ID that the VMs will use. + ${TargetVirtualSwitchId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the test logical network ARM ID that the VMs will use. + ${TargetTestVirtualSwitchId}, + + [Parameter()] + [ValidateSet("true" , "false")] + [ArgumentCompleter( { "true" , "false" })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies whether the this Nic should be created at target. + ${CreateAtTarget} = "true" + ) + + process { + if (!$PSBoundParameters.ContainsKey('TargetTestVirtualSwitchId')) { + $TargetTestVirtualSwitchId = $TargetVirtualSwitchId + } + + $selectionTypeForFailover = if ($CreateAtTarget -eq "true") { "SelectedByUser" } else { "NotSelected" } + + $NicObject = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHCINicInput]::new( + $NicID, + $TargetVirtualSwitchId, + $TargetTestVirtualSwitchId, + $selectionTypeForFailover + ) + + return $NicObject + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/custom/New-AzMigrateHCIServerReplication.ps1 b/src/Migrate/Migrate.Autorest/custom/New-AzMigrateHCIServerReplication.ps1 new file mode 100644 index 000000000000..01a3870a06ff --- /dev/null +++ b/src/Migrate/Migrate.Autorest/custom/New-AzMigrateHCIServerReplication.ps1 @@ -0,0 +1,589 @@ + +# ---------------------------------------------------------------------------------- +# +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Starts replication for the specified server. +.Description +The New-AzMigrateHCIServerReplication cmdlet starts the replication for a particular discovered server in the Azure Migrate project. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratehciserverreplication +#> +function New-AzMigrateHCIServerReplication { + [OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel])] + [CmdletBinding(DefaultParameterSetName = 'ByIdDefaultUser', PositionalBinding = $false, SupportsShouldProcess, ConfirmImpact = 'Medium')] + param( + [Parameter(ParameterSetName = 'ByIdDefaultUser', Mandatory)] + [Parameter(ParameterSetName = 'ByIdPowerUser', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the machine ARM ID of the discovered server to be migrated. + ${MachineId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the storage path ARM ID where the VMs will be stored. + ${TargetStoragePathId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.Int32] + # Specifies the number of CPU cores. + ${TargetVMCPUCore}, + + [Parameter(ParameterSetName = 'ByIdDefaultUser', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the logical network ARM ID that the VMs will use. + ${TargetVirtualSwitchId}, + + [Parameter(ParameterSetName = 'ByIdDefaultUser')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the test logical network ARM ID that the VMs will use. + ${TargetTestVirtualSwitchId}, + + [Parameter()] + [ValidateSet("true" , "false")] + [ArgumentCompleter( { "true" , "false" })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies if RAM is dynamic or not. + ${IsDynamicMemoryEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.Int64] + # Specifies the target RAM size in MB. + ${TargetVMRam}, + + [Parameter(ParameterSetName = 'ByIdPowerUser', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHCIDiskInput[]] + # Specifies the disks on the source server to be included for replication. + ${DiskToInclude}, + + [Parameter(ParameterSetName = 'ByIdPowerUser', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHCINicInput[]] + # Specifies the NICs on the source server to be included for replication. + ${NicToInclude}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the target Resource Group Id where the migrated VM resources will reside. + ${TargetResourceGroupId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the name of the VM to be created. + ${TargetVMName}, + + [Parameter(ParameterSetName = 'ByIdDefaultUser', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the Operating System disk for the source server to be migrated. + ${OSDiskID}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script = '(Get-AzContext).Subscription.Id')] + [System.String] + # Azure Subscription ID. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} + ) + + process { + Import-Module $PSScriptRoot\Helper\AzStackHCICommonSettings.ps1 + Import-Module $PSScriptRoot\Helper\CommonHelper.ps1 + + CheckResourceGraphModuleDependency + CheckResourcesModuleDependency + + $HasTargetVMCPUCore = $PSBoundParameters.ContainsKey('TargetVMCPUCore') + $HasIsDynamicMemoryEnabled = $PSBoundParameters.ContainsKey('IsDynamicMemoryEnabled') + if ($HasIsDynamicMemoryEnabled) { + $isDynamicRamEnabled = [System.Convert]::ToBoolean($IsDynamicMemoryEnabled) + } + $HasTargetVMRam = $PSBoundParameters.ContainsKey('TargetVMRam') + $HasTargetTestVirtualSwitchId = $PSBoundParameters.ContainsKey('TargetTestVirtualSwitchId') + $parameterSet = $PSCmdlet.ParameterSetName + + $null = $PSBoundParameters.Remove('TargetVMCPUCore') + $null = $PSBoundParameters.Remove('IsDynamicMemoryEnabled') + $null = $PSBoundParameters.Remove('TargetVMRam') + $null = $PSBoundParameters.Remove('DiskToInclude') + $null = $PSBoundParameters.Remove('NicToInclude') + $null = $PSBoundParameters.Remove('TargetResourceGroupId') + $null = $PSBoundParameters.Remove('TargetVMName') + $null = $PSBoundParameters.Remove('TargetVirtualSwitchId') + $null = $PSBoundParameters.Remove('TargetTestVirtualSwitchId') + $null = $PSBoundParameters.Remove('TargetStoragePathId') + $null = $PSBoundParameters.Remove('OSDiskID') + $null = $PSBoundParameters.Remove('MachineId') + $null = $PSBoundParameters.Remove('WhatIf') + $null = $PSBoundParameters.Remove('Confirm') + + $MachineIdArray = $MachineId.Split("/") + $SiteType = $MachineIdArray[7] + $SiteName = $MachineIdArray[8] + $ResourceGroupName = $MachineIdArray[4] + $MachineName = $MachineIdArray[10] + + if (($SiteType -ne $SiteTypes.HyperVSites) -and ($SiteType -ne $SiteTypes.VMwareSites)) { + throw "Site type is not supported. Site type '$SiteType'. Check MachineId provided." + } + + # Get the source site and the discovered machine + $null = $PSBoundParameters.Add("ResourceGroupName", $ResourceGroupName) + $null = $PSBoundParameters.Add("SiteName", $SiteName) + $null = $PSBoundParameters.Add("MachineName", $MachineName) + + if ($SiteType -eq $SiteTypes.HyperVSites) { + $instanceType = $AzStackHCIInstanceTypes.HyperVToAzStackHCI + $machine = Az.Migrate.Internal\Get-AzMigrateHyperVMachine @PSBoundParameters + + $null = $PSBoundParameters.Remove('MachineName') + $siteObject = Az.Migrate.Internal\Get-AzMigrateHyperVSite @PSBoundParameters + } + elseif ($SiteType -eq $SiteTypes.VMwareSites) { + $instanceType = $AzStackHCIInstanceTypes.VMwareToAzStackHCI + $machine = Az.Migrate.Internal\Get-AzMigrateMachine @PSBoundParameters + + $null = $PSBoundParameters.Remove('MachineName') + $siteObject = Az.Migrate\Get-AzMigrateSite @PSBoundParameters + } + + $null = $PSBoundParameters.Remove('ResourceGroupName') + $null = $PSBoundParameters.Remove('SiteName') + + if ($null -eq $machine) { + throw "No machine '$MachineName' found in resource group '$ResourceGroupName' and site '$SiteName'." + } + + if ($siteObject -and ($siteObject.Count -ge 1)) { + $ProjectName = $siteObject.DiscoverySolutionId.Split("/")[8] + } + else { + throw "No site '$SiteName' found in resource group '$ResourceGroupName'" + } + + # Get the migrate solution. + $null = $PSBoundParameters.Add("ResourceGroupName", $ResourceGroupName) + $null = $PSBoundParameters.Add("Name", "Servers-Migration-ServerMigration_DataReplication") + $null = $PSBoundParameters.Add("MigrateProjectName", $ProjectName) + + $solution = Az.Migrate\Get-AzMigrateSolution @PSBoundParameters + $vaultName = $solution.DetailExtendedDetail.AdditionalProperties.vaultId.Split("/")[8] + + $null = $PSBoundParameters.Remove('ResourceGroupName') + $null = $PSBoundParameters.Remove("Name") + $null = $PSBoundParameters.Remove("MigrateProjectName") + + if (($null -eq $solution) -or [string]::IsNullOrEmpty($vaultName)) { + throw 'Azure Migrate Project not configured. Setup Azure Migrate Project and run the Initialize-AzMigrateHCIReplicationInfrastructure script before proceeding.' + } + + # Get fabrics and appliances in the project + $allFabrics = Az.Migrate\Get-AzMigrateHCIReplicationFabric -ResourceGroupName $ResourceGroupName + foreach ($fabric in $allFabrics) { + if ($fabric.Property.CustomProperty.MigrationSolutionId -ne $solution.Id) { + continue + } + + if ($fabric.Property.CustomProperty.InstanceType -ceq $FabricInstanceTypes.HyperVInstance) { + $sourceFabric = $fabric + } + elseif ($fabric.Property.CustomProperty.InstanceType -ceq $FabricInstanceTypes.VmwareInstance) { + $sourceFabric = $fabric + } + elseif ($fabric.Property.CustomProperty.InstanceType -ceq $FabricInstanceTypes.AzStackHCIInstance) { + $targetFabric = $fabric + } + } + + if ($null -eq $sourceFabric) { + throw "No connected source appliances are found. Kindly deploy an appliance by completing the Discover step of the migration jounery on the source cluster." + } + + if ($null -eq $targetFabric) { + throw "A target appliance is not available for the target cluster. Deploy and configure a new appliance for the cluster, or select a different cluster.." + } + + # Get Source and Target Dras + $sourceDras = Az.Migrate.Internal\Get-AzMigrateDra ` + -FabricName $sourceFabric.Name ` + -ResourceGroupName $ResourceGroupName ` + -ErrorVariable notPresent ` + -ErrorAction SilentlyContinue + if ($null -eq $sourceDras) { + throw "No connected source appliances are found. Kindly deploy an appliance by completing the Discover step of the migration jounery on the source cluster." + } + $sourceDra = $sourceDras[0] + + $targetDras = Az.Migrate.Internal\Get-AzMigrateDra ` + -FabricName $targetFabric.Name ` + -ResourceGroupName $ResourceGroupName ` + -ErrorVariable notPresent ` + -ErrorAction SilentlyContinue + if ($null -eq $targetDras) { + throw "A target appliance is not available for the target cluster. Deploy and configure a new appliance for the cluster, or select a different cluster.." + } + $targetDra = $targetDras[0] + + # Validate Policy + $policyName = $vaultName + $instanceType + "policy" + $policyObj = Az.Migrate.Internal\Get-AzMigratePolicy ` + -ResourceGroupName $ResourceGroupName ` + -Name $policyName ` + -VaultName $vaultName ` + -SubscriptionId $SubscriptionId ` + -ErrorVariable notPresent ` + -ErrorAction SilentlyContinue + + if ($null -eq $policyObj) { + throw "The replication infrastructure is not initialized. Run the Initialize-AzMigrateHCIReplicationInfrastructure script again." + } + + # Validate Replication Extension + $replicationExtensionName = ($sourceFabric.Id -split '/')[-1] + "-" + ($targetFabric.Id -split '/')[-1] + "-MigReplicationExtn" + $replicationExtension = Az.Migrate.Internal\Get-AzMigrateReplicationExtension ` + -ResourceGroupName $ResourceGroupName ` + -Name $replicationExtensionName ` + -VaultName $vaultName ` + -SubscriptionId $SubscriptionId ` + -ErrorVariable notPresent ` + -ErrorAction SilentlyContinue + + if ($null -eq $replicationExtension) { + throw "The replication infrastructure is not initialized. Run the Initialize-AzMigrateHCIReplicationInfrastructure script again." + } + + $targetClusterId = $targetFabric.Property.CustomProperty.Cluster.ResourceName + $targetClusterIdArray = $targetClusterId.Split("/") + $targetSubscription = $targetClusterIdArray[2] + + # Get Target cluster + $hciClusterArgQuery = GetHCIClusterARGQuery -HCIClusterID $targetClusterId + $targetCluster = Az.ResourceGraph\Search-AzGraph -Query $hciClusterArgQuery -Subscription $targetSubscription + if ($null -eq $targetCluster) { + throw "Validate target cluster with id '$targetClusterId' exists. Check ARC resource bridge is running on this cluster." + } + + # Get source appliance RunAsAccount + if ($SiteType -eq $SiteTypes.HyperVSites) { + $runAsAccounts = Az.Migrate.Internal\Get-AzMigrateHyperVRunAsAccount ` + -ResourceGroupName $ResourceGroupName ` + -SiteName $SiteName ` + -SubscriptionId $SubscriptionId + $runAsAccount = $runAsAccounts | Where-Object { $_.CredentialType -eq $RunAsAccountCredentialTypes.HyperVFabric } + } + elseif ($SiteType -eq $SiteTypes.VMwareSites) { + $runAsAccounts = Az.Migrate\Get-AzMigrateRunAsAccount ` + -ResourceGroupName $ResourceGroupName ` + -SiteName $SiteName ` + -SubscriptionId $SubscriptionId + $runAsAccount = $runAsAccounts | Where-Object { $_.CredentialType -eq $RunAsAccountCredentialTypes.VMwareFabric } + } + + if ($null -eq $runAsAccount) { + throw "No run as account found for site '$SiteName'." + } + + # Validate TargetVMName + if ($TargetVMName.length -gt 64 -or $TargetVMName.length -eq 0) { + throw "The target virtual machine name must be between 1 and 64 characters long." + } + Import-Module Az.Resources + $vmId = $customProperties.TargetResourceGroupId + "/providers/Microsoft.Compute/virtualMachines/" + $TargetVMName + $VMNamePresentInRg = Get-AzResource -ResourceId $vmId -ErrorVariable notPresent -ErrorAction SilentlyContinue + if ($VMNamePresentInRg) { + throw "The target virtual machine name must be unique in the target resource group." + } + + if ($TargetVMName -notmatch "^[^_\W][a-zA-Z0-9\-]{0,63}(?+=;,?*@&, whitespace, or begin with '_' or end with '.' or '-'." + } + + if (IsReservedOrTrademarked($TargetVMName)) { + throw "The target virtual machine name '$TargetVMName' or part of the name is a trademarked or reserved word." + } + + $protectedItemProperties = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelProperties]::new() + $protectedItemProperties.PolicyName = $policyName + $protectedItemProperties.ReplicationExtensionName = $replicationExtensionName + + if ($SiteType -eq $SiteTypes.HyperVSites) { + $customProperties = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHCIProtectedItemModelCustomProperties]::new() + $isSourceDynamicMemoryEnabled = $machine.IsDynamicMemoryEnabled + } + elseif ($SiteType -eq $SiteTypes.VMwareSites) { + $customProperties = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareToAzStackHCIProtectedItemModelCustomProperties]::new() + $isSourceDynamicMemoryEnabled = $false + } + + $customProperties.InstanceType = $instanceType + $customProperties.CustomLocationRegion = $targetCluster.CustomLocationRegion + $customProperties.FabricDiscoveryMachineId = $machine.Id + $customProperties.RunAsAccountId = $runAsAccount.Id + $customProperties.SourceDraName = $sourceDra.Name + $customProperties.StorageContainerId = $TargetStoragePathId + $customProperties.TargetArcClusterCustomLocationId = $targetCluster.CustomLocation + $customProperties.TargetDraName = $targetDra.Name + $customProperties.TargetHciClusterId = $targetClusterId + $customProperties.TargetResourceGroupId = $TargetResourceGroupId + $customProperties.TargetVMName = $TargetVMName + $customProperties.HyperVGeneration = if ($SiteType -eq $SiteTypes.HyperVSites) { $machine.Generation } else { "1" } + $customProperties.TargetCpuCore = if ($HasTargetVMCPUCore) { $TargetVMCPUCore } else { $machine.NumberOfProcessorCore } + $customProperties.IsDynamicRam = if ($HasIsDynamicMemoryEnabled) { $isDynamicRamEnabled } else { $isSourceDynamicMemoryEnabled } + + # Validate TargetVMRam + if ($HasTargetVMRam) { + # TargetVMRam needs to be greater than 0 + if ($TargetVMRam -le 0) { + throw "Specify target RAM greater than 0" + } + + $customProperties.TargetMemoryInMegaByte = $TargetVMRam + } + else + { + $customProperties.TargetMemoryInMegaByte = [System.Math]::Max($machine.AllocatedMemoryInMB, $RAMConfig.MinTargetMemoryInMB) + } + + # Construct default dynamic memory config + $memoryConfig = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemDynamicMemoryConfig]::new() + $memoryConfig.MinimumMemoryInMegaByte = [System.Math]::Min($customProperties.TargetMemoryInMegaByte, $RAMConfig.DefaultMinDynamicMemoryInMB) + $memoryConfig.MaximumMemoryInMegaByte = [System.Math]::Max($customProperties.TargetMemoryInMegaByte, $RAMConfig.DefaultMaxDynamicMemoryInMB) + $memoryConfig.TargetMemoryBufferPercentage = $RAMConfig.DefaultTargetMemoryBufferPercentage + + $customProperties.DynamicMemoryConfig = $memoryConfig + + # Disks and Nics + [PSCustomObject[]]$disks = @() + [PSCustomObject[]]$nics = @() + if ($parameterSet -match 'DefaultUser') { + if ($SiteType -eq $SiteTypes.HyperVSites) { + $osDisk = $machine.Disk | Where-Object { $_.InstanceId -eq $OSDiskID } + if ($null -eq $osDisk) { + throw "No Disk found with InstanceId '$OSDiskID' from discovered machine disks." + } + + $diskName = Split-Path $osDisk.Path -leaf + if (IsReservedOrTrademarked($diskName)) { + throw "The disk name '$diskName' or part of the name is a trademarked or reserved word." + } + } + elseif ($SiteType -eq $SiteTypes.VMwareSites) { + $osDisk = $machine.Disk | Where-Object { $_.Uuid -eq $OSDiskID } + if ($null -eq $osDisk) { + throw "No Disk found with Uuid '$OSDiskID' from discovered machine disks." + } + + $diskName = Split-Path $osDisk.Path -leaf + if (IsReservedOrTrademarked($diskName)) { + throw "The disk name '$diskName' or part of the name is a trademarked or reserved word." + } + } + + foreach ($sourceDisk in $machine.Disk) { + $diskId = if ($SiteType -eq $SiteTypes.HyperVSites) { $sourceDisk.InstanceId } else { $sourceDisk.Uuid } + $diskSize = if ($SiteType -eq $SiteTypes.HyperVSites) { $sourceDisk.MaxSizeInByte } else { $sourceDisk.MaxSizeInBytes } + + $DiskObject = [PSCustomObject]@{ + DiskId = $diskId + DiskSizeGb = [long] [Math]::Ceiling($diskSize / 1GB) + DiskFileFormat = "VHDX" + IsDynamic = $true + IsOSDisk = $diskId -eq $OSDiskID + } + + $disks += $DiskObject + } + + foreach ($sourceNic in $machine.NetworkAdapter) { + $NicObject = [PSCustomObject]@{ + NicId = $sourceNic.NicId + TargetNetworkId = $TargetVirtualSwitchId + TestNetworkId = if ($HasTargetTestVirtualSwitchId) { $TargetTestVirtualSwitchId } else { $TargetVirtualSwitchId } + SelectionTypeForFailover = "SelectedByUser" + } + $nics += $NicObject + } + } + else { + if ($null -eq $DiskToInclude -or $DiskToInclude.length -eq 0) { + throw "Invalid DiskToInclude. At least one disk is required." + } + + if ($null -eq $NicToInclude -or $NicToInclude.length -eq 0) { + throw "Invalid NicToInclude. At least one NIC is required." + } + + # Validate OSDisk is set. + $osDisk = $DiskToInclude | Where-Object { $_.IsOSDisk } + if (($null -eq $osDisk) -or ($osDisk.length -ne 1)) { + throw "Invalid DiskToInclude. One and only one disk must be set as OS Disk." + } + + # Validate at least one NIC is selected by user. + $selectedNics = $NicToInclude | Where-Object { $_.SelectionTypeForFailover -eq "SelectedByUser"} + if ($null -eq $selectedNics -or $selectedNics.length -eq 0) { + throw "Invalid NicToInclude. At least one NIC is required to be marked as to be created at target." + } + + # Validate DiskToInclude + [PSCustomObject[]]$uniqueDisks = @() + foreach ($disk in $DiskToInclude) { + if ($SiteType -eq $SiteTypes.HyperVSites) { + $discoveredDisk = $machine.Disk | Where-Object { $_.InstanceId -eq $disk.DiskId } + if ($null -eq $discoveredDisk) { + throw "No Disk found with InstanceId '$($disk.DiskId)' from discovered machine disks." + } + } + elseif ($SiteType -eq $SiteTypes.VMwareSites) { + $discoveredDisk = $machine.Disk | Where-Object { $_.Uuid -eq $disk.DiskId } + if ($null -eq $discoveredDisk) { + throw "No Disk found with Uuid '$($disk.DiskId)' from discovered machine disks." + } + } + + $diskName = Split-Path -Path $discoveredDisk.Path -Leaf + if (IsReservedOrTrademarked($diskName)) { + throw "The disk name '$diskName' or part of the name is a trademarked or reserved word." + } + + if ($uniqueDisks.Contains($disk.DiskId)) { + throw "The disk id '$($disk.DiskId)' is already taken." + } + $uniqueDisks += $disk.DiskId + + $htDisk = @{} + $disk.PSObject.Properties | ForEach-Object { $htDisk[$_.Name] = $_.Value } + $disks += [PSCustomObject]$htDisk + } + + # Validate NicToInclude + [PSCustomObject[]]$uniqueNics = @() + foreach ($nic in $NicToInclude) { + $discoveredNic = $machine.NetworkAdapter | Where-Object { $_.NicId -eq $nic.NicId } + if ($null -eq $discoveredNic) { + throw "The Nic id '$($nic.NicId)' is not found." + } + + if ($uniqueNics.Contains($nic.NicId)) { + throw "The Nic id '$($nic.NicId)' is already taken." + } + $uniqueNics += $nic.NicId + + $htNic = @{} + $nic.PSObject.Properties | ForEach-Object { $htNic[$_.Name] = $_.Value } + $nics += [PSCustomObject]$htNic + } + + # Include Nics not added by user as 'NotSelected' + $userGivenNicIds = $nics | Select-Object -ExpandProperty NicId + $remainingNics = $machine.NetworkAdapter | Where-Object { $_.NicId -notin $userGivenNicIds } + foreach ($remainingNic in $remainingNics) { + $NicObject = [PSCustomObject]@{ + NicId = $remainingNic.NicId + TargetNetworkId = $nics[0].TargetNetworkId + TestNetworkId = $nics[0].TestNetworkId + SelectionTypeForFailover = "NotSelected" + } + $nics += $NicObject + } + } + + if ($SiteType -eq $SiteTypes.HyperVSites) { + $customProperties.DisksToInclude = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHCIDiskInput[]]$disks + $customProperties.NicsToInclude = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHCINicInput[]]$nics + } + elseif ($SiteType -eq $SiteTypes.VMwareSites) { + $customProperties.DisksToInclude = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareToAzStackHCIDiskInput[]]$disks + $customProperties.NicsToInclude = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareToAzStackHCINicInput[]]$nics + } + + $protectedItemProperties.CustomProperty = $customProperties + + if ($PSCmdlet.ShouldProcess($MachineId, "Replicate VM.")) { + $null = $PSBoundParameters.Add('ResourceGroupName', $ResourceGroupName) + $null = $PSBoundParameters.Add('VaultName', $vaultName) + $null = $PSBoundParameters.Add('Name', $MachineName) + $null = $PSBoundParameters.Add('Property', $protectedItemProperties) + $null = $PSBoundParameters.Add('NoWait', $true) + + $operation = Az.Migrate.Internal\New-AzMigrateProtectedItem @PSBoundParameters + $jobName = $operation.Target.Split("/")[-1].Split("?")[0] + + $null = $PSBoundParameters.Remove('Name') + $null = $PSBoundParameters.Remove('Property') + $null = $PSBoundParameters.Remove('NoWait') + + $null = $PSBoundParameters.Add('JobName', $jobName) + return Az.Migrate.Internal\Get-AzMigrateWorkflow @PSBoundParameters + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/custom/Remove-AzMigrateHCIServerReplication.ps1 b/src/Migrate/Migrate.Autorest/custom/Remove-AzMigrateHCIServerReplication.ps1 new file mode 100644 index 000000000000..dee3a73c9f0f --- /dev/null +++ b/src/Migrate/Migrate.Autorest/custom/Remove-AzMigrateHCIServerReplication.ps1 @@ -0,0 +1,153 @@ + +# ---------------------------------------------------------------------------------- +# +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Stops replication for the migrated server. +.Description +The Remove-AzMigrateHCIServerReplication cmdlet stops the replication for a migrated server. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/remove-azmigratehciserverreplication +#> +function Remove-AzMigrateHCIServerReplication { + [OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel])] + [CmdletBinding(DefaultParameterSetName = 'ByID', PositionalBinding = $false, SupportsShouldProcess, ConfirmImpact='Medium')] + param( + [Parameter(ParameterSetName = 'ByID', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the replcating server for which the replication needs to be disabled. The ID should be retrieved using the Get-AzMigrateHCIServerReplication cmdlet. + ${TargetObjectID}, + + [Parameter(ParameterSetName = 'ByInputObject', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # Specifies the replcating server for which the replication needs to be disabled. The server object can be retrieved using the Get-AzMigrateHCIServerReplication cmdlet. + ${InputObject}, + + [Parameter()] + [ValidateSet("true" , "false")] + [ArgumentCompleter( { "true" , "false" })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')] + [System.String] + # Specifies whether the replication needs to be force removed. Default to "false". + ${ForceRemove} = "false", + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script = '(Get-AzContext).Subscription.Id')] + [System.String] + # Azure Subscription ID. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} + ) + + process { + $shouldForceRemove = [System.Convert]::ToBoolean($ForceRemove) + $null = $PSBoundParameters.Remove('ForceRemove') + $null = $PSBoundParameters.Remove('TargetObjectID') + $null = $PSBoundParameters.Remove('InputObject') + $null = $PSBoundParameters.Remove('WhatIf') + $null = $PSBoundParameters.Remove('Confirm') + $parameterSet = $PSCmdlet.ParameterSetName + + if ($parameterSet -eq 'ByInputObject') { + $TargetObjectID = $InputObject.Id + } + $protectedItemIdArray = $TargetObjectID.Split("/") + $resourceGroupName = $protectedItemIdArray[4] + $vaultName = $protectedItemIdArray[8] + $protectedItemName = $protectedItemIdArray[10] + + $null = $PSBoundParameters.Add("ResourceGroupName", $resourceGroupName) + $null = $PSBoundParameters.Add("VaultName", $vaultName) + $null = $PSBoundParameters.Add("Name", $protectedItemName) + + $protectedItem = Az.Migrate.Internal\Get-AzMigrateProtectedItem @PSBoundParameters -ErrorVariable notPresent -ErrorAction SilentlyContinue + if ($null -eq $ProtectedItem) + { + throw "Replication item is not found with Id '$TargetObjectID'." + } + + $null = $PSBoundParameters.Remove('Name') + + if ("DisableProtection" -notin $ProtectedItem.Property.AllowedJob) + { + throw "Replication item with Id '$TargetObjectID' cannot be removed at this moment. Current protection state is '$($protectedItem.Property.ProtectionStateDescription)'." + } + + $null = $PSBoundParameters.Add('ProtectedItemName', $protectedItemName) + $null = $PSBoundParameters.Add('NoWait', $true) + $null = $PSBoundParameters.Add('ForceDelete', $shouldForceRemove) + + if ($PSCmdlet.ShouldProcess($TargetObjectID, "Stop/Complete VM replication.")) { + $operation = Az.Migrate.Internal\Remove-AzMigrateProtectedItem @PSBoundParameters + $jobName = $operation.Target.Split("/")[-1].Split("?")[0] + + $null = $PSBoundParameters.Remove('ProtectedItemName') + $null = $PSBoundParameters.Remove('NoWait') + $null = $PSBoundParameters.Remove('ForceDelete') + + $null = $PSBoundParameters.Add('JobName', $jobName) + return Az.Migrate.Internal\Get-AzMigrateWorkflow @PSBoundParameters + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/custom/Remove-AzMigrateServerReplication.ps1 b/src/Migrate/Migrate.Autorest/custom/Remove-AzMigrateServerReplication.ps1 index 2800eebd7bb5..5825121ca4da 100644 --- a/src/Migrate/Migrate.Autorest/custom/Remove-AzMigrateServerReplication.ps1 +++ b/src/Migrate/Migrate.Autorest/custom/Remove-AzMigrateServerReplication.ps1 @@ -28,13 +28,13 @@ function Remove-AzMigrateServerReplication { [Parameter(ParameterSetName = 'ByIDVMwareCbt', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [System.String] - # Specifies the replcating server for which the replicatio needs to be disabled. The ID should be retrieved using the Get-AzMigrateServerReplication cmdlet. + # Specifies the replcating server for which the replication needs to be disabled. The ID should be retrieved using the Get-AzMigrateServerReplication cmdlet. ${TargetObjectID}, [Parameter(ParameterSetName = 'ByInputObjectVMwareCbt', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem] - # Specifies the machine object of the replicating server. + # Specifies the replcating server for which the replication needs to be disabled. The server object should be retrieved using the Get-AzMigrateServerReplication cmdlet. ${InputObject}, [Parameter()] diff --git a/src/Migrate/Migrate.Autorest/custom/Set-AzMigrateHCIServerReplication.ps1 b/src/Migrate/Migrate.Autorest/custom/Set-AzMigrateHCIServerReplication.ps1 new file mode 100644 index 000000000000..ced599ff90d4 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/custom/Set-AzMigrateHCIServerReplication.ps1 @@ -0,0 +1,328 @@ + +# ---------------------------------------------------------------------------------- +# +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Updates the target properties for the replicating server. +.Description +The Set-AzMigrateHCIServerReplication cmdlet updates the target properties for the replicating server. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/set-azmigratehciserverreplication +#> +function Set-AzMigrateHCIServerReplication { + [OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel])] + [CmdletBinding(DefaultParameterSetName = 'ById', PositionalBinding = $false, SupportsShouldProcess, ConfirmImpact='Medium')] + param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the replicating server for which the properties need to be updated. The ID should be retrieved using the Get-AzMigrateHCIServerReplication cmdlet. + ${TargetObjectID}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the target VM name. + ${TargetVMName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.Int32] + # Specifies the number of CPU cores. + ${TargetVMCPUCore}, + + [Parameter()] + [ValidateSet("true" , "false")] + [ArgumentCompleter( { "true" , "false" })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies if RAM is dynamic or not. + ${IsDynamicMemoryEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemDynamicMemoryConfig] + # Specifies the dynamic memory configration of RAM. + ${DynamicMemoryConfig}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.Int64] + # Specifies the target RAM size in MB. + ${TargetVMRam}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHCINicInput[]] + # Specifies the nics on the source server to be included for replication. + ${NicToInclude}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script = '(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} + ) + + process { + Import-Module $PSScriptRoot\Helper\AzStackHCICommonSettings.ps1 + Import-Module $PSScriptRoot\Helper\CommonHelper.ps1 + + CheckResourcesModuleDependency + + $HasTargetVMName = $PSBoundParameters.ContainsKey('TargetVMName') + $HasTargetVMCPUCore = $PSBoundParameters.ContainsKey('TargetVMCPUCore') + $HasIsDynamicMemoryEnabled = $PSBoundParameters.ContainsKey('IsDynamicMemoryEnabled') + if ($HasIsDynamicMemoryEnabled) { + $isDynamicRamEnabled = [System.Convert]::ToBoolean($IsDynamicMemoryEnabled) + } + $HasDynamicMemoryConfig = $PSBoundParameters.ContainsKey('DynamicMemoryConfig') + $HasTargetVMRam = $PSBoundParameters.ContainsKey('TargetVMRam') + $HasNicToInclude = $PSBoundParameters.ContainsKey('NicToInclude') + + $null = $PSBoundParameters.Remove('TargetVMName') + $null = $PSBoundParameters.Remove('TargetVMCPUCore') + $null = $PSBoundParameters.Remove('IsDynamicMemoryEnabled') + $null = $PSBoundParameters.Remove('DynamicMemoryConfig') + $null = $PSBoundParameters.Remove('TargetVMRam') + $null = $PSBoundParameters.Remove('NicToInclude') + $null = $PSBoundParameters.Remove('TargetObjectID') + $null = $PSBoundParameters.Remove('WhatIf') + $null = $PSBoundParameters.Remove('Confirm') + + $ProtectedItemIdArray = $TargetObjectID.Split("/") + $ResourceGroupName = $ProtectedItemIdArray[4] + $VaultName = $ProtectedItemIdArray[8] + $MachineName = $ProtectedItemIdArray[10] + + $null = $PSBoundParameters.Add("ResourceGroupName", $ResourceGroupName) + $null = $PSBoundParameters.Add("VaultName", $VaultName) + $null = $PSBoundParameters.Add("Name", $MachineName) + + $ProtectedItem = Az.Migrate.Internal\Get-AzMigrateProtectedItem @PSBoundParameters -ErrorVariable notPresent -ErrorAction SilentlyContinue + if ($null -eq $ProtectedItem) { + throw "Replication item is not found with Id '$TargetObjectID'." + } + + $null = $PSBoundParameters.Remove("ResourceGroupName") + $null = $PSBoundParameters.Remove("VaultName") + $null = $PSBoundParameters.Remove("Name") + + $protectedItemProperties = $ProtectedItem.Property + $customProperties = $protectedItemProperties.CustomProperty + $MachineIdArray = $customProperties.FabricDiscoveryMachineId.Split("/") + $SiteType = $MachineIdArray[7] + + if (!$protectedItemProperties.AllowedJob.Contains('PlannedFailover')) { + throw "Set server replication is not allowed for this item '$TargetObjectID'." + } + + if ($HasTargetVMName) { + if ($TargetVMName.length -gt 64 -or $TargetVMName.length -eq 0) { + throw "The target virtual machine name must be between 1 and 64 characters long." + } + + Import-Module Az.Resources + $vmId = $customProperties.TargetResourceGroupId + "/providers/Microsoft.Compute/virtualMachines/" + $TargetVMName + $VMNamePresentInRg = Get-AzResource -ResourceId $vmId -ErrorVariable notPresent -ErrorAction SilentlyContinue + if ($VMNamePresentInRg) { + throw "The target virtual machine name must be unique in the target resource group." + } + + if ($TargetVMName -notmatch "^[^_\W][a-zA-Z0-9\-]{0,63}(?+=;,?*@&, whitespace, or begin with '_' or end with '.' or '-'." + } + + if (IsReservedOrTrademarked($TargetVMName)) { + throw "The target virtual machine name '$TargetVMName' or part of the name is a trademarked or reserved word." + } + + $customProperties.TargetVMName = $TargetVMName + } + + if ($HasTargetVMCPUCore) { + if ($TargetVMCPUCore -le 0) { + throw "Specify target CPU core greater than 0" + } + + $customProperties.TargetCpuCore = $TargetVMCPUCore + } + + # Validate TargetVMRam + if ($HasTargetVMRam) { + if ($TargetVMRam -le 0) { + throw "Specify target RAM greater than 0" + } + + $customProperties.TargetMemoryInMegaByte = $TargetVMRam + } + + if ($HasIsDynamicMemoryEnabled) { + $customProperties.IsDynamicRam = $isDynamicRamEnabled + } + + # Dynamic memory enabled & DynamicMemoryConfig supplied + if ($customProperties.IsDynamicRam -and $HasDynamicMemoryConfig) { + if ($customProperties.TargetMemoryInMegaByte -lt $DynamicMemoryConfig.MinimumMemoryInMegaByte) { + throw "DynamicMemoryConfig - Specify minimum memory less than $($customProperties.TargetMemoryInMegaByte)" + } + + if ($customProperties.TargetMemoryInMegaByte -gt $DynamicMemoryConfig.MaximumMemoryInMegaByte) { + throw "DynamicMemoryConfig - Specify maximum memory greater than $($customProperties.TargetMemoryInMegaByte)" + } + + if ($DynamicMemoryConfig.TargetMemoryBufferPercentage -NotIn $RAMConfig.MinTargetMemoryBufferPercentage..$RAMConfig.MaxTargetMemoryBufferPercentage) + { + throw "DynamicMemoryConfig - Specify target memory buffer percentage between $($RAMConfig.MinTargetMemoryBufferPercentage) % and $($RAMConfig.MaxTargetMemoryBufferPercentage) %." + } + + $customProperties.DynamicMemoryConfig = $DynamicMemoryConfig + } + + # Dynamic memory is newly enabled and needs a default + if ($customProperties.IsDynamicRam -and $null -eq $customProperties.DynamicMemoryConfig) { + $memoryConfig = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemDynamicMemoryConfig]::new() + $memoryConfig.MinimumMemoryInMegaByte = [System.Math]::Min($customProperties.TargetMemoryInMegaByte, $RAMConfig.DefaultMinDynamicMemoryInMB) + $memoryConfig.MaximumMemoryInMegaByte = [System.Math]::Max($customProperties.TargetMemoryInMegaByte, $RAMConfig.DefaultMaxDynamicMemoryInMB) + $memoryConfig.TargetMemoryBufferPercentage = $RAMConfig.DefaultTargetMemoryBufferPercentage + + $customProperties.DynamicMemoryConfig = $memoryConfig + } + + # Nics + [PSCustomObject[]]$nics = @() + foreach ($nic in $customProperties.ProtectedNic) { + $NicObject = [PSCustomObject]@{ + NicId = $nic.NicId + TargetNetworkId = $nic.TargetNetworkId + TestNetworkId = $nic.TestNetworkId + SelectionTypeForFailover = $nic.SelectionTypeForFailover + } + + $nics += $NicObject + } + + if ($HasNicToInclude -and $NicToInclude.length -gt 0) { + foreach ($nic in $NicToInclude) + { + $updatedNic = $nics | Where-Object { $_.NicId -eq $nic.NicId } + if ($null -eq $updatedNic){ + throw "The Nic id '$($nic.NicId)' is not found." + } + + $updatedNic.TargetNetworkId = $nic.TargetNetworkId + $updatedNic.TestNetworkId = $nic.TestNetworkId + $updatedNic.SelectionTypeForFailover = $nic.SelectionTypeForFailover + } + } + + $selectedNics = $nics | Where-Object { $_.SelectionTypeForFailover -eq "SelectedByUser" } + if ($null -eq $selectedNics -or $selectedNics.length -eq 0) + { + throw "At least one NIC must be selected for creation at target." + } + + # Disks + [PSCustomObject[]]$disks = @() + foreach ($disk in $customProperties.ProtectedDisk) { + $DiskObject = [PSCustomObject]@{ + DiskId = $disk.SourceDiskId + DiskSizeGb = [long] [Math]::Ceiling($disk.CapacityInByte/1GB) + DiskFileFormat = $disk.DiskType + IsDynamic = $disk.IsDynamic + IsOSDisk = $disk.IsOSDisk + } + + $disks += $DiskObject + } + + if ($SiteType -eq $SiteTypes.HyperVSites) { + $customProperties.DisksToInclude = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHCIDiskInput[]]$disks + $customProperties.NicsToInclude = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHCINicInput[]]$nics + } + elseif ($SiteType -eq $SiteTypes.VMwareSites) { + $customProperties.DisksToInclude = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareToAzStackHCIDiskInput[]]$disks + $customProperties.NicsToInclude = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareToAzStackHCINicInput[]]$nics + } + + $protectedItemProperties.CustomProperty = $customProperties + + $null = $PSBoundParameters.Add('ResourceGroupName', $ResourceGroupName) + $null = $PSBoundParameters.Add('VaultName', $vaultName) + $null = $PSBoundParameters.Add('Name', $MachineName) + $null = $PSBoundParameters.Add('Property', $protectedItemProperties) + $null = $PSBoundParameters.Add('NoWait', $true) + + if ($PSCmdlet.ShouldProcess($TargetObjectID, "Updates VM replication.")) { + $operation = Az.Migrate.Internal\New-AzMigrateProtectedItem @PSBoundParameters + $jobName = $operation.Target.Split("/")[-1].Split("?")[0] + + $null = $PSBoundParameters.Remove('Name') + $null = $PSBoundParameters.Remove('Property') + $null = $PSBoundParameters.Remove('NoWait') + + $null = $PSBoundParameters.Add('JobName', $jobName) + return Az.Migrate.Internal\Get-AzMigrateWorkflow @PSBoundParameters + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/custom/Start-AzMigrateHCIServerMigration.ps1 b/src/Migrate/Migrate.Autorest/custom/Start-AzMigrateHCIServerMigration.ps1 new file mode 100644 index 000000000000..758f7a9a1087 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/custom/Start-AzMigrateHCIServerMigration.ps1 @@ -0,0 +1,179 @@ + +# ---------------------------------------------------------------------------------- +# +# 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. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Starts the migration for the replicating server. +.Description +Starts the migration for the replicating server. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/start-azmigratehciservermigration +#> +function Start-AzMigrateHCIServerMigration { + [OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel])] + [CmdletBinding(DefaultParameterSetName = 'ByID', PositionalBinding = $false, SupportsShouldProcess, ConfirmImpact='Medium')] + param( + [Parameter(ParameterSetName = 'ByID', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the replcating server for which migration needs to be initiated. The ID should be retrieved using the Get-AzMigrateHCIServerReplication cmdlet. + ${TargetObjectID}, + + [Parameter(ParameterSetName = 'ByInputObject', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # Specifies the replicating server for which migration needs to be initiated. The server object can be retrieved using the Get-AzMigrateHCIServerReplication cmdlet. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.Management.Automation.SwitchParameter] + # Specifies whether the source server should be turned off post migration. + ${TurnOffSourceServer}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script = '(Get-AzContext).Subscription.Id')] + [System.String] + # Azure Subscription ID. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} + ) + + process { + $performShutDown = $TurnOffSourceServer.IsPresent + $null = $PSBoundParameters.Remove('ProjectName') + $null = $PSBoundParameters.Remove('MachineName') + $null = $PSBoundParameters.Remove('TurnOffSourceServer') + $null = $PSBoundParameters.Remove('TargetObjectID') + $null = $PSBoundParameters.Remove('ResourceGroupName') + $null = $PSBoundParameters.Remove('InputObject') + $null = $PSBoundParameters.Remove('WhatIf') + $null = $PSBoundParameters.Remove('Confirm') + + $parameterSet = $PSCmdlet.ParameterSetName + + if ($parameterSet -eq 'ByInputObject') { + $TargetObjectID = $InputObject.Id + } + + $protectedItemIdArray = $TargetObjectID.Split("/") + $resourceGroupName = $protectedItemIdArray[4] + $vaultName = $protectedItemIdArray[8] + $protectedItemName = $protectedItemIdArray[10] + + $null = $PSBoundParameters.Add("ResourceGroupName", $resourceGroupName) + $null = $PSBoundParameters.Add("VaultName", $vaultName) + $null = $PSBoundParameters.Add("Name", $protectedItemName) + + $protectedItem = Az.Migrate.Internal\Get-AzMigrateProtectedItem @PSBoundParameters -ErrorVariable notPresent -ErrorAction SilentlyContinue + if ($null -eq $protectedItem) { + throw "The replicating server doesn't exist. Please check the input and try again." + } + elseif ( + (!$protectedItem.Property.AllowedJob.contains("PlannedFailover")) -and + (!$ProtectedItem.Property.AllowedJob.contains("Restart"))) { + # AllowJob must contains either 'PlannedFailover' or 'Restart' to allow migration + throw "The replicating server cannot be migrated right now. Current protection state is '$($protectedItem.Property.ProtectionStateDescription)'." + } + + $null = $PSBoundParameters.Remove("ResourceGroupName") + $null = $PSBoundParameters.Remove("VaultName") + $null = $PSBoundParameters.Remove("Name") + + # Get the instance type from the protected item + $instanceType = $protectedItem.Property.CustomProperty.InstanceType + + # Setup PlannedFailover deployment parameters + $properties = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PlannedFailoverModelProperties]::new() + + if ($instanceType -eq $AzStackHCIInstanceTypes.HyperVToAzStackHCI) { + $customProperties = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHciPlannedFailoverModelCustomProperties]::new() + } + elseif ($instanceType -eq $AzStackHCIInstanceTypes.VMwareToAzStackHCI) { + $customProperties = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareToAzStackHciPlannedFailoverModelCustomProperties]::new() + } + else { + throw "Currently, for AzStackHCI scenario, only HyperV and VMware as the source is supported." + } + $customProperties.InstanceType = $instanceType + $customProperties.ShutdownSourceVM = $performShutDown + $properties.CustomProperty = $customProperties + + $null = $PSBoundParameters.Add('ResourceGroupName', $resourceGroupName) + $null = $PSBoundParameters.Add('VaultName', $vaultName) + $null = $PSBoundParameters.Add('ProtectedItemName', $protectedItemName) + $null = $PSBoundParameters.Add('NoWait', $true) + $null = $PSBoundParameters.Add('Property', $properties) + + if ($PSCmdlet.ShouldProcess($TargetObjectID, "Migrate VM.")) { + $operation = Az.Migrate.Internal\Invoke-AzMigratePlannedProtectedItemFailover @PSBoundParameters + $jobName = $operation.Target.Split("/")[-1].Split("?")[0] + + $null = $PSBoundParameters.Remove('ProtectedItemName') + $null = $PSBoundParameters.Remove('NoWait') + $null = $PSBoundParameters.Remove('Property') + + $null = $PSBoundParameters.Add('JobName', $jobName) + return Az.Migrate.Internal\Get-AzMigrateWorkflow @PSBoundParameters + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/examples/Get-AzMigrateDiscoveredServer.md b/src/Migrate/Migrate.Autorest/examples/Get-AzMigrateDiscoveredServer.md index 057c447f0b2a..7132e3a08179 100644 --- a/src/Migrate/Migrate.Autorest/examples/Get-AzMigrateDiscoveredServer.md +++ b/src/Migrate/Migrate.Autorest/examples/Get-AzMigrateDiscoveredServer.md @@ -1,4 +1,4 @@ -### Example 1: List +### Example 1: List VMware machines ```powershell Get-AzMigrateDiscoveredServer -SubscriptionId xxx-xxx-xxx -ResourceGroupName julytest -ProjectName julytest ``` @@ -20,7 +20,7 @@ idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_5029cc18-ef ``` Get All servers in a migrate project. -### Example 2: Get +### Example 2: Get VMware machine ```powershell Get-AzMigrateDiscoveredServer -Name idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_5029e62c-31d2-a6c3-5316-aa39f47c49fc -SubscriptionId xxx-xxx-xxx -ResourceGroupName julytest -ProjectName julytest ``` @@ -33,7 +33,7 @@ idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_5029e62c-31 ``` Get a server in a migrate project by name. Name is a unique paramenter for a server. -### Example 3: List in an appliance +### Example 3: List VMware machines in an appliance ```powershell Get-AzMigrateDiscoveredServer -ApplianceName BBVMwareAVS -SubscriptionId xxx-xxx-xxx -ResourceGroupName julytest -ProjectName julytest ``` @@ -55,7 +55,7 @@ idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_5029cc18-ef ``` List all servers for an appliance in a project. -### Example 4: Get in an appliance +### Example 4: Get VMware machine in an appliance ```powershell Get-AzMigrateDiscoveredServer -Name idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_5029e62c-31d2-a6c3-5316-aa39f47c49fc -ApplianceName BBVMwareAVS -SubscriptionId xxx-xxx-xxx -ResourceGroupName julytest -ProjectName julytest ``` @@ -68,7 +68,7 @@ idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_5029e62c-31 ``` Get a server for an appliance in a project. Name is a unique paramenter for a server. -### Example 5: List and filter by display name +### Example 5: List and filter VMware machines by display name ```powershell Get-AzMigrateDiscoveredServer -SubscriptionId xxx-xxx-xxx -ResourceGroupName BugBashAVSVMware -ProjectName BugBashAVSVMware -DisplayName Contoso | Format-Table DisplayName,Name,Type ``` @@ -87,7 +87,7 @@ ContosoAppSrv1 10-150-8-52-b090bef3-b733-5e34-bc8f-eb6f2701432a_5 ``` List servers in a migrate project and filter responses with display name. -### Example 6: List in an appliance and filter by display name +### Example 6: List VMware machines in an appliance and filter by display name ```powershell Get-AzMigrateDiscoveredServer -SubscriptionId xxx-xxx-xxx -ResourceGroupName BugBashAVSVMware -ProjectName BugBashAVSVMware -ApplianceName BBVMwareAVS -DisplayName Contoso | Format-Table DisplayName,Name,Type ``` @@ -106,3 +106,18 @@ Contoso-DataTier3 10-150-8-52-b090bef3-b733-5e34-bc8f-eb6f2701432a_5 ``` List servers for an appliance in a migrate project and filter responses with display name. +### Example 7: List HyperV machines +```powershell +Get-AzMigrateDiscoveredServer -SubscriptionId xxx-xxx-xxx -ResourceGroupName "test-rg" -ProjectName "testproj" -SourceMachineType "HyperV" | Format-Table DisplayName,Name,Type +``` + +```output +DisplayName Name Type +----------- ---- ---- +testvm1 291b6c67-8793-4e21-887e-1e6c3bd00a60 Microsoft.OffAzure/HyperVSites/machines +testvm2 0fbd6ccb-7133-4e72-b18e-5ec98c9c628f Microsoft.OffAzure/HyperVSites/machines +testvm3 e6390dfa-6125-431c-871d-f407bdecb571 Microsoft.OffAzure/HyperVSites/machines +testvm4 af83b64b-2314-48e2-8d0f-fd44ab5142ba Microsoft.OffAzure/HyperVSites/machines +``` +Get All HyperV servers in a migrate project. Similarly, specify "HyperV" for -SourceMachineType in all the above examples can retrieve HyperV machine(s) in different ways. + diff --git a/src/Migrate/Migrate.Autorest/examples/Get-AzMigrateHCIJob.md b/src/Migrate/Migrate.Autorest/examples/Get-AzMigrateHCIJob.md new file mode 100644 index 000000000000..254cc65a71a2 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/examples/Get-AzMigrateHCIJob.md @@ -0,0 +1,266 @@ +### Example 1: Get by job Id +```powershell +Get-AzMigrateHCIJob -ID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/jobs/0203aa1b-1dff-4653-89a9-b90a76d1601a" +``` + +```output +ActivityId : ActivityId: 00000000-0000-0000-0000-000000000000 +AllowedAction : {Cancel} +CustomPropertyAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetails +CustomPropertyInstanceType : WorkflowDetails +DisplayName : Delete protected item +EndTime : +Error : {} +Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication + /replicationVaults/testproj1234replicationvault/jobs/0203aa1b-1dff-4653-89a9-b90a76d1601a +Name : 0203aa1b-1dff-4653-89a9-b90a76d1601a +ObjectId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication + /replicationVaults/testproj1234replicationvault/protectedItems/testsite-0000-0000-00000001 +ObjectInternalId : 13436868-1f4c-5d4e-a252-c666179bf4df +ObjectInternalName : testmachine1 +ObjectName : testsite-0000-0000-00000001 +ObjectType : ProtectedItem +ReplicationProviderId : 0a870516-56c7-4460-998c-f267bd579f16 +SourceFabricProviderId : a2793d98-d4f1-427f-a5a6-2d694f4a1bf7 +StartTime : 8/14/2023 7:09:10 PM +State : Started +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelTags +TargetFabricProviderId : 22f00372-a1b7-467f-87ce-d95e17a6e7c7 +Task : {Prerequisite check, Deleting protected item} +Type : Microsoft.DataReplication/replicationVaults/jobs +``` + +Retrieves a job by its Id. + +### Example 2: Get by job name +```powershell +Get-AzMigrateHCIJob -ResourceGroupName "test-rg" -ProjectName "testproj" -Name "0203aa1b-1dff-4653-89a9-b90a76d1601a" +``` + +```output +ActivityId : ActivityId: 00000000-0000-0000-0000-000000000000 +AllowedAction : {Cancel} +CustomPropertyAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetails +CustomPropertyInstanceType : WorkflowDetails +DisplayName : Delete protected item +EndTime : +Error : {} +Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication + /replicationVaults/testproj1234replicationvault/jobs/0203aa1b-1dff-4653-89a9-b90a76d1601a +Name : 0203aa1b-1dff-4653-89a9-b90a76d1601a +ObjectId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication + /replicationVaults/testproj1234replicationvault/protectedItems/testsite-0000-0000-00000001 +ObjectInternalId : 13436868-1f4c-5d4e-a252-c666179bf4df +ObjectInternalName : testmachine1 +ObjectName : testsite-0000-0000-00000001 +ObjectType : ProtectedItem +ReplicationProviderId : 0a870516-56c7-4460-998c-f267bd579f16 +SourceFabricProviderId : a2793d98-d4f1-427f-a5a6-2d694f4a1bf7 +StartTime : 8/14/2023 7:09:10 PM +State : Started +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelTags +TargetFabricProviderId : 22f00372-a1b7-467f-87ce-d95e17a6e7c7 +Task : {Prerequisite check, Deleting protected item} +Type : Microsoft.DataReplication/replicationVaults/jobs +``` + +Retrieves a job by its name. + +### Example 3: Get by job input object +```powershell +$InputObject = Get-AzMigrateHCIJob -ID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/jobs/0203aa1b-1dff-4653-89a9-b90a76d1601a" + +Get-AzMigrateHCIJob -InputObject $InputObject + +$InputObject | Get-AzMigrateHCIJob +``` + +```output +ActivityId : ActivityId: 00000000-0000-0000-0000-000000000000 +AllowedAction : {Cancel} +CustomPropertyAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetails +CustomPropertyInstanceType : WorkflowDetails +DisplayName : Delete protected item +EndTime : +Error : {} +Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication + /replicationVaults/testproj1234replicationvault/jobs/0203aa1b-1dff-4653-89a9-b90a76d1601a +Name : 0203aa1b-1dff-4653-89a9-b90a76d1601a +ObjectId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication + /replicationVaults/testproj1234replicationvault/protectedItems/testsite-0000-0000-00000001 +ObjectInternalId : 13436868-1f4c-5d4e-a252-c666179bf4df +ObjectInternalName : testmachine1 +ObjectName : testsite-0000-0000-00000001 +ObjectType : ProtectedItem +ReplicationProviderId : 0a870516-56c7-4460-998c-f267bd579f16 +SourceFabricProviderId : a2793d98-d4f1-427f-a5a6-2d694f4a1bf7 +StartTime : 8/14/2023 7:09:10 PM +State : Started +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelTags +TargetFabricProviderId : 22f00372-a1b7-467f-87ce-d95e17a6e7c7 +Task : {Prerequisite check, Deleting protected item} +Type : Microsoft.DataReplication/replicationVaults/jobs +``` + +Retrieves a job by the job itself as an input object. + +### Example 4: List by resource group Id and project Id. +```powershell +Get-AzMigrateHCIJob -ResourceGroupID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg" -ProjectID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.Migrate/MigrateProjects/testproj" +``` + +```output +ActivityId : ActivityId: 00000000-0000-0000-0000-000000000000 +AllowedAction : {Cancel} +CustomPropertyAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetails +CustomPropertyInstanceType : WorkflowDetails +DisplayName : Delete protected item +EndTime : +Error : {} +Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication + /replicationVaults/testproj1234replicationvault/jobs/0203aa1b-1dff-4653-89a9-b90a76d1601a +Name : 0203aa1b-1dff-4653-89a9-b90a76d1601a +ObjectId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication + /replicationVaults/testproj1234replicationvault/protectedItems/testsite-0000-0000-00000001 +ObjectInternalId : 13436868-1f4c-5d4e-a252-c666179bf4df +ObjectInternalName : testmachine1 +ObjectName : testsite-0000-0000-00000001 +ObjectType : ProtectedItem +ReplicationProviderId : 0a870516-56c7-4460-998c-f267bd579f16 +SourceFabricProviderId : a2793d98-d4f1-427f-a5a6-2d694f4a1bf7 +StartTime : 8/14/2023 7:09:10 PM +State : Started +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelTags +TargetFabricProviderId : 22f00372-a1b7-467f-87ce-d95e17a6e7c7 +Task : {Prerequisite check, Deleting protected item} +Type : Microsoft.DataReplication/replicationVaults/jobs + +ActivityId : ActivityId: 00000000-0000-0000-0000-000000000000 +AllowedAction : {} +CustomPropertyAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetails +CustomPropertyInstanceType : +DisplayName : Planned failover +EndTime : 8/11/2023 10:09:18 PM +Error : +Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication + /replicationVaults/testproj1234replicationvault/jobs/f2ebb932-fa4a-47a7-b1fa-ff5aa877d5ed +Name : f2ebb932-fa4a-47a7-b1fa-ff5aa877d5ed +ObjectId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication + /replicationVaults/testproj1234replicationvault/protectedItems/testsite-0000-0000-00000000/plannedFailover +ObjectInternalId : 4ef231a3-0774-5e44-8317-bed903d297a2 +ObjectInternalName : testmachine2 +ObjectName : testsite-0000-0000-00000000 +ObjectType : ProtectedItem +ReplicationProviderId : 0a870516-56c7-4460-998c-f267bd579f16 +SourceFabricProviderId : a2793d98-d4f1-427f-a5a6-2d694f4a1bf7 +StartTime : 8/11/2023 9:53:48 PM +State : Succeeded +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelTags +TargetFabricProviderId : 22f00372-a1b7-467f-87ce-d95e17a6e7c7 +Task : +Type : Microsoft.DataReplication/replicationVaults/jobs +``` + +Retrieves all the jobs from a project in some resource group by Ids. + +### Example 5: List by resource group name and project name. +```powershell +Get-AzMigrateHCIJob -ResourceGroupName "test-rg" -ProjectName "testproj" +``` + +```output +ActivityId : ActivityId: 00000000-0000-0000-0000-000000000000 +AllowedAction : {Cancel} +CustomPropertyAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetails +CustomPropertyInstanceType : WorkflowDetails +DisplayName : Delete protected item +EndTime : +Error : {} +Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication + /replicationVaults/testproj1234replicationvault/jobs/0203aa1b-1dff-4653-89a9-b90a76d1601a +Name : 0203aa1b-1dff-4653-89a9-b90a76d1601a +ObjectId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication + /replicationVaults/testproj1234replicationvault/protectedItems/testsite-0000-0000-00000001 +ObjectInternalId : 13436868-1f4c-5d4e-a252-c666179bf4df +ObjectInternalName : testmachine1 +ObjectName : testsite-0000-0000-00000001 +ObjectType : ProtectedItem +ReplicationProviderId : 0a870516-56c7-4460-998c-f267bd579f16 +SourceFabricProviderId : a2793d98-d4f1-427f-a5a6-2d694f4a1bf7 +StartTime : 8/14/2023 7:09:10 PM +State : Started +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelTags +TargetFabricProviderId : 22f00372-a1b7-467f-87ce-d95e17a6e7c7 +Task : {Prerequisite check, Deleting protected item} +Type : Microsoft.DataReplication/replicationVaults/jobs + +ActivityId : ActivityId: 00000000-0000-0000-0000-000000000000 +AllowedAction : {} +CustomPropertyAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetails +CustomPropertyInstanceType : +DisplayName : Planned failover +EndTime : 8/11/2023 10:09:18 PM +Error : +Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication + /replicationVaults/testproj1234replicationvault/jobs/f2ebb932-fa4a-47a7-b1fa-ff5aa877d5ed +Name : f2ebb932-fa4a-47a7-b1fa-ff5aa877d5ed +ObjectId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication + /replicationVaults/testproj1234replicationvault/protectedItems/testsite-0000-0000-00000000/plannedFailover +ObjectInternalId : 4ef231a3-0774-5e44-8317-bed903d297a2 +ObjectInternalName : testmachine2 +ObjectName : testsite-0000-0000-00000000 +ObjectType : ProtectedItem +ReplicationProviderId : 0a870516-56c7-4460-998c-f267bd579f16 +SourceFabricProviderId : a2793d98-d4f1-427f-a5a6-2d694f4a1bf7 +StartTime : 8/11/2023 9:53:48 PM +State : Succeeded +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelTags +TargetFabricProviderId : 22f00372-a1b7-467f-87ce-d95e17a6e7c7 +Task : +Type : Microsoft.DataReplication/replicationVaults/jobs +``` + +Retrieves all the jobs from a project in some resource group by names. + diff --git a/src/Migrate/Migrate.Autorest/examples/Get-AzMigrateHCIReplicationFabric.md b/src/Migrate/Migrate.Autorest/examples/Get-AzMigrateHCIReplicationFabric.md new file mode 100644 index 000000000000..b6e535a4332c --- /dev/null +++ b/src/Migrate/Migrate.Autorest/examples/Get-AzMigrateHCIReplicationFabric.md @@ -0,0 +1,120 @@ +### Example 1: Get by fabric name +```powershell +Get-AzMigrateHCIReplicationFabric -ResourceGroupName "test-rg" -Name "testsrcappreplicationfabric" +``` + +```output +Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationFabrics/testsrcappreplicationfabric +Location : southeastasia +Name : testsrcappreplicationfabric +Property : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelProperties +SystemDataCreatedAt : 8/11/2023 6:39:04 PM +SystemDataCreatedBy : testuser@example.com +SystemDataCreatedByType : User +SystemDataLastModifiedAt : 8/11/2023 6:48:29 PM +SystemDataLastModifiedBy : testuser@example.com +SystemDataLastModifiedByType : User +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelTags +Type : Microsoft.DataReplication/replicationFabrics +``` + +Retrieves a fabric by its name. + +### Example 2: Get by fabric input object +```powershell +$InputObject = Get-AzMigrateHCIReplicationFabric -ResourceGroupName "test-rg" -Name "testsrcappreplicationfabric" + +Get-AzMigrateHCIReplicationFabric -InputObject $InputObject + +$InputObject | Get-AzMigrateHCIReplicationFabric +``` + +```output +Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationFabrics/testsrcappreplicationfabric +Location : southeastasia +Name : testsrcappreplicationfabric +Property : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelProperties +SystemDataCreatedAt : 8/11/2023 6:39:04 PM +SystemDataCreatedBy : testuser@example.com +SystemDataCreatedByType : User +SystemDataLastModifiedAt : 8/11/2023 6:48:29 PM +SystemDataLastModifiedBy : testuser@example.com +SystemDataLastModifiedByType : User +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelTags +Type : Microsoft.DataReplication/replicationFabrics +``` + +Retrieves a fabric by the fabric itself as an input object. + +### Example 3: List by resource group name +```powershell +Get-AzMigrateHCIReplicationFabric -ResourceGroupName "test-rg" +``` + +```output +Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationFabrics/testsrcappreplicationfabric +Location : southeastasia +Name : testsrcappreplicationfabric +Property : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelProperties +SystemDataCreatedAt : 8/11/2023 6:39:04 PM +SystemDataCreatedBy : testuser@example.com +SystemDataCreatedByType : User +SystemDataLastModifiedAt : 8/11/2023 6:48:29 PM +SystemDataLastModifiedBy : testuser@example.com +SystemDataLastModifiedByType : User +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelTags +Type : Microsoft.DataReplication/replicationFabrics + +Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationFabrics/testtgtappreplicationfabric +Location : southeastasia +Name : testtgtappreplicationfabric +Property : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelProperties +SystemDataCreatedAt : 8/11/2023 9:16:46 PM +SystemDataCreatedBy : testuser@example.com +SystemDataCreatedByType : User +SystemDataLastModifiedAt : 8/11/2023 9:16:46 PM +SystemDataLastModifiedBy : testuser@example.com +SystemDataLastModifiedByType : User +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelTags +Type : Microsoft.DataReplication/replicationFabrics +``` + +Retrieves all fabrics from a resource group by name. + +### Example 4: List all fabircs +```powershell +Get-AzMigrateHCIReplicationFabric +``` + +```output +Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationFabrics/testsrcappreplicationfabric +Location : southeastasia +Name : testsrcappreplicationfabric +Property : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelProperties +SystemDataCreatedAt : 8/11/2023 6:39:04 PM +SystemDataCreatedBy : testuser@example.com +SystemDataCreatedByType : User +SystemDataLastModifiedAt : 8/11/2023 6:48:29 PM +SystemDataLastModifiedBy : testuser@example.com +SystemDataLastModifiedByType : User +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelTags +Type : Microsoft.DataReplication/replicationFabrics + +Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationFabrics/testtgtappreplicationfabric +Location : southeastasia +Name : testtgtappreplicationfabric +Property : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelProperties +SystemDataCreatedAt : 8/11/2023 9:16:46 PM +SystemDataCreatedBy : testuser@example.com +SystemDataCreatedByType : User +SystemDataLastModifiedAt : 8/11/2023 9:16:46 PM +SystemDataLastModifiedBy : testuser@example.com +SystemDataLastModifiedByType : User +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelTags +Type : Microsoft.DataReplication/replicationFabrics + +... +``` + +Retrieves all fabrics from a subscription. + diff --git a/src/Migrate/Migrate.Autorest/examples/Get-AzMigrateHCIServerReplication.md b/src/Migrate/Migrate.Autorest/examples/Get-AzMigrateHCIServerReplication.md new file mode 100644 index 000000000000..65bdf09a18c7 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/examples/Get-AzMigrateHCIServerReplication.md @@ -0,0 +1,77 @@ +### Example 1: Get details by id +```powershell +Get-AzMigrateHCIServerReplication -TargetObjectID '/subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/protectedItems/503a4f02-916c-d6b0-8d14-222bbd4767e5' +``` + +```output +Id : /subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/protectedItems/503a4f02-916c-d6b0-8d14-222bbd4767e5 +Name : 503a4f02-916c-d6b0-8d14-222bbd4767e5 +Property : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelProperties +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelTags +Type : Microsoft.DataReplication/replicationVaults/protectedItems +``` + +Get by id. + +### Example 2: Get detail by discovered machine id +```powershell +Get-AzMigrateHCIServerReplication -DiscoveredMachineId "/subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.OffAzure/HyperVSites/siteName1/machines/503a4f02-916c-d6b0-8d14-222bbd4767e5" + +``` + +```output +Id : /subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/protectedItems/503a4f02-916c-d6b0-8d14-222bbd4767e5 +Name : 503a4f02-916c-d6b0-8d14-222bbd4767e5 +Property : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelProperties +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelTags +Type : Microsoft.DataReplication/replicationVaults/protectedItems +``` + +Get by discovered machine id. + +### Example 3: List all in project by name +```powershell +Get-AzMigrateServerReplication -ResourceGroupName testResourceGroup -ProjectName testProjectName +``` + +```output + +Id : /subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/protectedItems/503a4f02-916c-d6b0-8d14-222bbd4767e5 +Name : 503a4f02-916c-d6b0-8d14-222bbd4767e5 +Property : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelProperties +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelTags +Type : Microsoft.DataReplication/replicationVaults/protectedItems + +Id : /subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/protectedItems/d758f4fb-ae5e-4ac8-bb97-1e114555fe9f +Name : d758f4fb-ae5e-4ac8-bb97-1e114555fe9f +Property : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelProperties +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelTags +Type : Microsoft.DataReplication/replicationVaults/protectedItems +``` + +List all. + diff --git a/src/Migrate/Migrate.Autorest/examples/Initialize-AzMigrateHCIReplicationInfrastructure.md b/src/Migrate/Migrate.Autorest/examples/Initialize-AzMigrateHCIReplicationInfrastructure.md new file mode 100644 index 000000000000..85c987e3b80b --- /dev/null +++ b/src/Migrate/Migrate.Autorest/examples/Initialize-AzMigrateHCIReplicationInfrastructure.md @@ -0,0 +1,24 @@ +### Example 1: Initialize AzStackHCI replication infrastructure +```powershell +Initialize-AzMigrateHCIReplicationInfrastructure -ProjectName "testproj" -ResourceGroupName "test-rg" -SourceApplianceName "testsrcapp" -TargetApplianceName "testtgtapp" -PassThru:$true +``` + +```output +$true +``` + +Initialize AzStackHCI replication infrastructure. Cache storage account, replication policy, and replication extension will be created automatically. + +### Example 2: Initialize AzStackHCI replication infrastructure with custom cache storage account +```powershell +$cacheStorageAccountId = "/subscriptions/xxx-xxx-xxxx/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/testSa" + +Initialize-AzMigrateHCIReplicationInfrastructure -ProjectName "testproj" -ResourceGroupName "test-rg" -CacheStorageAccountId $cacheStorageAccountId -SourceApplianceName "testsrcapp" -TargetApplianceName "testtgtapp" -PassThru:$true +``` + +```output +$true +``` + +Initialize AzStackHCI replication infrastructure with custom cache storage account. Replication policy and replication extension will be created automatically. + diff --git a/src/Migrate/Migrate.Autorest/examples/New-AzMigrateHCIDiskMappingObject.md b/src/Migrate/Migrate.Autorest/examples/New-AzMigrateHCIDiskMappingObject.md new file mode 100644 index 000000000000..b0a8a4308257 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/examples/New-AzMigrateHCIDiskMappingObject.md @@ -0,0 +1,15 @@ +### Example 1: Creates Disk to migrate +```powershell +New-AzMigrateHCIDiskMappingObject -DiskID a -IsOSDisk true -IsDynamic true -Size 1 -Format VHDX +``` + +```output +DiskFileFormat : VHDX +DiskId : a +DiskSizeGb : 1 +IsDynamic : True +IsOSDisk : True +StorageContainerId : +``` + +Get disk object to provide input for New-AzMigrateHCIServerReplication diff --git a/src/Migrate/Migrate.Autorest/examples/New-AzMigrateHCINicMappingObject.md b/src/Migrate/Migrate.Autorest/examples/New-AzMigrateHCINicMappingObject.md new file mode 100644 index 000000000000..80b827be203a --- /dev/null +++ b/src/Migrate/Migrate.Autorest/examples/New-AzMigrateHCINicMappingObject.md @@ -0,0 +1,12 @@ +### Example 1: Create NIC to migrate +```powershell +New-AzMigrateHCINicMappingObject -NicID a -TargetVirtualSwitchId "/subscriptions/xxx-xxx-xxx/resourceGroups/hciclus-rg/providers/Microsoft.AzureStackHCI/logicalnetworks/external" +``` + +```output +NicId : a +TargetNetworkId : /subscriptions/xxx-xxx-xxx/resourceGroups/hciclus-rg/providers/Microsoft.AzureStackHCI/logicalnetworks/external +TestNetworkId : /subscriptions/xxx-xxx-xxx/resourceGroups/hciclus-rg/providers/Microsoft.AzureStackHCI/logicalnetworks/external +SelectionTypeForFailover : SelectedByUser +``` +Get NIC object to provide input for New-AzMigrateHCIServerReplication and Set-AzMigrateHCIServerReplication \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/examples/New-AzMigrateHCIServerReplication.md b/src/Migrate/Migrate.Autorest/examples/New-AzMigrateHCIServerReplication.md new file mode 100644 index 000000000000..aa0a5ca63c2c --- /dev/null +++ b/src/Migrate/Migrate.Autorest/examples/New-AzMigrateHCIServerReplication.md @@ -0,0 +1,85 @@ +### Example 1: When there is only OS disk to migrate +```powershell +New-AzMigrateHCIServerReplication -MachineId "/subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.OffAzure/HyperVSites/testsrc7972site/machines/005-005-005" -OSDiskID "Microsoft:0EC082D5-6827-457A-BAE2-F986E1B94851\83F8638B-8DCA-4152-9EDA-2CA8B33039B4\0\0\L" -TargetStoragePathId "/subscriptions/xxx-xxx-xxx/resourceGroups/hciclus-rg/providers/Microsoft.AzureStackHCI/storagecontainers/testStorageContainer1" -TargetVirtualSwitchId "/subscriptions/xxx-xxx-xxx/resourceGroups/hciclus-rg/providers/Microsoft.AzureStackHCI/logicalnetworks/external" -TargetResourceGroupId "/subscriptions//xxx-xxx-xxx/resourceGroups/target-rg"-TargetVMName "targetVM" +``` + +```output +ActivityId : ActivityId: 00000000-0000-0000-0000-000000000000 +AllowedAction : {} +CustomPropertyAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetails +CustomPropertyInstanceType : WorkflowDetails +DisplayName : Create or update protected item +EndTime : 1/1/1900 8:54:47 PM +Error : {} +Id : /subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/jobs/f2d3430a-2977-419f-abd5-11d171e17f5e +Name : f2d3430a-2977-419f-abd5-11d171e17f5e +ObjectId : /subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94555 +ObjectInternalId : a8b5ee68-102c-5aae-9499-c57a475a8fd4 +ObjectInternalName : test_vm +ObjectName : 0ec082d5-6827-457a-bae2-f986e1b94555 +ObjectType : ProtectedItem +ReplicationProviderId : xxx-xxx-xxx +SourceFabricProviderId : b35da11c-d69e-4220-9a90-d81ed93ad2fc +StartTime : 1/1/1900 8:49:27 PM +State : Succeeded +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelTags +TargetFabricProviderId : 22f00372-a1b7-467f-87ce-d95e17a6e7c7 +Task : {Creating or updating the protected item, Initializing Protection, Enabling Protection, Starting Replication} +Type : Microsoft.DataReplication/replicationVaults/jobs +``` + +This is for the scenario, when there is only one single disk that has to be protected. + +### Example 2: When there are multiple disks or NICs to migrate +```powershell +[AzStackHCIDiskInput[]]$DisksToInclude = @() +$OSDisk = New-AzMigrateHCIDiskMappingObject -DiskID "Microsoft:C1A34301-3BFF-4EC6-97F1-6C4BD5ADCDE0\83F8638B-8DCA-4152-9EDA-2CA8B33039B4\0\0\L" -IsOSDisk true -IsDynamic true -Size 42 -Format VHD +$DataDisk = New-AzMigrateHCIDiskMappingObject -DiskID "Microsoft:C1A34301-3BFF-4EC6-97F1-6C4BD5ADCDE0\C92FAB89-DA8B-47E9-92F3-364642ECDF39\0\0\L" -IsOSDisk false -IsDynamic true -Size 5 -Format VHD +$DisksToInclude += $OSDisk +$DisksToInclude += $DataDisk + +[AzStackHCINicInput[]]$NicsToInclude = @() +$Nic = New-AzMigrateHCINicMappingObject -NicID "Microsoft:C1A34301-3BFF-4EC6-97F1-6C4BD5ADCDE0\99CDFD2E-D60C-4218-AC2E-E7C2D8253EB9" -TargetVirtualSwitchId "/subscriptions/xxx-xxx-xxx/resourceGroups/hciclus-rg/providers/Microsoft.AzureStackHCI/logicalnetworks/external" +$NicsToInclude += $Nic + +New-AzMigrateHCIServerReplication -MachineId "/subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.OffAzure/HyperVSites/testsrc7972site/machines/005-005-005" -TargetStoragePathId "/subscriptions/xxx-xxx-xxx/resourceGroups/hciclus-rg/providers/Microsoft.AzureStackHCI/storagecontainers/testStorageContainer1" -TargetResourceGroupId "/subscriptions//xxx-xxx-xxx/resourceGroups/target-rg"-TargetVMName "targetVM" -DiskToInclude $DisksToInclude -NicToInclude $NicsToInclude +``` + +```output +ActivityId : ActivityId: 00000000-0000-0000-0000-000000000000 +AllowedAction : {} +CustomPropertyAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetails +CustomPropertyInstanceType : WorkflowDetails +DisplayName : Create or update protected item +EndTime : 1/1/1900 2:27:14 PM +Error : {} +Id : /subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/jobs/f855305c-5bed-4bc6-996e-d273115ab833 +Name : f855305c-5bed-4bc6-996e-d273115ab833 +ObjectId : /subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/protectedItems/c1a34301-3bff-4ec6-97f1-6c4bd5adcde0 +ObjectInternalId : a40ecd8e-6413-574d-b1f8-2ef925e087fc +ObjectInternalName : test_vm +ObjectName : c1a34301-3bff-4ec6-97f1-6c4bd5adcde0 +ObjectType : ProtectedItem +ReplicationProviderId : 4de0fddc-bdfe-40d9-b60e-678bdce89630 +SourceFabricProviderId : b35da11c-d69e-4220-9a90-d81ed93ad2fc +StartTime : 1/1/1900 2:21:50 PM +State : Succeeded +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelTags +TargetFabricProviderId : 22f00372-a1b7-467f-87ce-d95e17a6e7c7 +Task : {Creating or updating the protected item, Initializing Protection, Enabling Protection, Starting Replication} +Type : Microsoft.DataReplication/replicationVaults/jobs +``` + +This is for the scenario, when there are multiple disks that has to be protected. \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/examples/Remove-AzMigrateHCIServerReplication.md b/src/Migrate/Migrate.Autorest/examples/Remove-AzMigrateHCIServerReplication.md new file mode 100644 index 000000000000..350684702d94 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/examples/Remove-AzMigrateHCIServerReplication.md @@ -0,0 +1,80 @@ +### Example 1: Remove replication by Id +```powershell +Remove-AzMigrateHCIServerReplication -TargetObjectID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851" +``` + +```output +ActivityId : ActivityId: 00000000-0000-0000-0000-000000000000 +AllowedAction : {Cancel} +CustomPropertyAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetails +CustomPropertyInstanceType : WorkflowDetails +DisplayName : Delete protected item +EndTime : +Error : {} +Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/jobs/2b0b356e-d106-43af-ad26-02631fcaebba +Name : 2b0b356e-d106-43af-ad26-02631fcaebba +ObjectId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/protectedItems/c1a34301-3bff-4ec6-97f1-6c4bd5adcde0 +ObjectInternalId : a40ecd8e-6413-574d-b1f8-2ef925e087fc +ObjectInternalName : testmachine +ObjectName : c1a34301-3bff-4ec6-97f1-6c4bd5adcde0 +ObjectType : ProtectedItem +ReplicationProviderId : 4de0fddc-bdfe-40d9-b60e-678bdce89630 +SourceFabricProviderId : b35da11c-d69e-4220-9a90-d81ed93ad2fc +StartTime : 7/25/2023 10:14:42 PM +State : Started +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelTags +TargetFabricProviderId : 22f00372-a1b7-467f-87ce-d95e17a6e7c7 +Task : {Prerequisite check, Deleting protected item} +Type : Microsoft.DataReplication/replicationVaults/jobs +``` + +Remove AzStackHCI replication by Id. + +### Example 2: Remove replication by input object +```powershell +$InputObject = Get-AzMigrateHCIServerReplication -TargetObjectID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851" + +Remove-AzMigrateHCIServerReplication -InputObject $InputObject + +$InputObject | Remove-AzMigrateHCIServerReplication +``` + +```output +ActivityId : ActivityId: 00000000-0000-0000-0000-000000000000 +AllowedAction : {Cancel} +CustomPropertyAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetails +CustomPropertyInstanceType : WorkflowDetails +DisplayName : Delete protected item +EndTime : +Error : {} +Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/jobs/2b0b356e-d106-43af-ad26-02631fcaebba +Name : 2b0b356e-d106-43af-ad26-02631fcaebba +ObjectId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/protectedItems/c1a34301-3bff-4ec6-97f1-6c4bd5adcde0 +ObjectInternalId : a40ecd8e-6413-574d-b1f8-2ef925e087fc +ObjectInternalName : testmachine +ObjectName : c1a34301-3bff-4ec6-97f1-6c4bd5adcde0 +ObjectType : ProtectedItem +ReplicationProviderId : 4de0fddc-bdfe-40d9-b60e-678bdce89630 +SourceFabricProviderId : b35da11c-d69e-4220-9a90-d81ed93ad2fc +StartTime : 7/25/2023 10:14:42 PM +State : Started +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelTags +TargetFabricProviderId : 22f00372-a1b7-467f-87ce-d95e17a6e7c7 +Task : {Prerequisite check, Deleting protected item} +Type : Microsoft.DataReplication/replicationVaults/jobs +``` + +Remove AzStackHCI replication by replication input object. + diff --git a/src/Migrate/Migrate.Autorest/examples/Set-AzMigrateHCIServerReplication.md b/src/Migrate/Migrate.Autorest/examples/Set-AzMigrateHCIServerReplication.md new file mode 100644 index 000000000000..3d98be732f89 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/examples/Set-AzMigrateHCIServerReplication.md @@ -0,0 +1,81 @@ +### Example 1: Update target VM name +```powershell +Set-AzMigrateHCIServerReplication -TargetObjectID '/subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/protectedItems/503a4f02-916c-d6b0-8d14-222bbd4767e5' -TargetVMName "targetName1" +``` + +```output +ActivityId : ActivityId: 00000000-0000-0000-0000-000000000000 +AllowedAction : {} +CustomPropertyAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetails +CustomPropertyInstanceType : WorkflowDetails +DisplayName : Create or update protected item +EndTime : 1/1/1900 8:54:47 PM +Error : {} +Id : /subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/jobs/f2d3430a-2977-419f-abd5-11d171e17f5e +Name : f2d3430a-2977-419f-abd5-11d171e17f5e +ObjectId : /subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94555 +ObjectInternalId : a8b5ee68-102c-5aae-9499-c57a475a8fd4 +ObjectInternalName : test_vm +ObjectName : 0ec082d5-6827-457a-bae2-f986e1b94555 +ObjectType : ProtectedItem +ReplicationProviderId : xxx-xxx-xxx +SourceFabricProviderId : b35da11c-d69e-4220-9a90-d81ed93ad2fc +StartTime : 1/1/1900 8:49:27 PM +State : Succeeded +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelTags +TargetFabricProviderId : 22f00372-a1b7-467f-87ce-d95e17a6e7c7 +Task : {Creating or updating the protected item, Initializing Protection, Enabling Protection, Starting Replication} +Type : Microsoft.DataReplication/replicationVaults/jobs +``` + +Update target VM name + +### Example 2: Update dynamic memory configuration +```powershell +$memoryConfig = [PSCustomObject]@{ + MinimumMemoryInMegaByte = 1024 + MaximumMemoryInMegaByte = 34816 + TargetMemoryBufferPercentage = 20 +} + +Set-AzMigrateHCIServerReplication -TargetObjectID '/subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/protectedItems/503a4f02-916c-d6b0-8d14-222bbd4767e5' -DynamicMemoryConfig $memoryConfig +``` + +```output +ActivityId : ActivityId: 00000000-0000-0000-0000-000000000000 +AllowedAction : {} +CustomPropertyAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetails +CustomPropertyInstanceType : WorkflowDetails +DisplayName : Create or update protected item +EndTime : 1/1/1900 8:54:47 PM +Error : {} +Id : /subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/jobs/f2d3430a-2977-419f-abd5-11d171e17f5e +Name : f2d3430a-2977-419f-abd5-11d171e17f5e +ObjectId : /subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94555 +ObjectInternalId : a8b5ee68-102c-5aae-9499-c57a475a8fd4 +ObjectInternalName : test_vm +ObjectName : 0ec082d5-6827-457a-bae2-f986e1b94555 +ObjectType : ProtectedItem +ReplicationProviderId : xxx-xxx-xxx +SourceFabricProviderId : b35da11c-d69e-4220-9a90-d81ed93ad2fc +StartTime : 1/1/1900 8:49:27 PM +State : Succeeded +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelTags +TargetFabricProviderId : 22f00372-a1b7-467f-87ce-d95e17a6e7c7 +Task : {Creating or updating the protected item, Initializing Protection, Enabling Protection, Starting Replication} +Type : Microsoft.DataReplication/replicationVaults/jobs +``` + +Update dynamic memory configuration. \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/examples/Start-AzMigrateHCIServerMigration.md b/src/Migrate/Migrate.Autorest/examples/Start-AzMigrateHCIServerMigration.md new file mode 100644 index 000000000000..58fcc3abc477 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/examples/Start-AzMigrateHCIServerMigration.md @@ -0,0 +1,94 @@ +### Example 1: Start migration by Id +```powershell +Start-AzMigrateHCIServerMigration -TargetObjectID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851" +``` + +```output +ActivityId : ActivityId: 00000000-0000-0000-0000-000000000000 +AllowedAction : {Cancel} +CustomPropertyAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api2021 + 0216Preview.WorkflowModelCustomPropertiesAffectedObjectDe + tails +CustomPropertyInstanceType : FailoverWorkflowDetails +DisplayName : Planned failover +EndTime : +Error : {} +Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication + /replicationVaults/testproj1234replicationvault/jobs/af0e1bf6-e3e6-482c-8345-b1a06d87af96 +Name : af0e1bf6-e3e6-482c-8345-b1a06d87af96 +ObjectId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication + /replicationVaults/testproj1234replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851/plannedFai + lover +ObjectInternalId : a8b5ee68-102c-5aae-9499-c57a475a8fc4 +ObjectInternalName : testmachine +ObjectName : 0ec082d5-6827-457a-bae2-f986e1b94851 +ObjectType : ProtectedItem +ReplicationProviderId : 4de0fddc-bdfe-40d9-b60e-678bdce89630 +SourceFabricProviderId : b35da11c-d69e-4220-9a90-d81ed93ad2fc +StartTime : 8/1/2023 12:42:19 AM +State : Started +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api2021 + 0216Preview.WorkflowModelTags +TargetFabricProviderId : 22f00372-a1b7-467f-87ce-d95e17a6e7c7 +Task : {Prerequisite check, Turning off resource on primary, + Starting failover, Preparing protected entities...} +Type : Microsoft.DataReplication/replicationVaults/jobs +``` + +Start AzStackHCI server migration by Id. + +### Example 2: Start migration by input object +```powershell +$InputObject = Get-AzMigrateHCIServerReplication -TargetObjectID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851" + +Start-AzMigrateHCIServerMigration -InputObject $InputObject + +$InputObject | Start-AzMigrateHCIServerMigration +``` + +```output +ActivityId : ActivityId: 00000000-0000-0000-0000-000000000000 +AllowedAction : {Cancel} +CustomPropertyAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api2021 + 0216Preview.WorkflowModelCustomPropertiesAffectedObjectDe + tails +CustomPropertyInstanceType : FailoverWorkflowDetails +DisplayName : Planned failover +EndTime : +Error : {} +Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication + /replicationVaults/testproj1234replicationvault/jobs/af0e1bf6-e3e6-482c-8345-b1a06d87af96 +Name : af0e1bf6-e3e6-482c-8345-b1a06d87af96 +ObjectId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication + /replicationVaults/testproj1234replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851/plannedFai + lover +ObjectInternalId : a8b5ee68-102c-5aae-9499-c57a475a8fc4 +ObjectInternalName : testmachine +ObjectName : 0ec082d5-6827-457a-bae2-f986e1b94851 +ObjectType : ProtectedItem +ReplicationProviderId : 4de0fddc-bdfe-40d9-b60e-678bdce89630 +SourceFabricProviderId : b35da11c-d69e-4220-9a90-d81ed93ad2fc +StartTime : 8/1/2023 12:42:19 AM +State : Started +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api2021 + 0216Preview.WorkflowModelTags +TargetFabricProviderId : 22f00372-a1b7-467f-87ce-d95e17a6e7c7 +Task : {Prerequisite check, Turning off resource on primary, + Starting failover, Preparing protected entities...} +Type : Microsoft.DataReplication/replicationVaults/jobs +``` + +Start AzStackHCI server migration by replication input object. + diff --git a/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateDiscoveredServer.ps1 b/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateDiscoveredServer.ps1 index 76eee6f9c4ce..088fdb4113ef 100644 --- a/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateDiscoveredServer.ps1 +++ b/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateDiscoveredServer.ps1 @@ -31,14 +31,18 @@ Get-AzMigrateDiscoveredServer -Name idclab-a360-fareast-corp-micros-86617dcf-eff Get-AzMigrateDiscoveredServer -SubscriptionId xxx-xxx-xxx -ResourceGroupName BugBashAVSVMware -ProjectName BugBashAVSVMware -DisplayName Contoso | Format-Table DisplayName,Name,Type .Example Get-AzMigrateDiscoveredServer -SubscriptionId xxx-xxx-xxx -ResourceGroupName BugBashAVSVMware -ProjectName BugBashAVSVMware -ApplianceName BBVMwareAVS -DisplayName Contoso | Format-Table DisplayName,Name,Type +.Example +Get-AzMigrateDiscoveredServer -SubscriptionId xxx-xxx-xxx -ResourceGroupName "test-rg" -ProjectName "testproj" -SourceMachineType "HyperV" | Format-Table DisplayName,Name,Type +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVMachine .Outputs Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVMwareMachine .Link https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratediscoveredserver #> function Get-AzMigrateDiscoveredServer { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVMwareMachine])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVMwareMachine], [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVMachine])] [CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(Mandatory)] @@ -57,9 +61,17 @@ param( [Parameter(ParameterSetName='ListInSite')] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [System.String] - # Specifies the VMware machine display name. + # Specifies the source machine display name. ${DisplayName}, + [Parameter()] + [ArgumentCompleter({ "VMware", "HyperV" })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the source machine type. + # Currently, only HyperV and VMware are supported. + ${SourceMachineType}, + [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] @@ -71,7 +83,7 @@ param( [Parameter(ParameterSetName='Get', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [System.String] - # Specifies the VMware machine name. + # Specifies the source machine name. # This is an internal Name. # For users, use display name. ${Name}, @@ -121,6 +133,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) diff --git a/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateHCIJob.ps1 b/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateHCIJob.ps1 new file mode 100644 index 000000000000..f4fa8e862ee6 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateHCIJob.ps1 @@ -0,0 +1,282 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Retrieves the status of an Azure Migrate job. +.Description +The Get-AzMigrateHCIJob cmdlet retrives the status of an Azure Migrate job. +.Example +Get-AzMigrateHCIJob -ID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/jobs/0203aa1b-1dff-4653-89a9-b90a76d1601a" +.Example +Get-AzMigrateHCIJob -ResourceGroupName "test-rg" -ProjectName "testproj" -Name "0203aa1b-1dff-4653-89a9-b90a76d1601a" +.Example +$InputObject = Get-AzMigrateHCIJob -ID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/jobs/0203aa1b-1dff-4653-89a9-b90a76d1601a" + +Get-AzMigrateHCIJob -InputObject $InputObject + +$InputObject | Get-AzMigrateHCIJob +.Example +Get-AzMigrateHCIJob -ResourceGroupID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg" -ProjectID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.Migrate/MigrateProjects/testproj" +.Example +Get-AzMigrateHCIJob -ResourceGroupName "test-rg" -ProjectName "testproj" + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel +.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 : Specifies the job object of the replicating server. + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratehcijob +#> +function Get-AzMigrateHCIJob { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel])] +[CmdletBinding(DefaultParameterSetName='ListByName', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='ListByName', Mandatory)] + [Parameter(ParameterSetName='GetByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='ListByName', Mandatory)] + [Parameter(ParameterSetName='GetByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the migrate project. + ${ProjectName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure Subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetById', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the job id for which the details needs to be retrieved. + ${ID}, + + [Parameter(ParameterSetName='GetByName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Job identifier + ${Name}, + + [Parameter(ParameterSetName='GetByInputObject', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # Specifies the job object of the replicating server. + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='ListById', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the Resource Group of the Azure Migrate Project in the current subscription. + ${ResourceGroupID}, + + [Parameter(ParameterSetName='ListById', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the Azure Migrate Project in which servers are replicating. + ${ProjectID}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + ListByName = 'Az.Migrate.custom\Get-AzMigrateHCIJob'; + GetById = 'Az.Migrate.custom\Get-AzMigrateHCIJob'; + GetByName = 'Az.Migrate.custom\Get-AzMigrateHCIJob'; + GetByInputObject = 'Az.Migrate.custom\Get-AzMigrateHCIJob'; + ListById = 'Az.Migrate.custom\Get-AzMigrateHCIJob'; + } + if (('ListByName', 'GetById', 'GetByName', 'GetByInputObject', 'ListById') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $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.Migrate.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/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateHCIReplicationFabric.ps1 b/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateHCIReplicationFabric.ps1 new file mode 100644 index 000000000000..d62fdcde7819 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateHCIReplicationFabric.ps1 @@ -0,0 +1,266 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# 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. +# 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 fabric. +.Description +Gets the details of the fabric. +.Example +Get-AzMigrateHCIReplicationFabric -ResourceGroupName "test-rg" -Name "testsrcappreplicationfabric" +.Example +$InputObject = Get-AzMigrateHCIReplicationFabric -ResourceGroupName "test-rg" -Name "testsrcappreplicationfabric" + +Get-AzMigrateHCIReplicationFabric -InputObject $InputObject + +$InputObject | Get-AzMigrateHCIReplicationFabric +.Example +Get-AzMigrateHCIReplicationFabric -ResourceGroupName "test-rg" +.Example +Get-AzMigrateHCIReplicationFabric + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModel +.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 + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratehcireplicationfabric +#> +function Get-AzMigrateHCIReplicationFabric { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModel])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('FabricName')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The fabric name. + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure Subscription Id in which migrate project was created. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # 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.Migrate.Category('Query')] + [System.String] + # Continuation token from the previous call. + ${ContinuationToken}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.private\Get-AzMigrateHCIReplicationFabric_Get'; + GetViaIdentity = 'Az.Migrate.private\Get-AzMigrateHCIReplicationFabric_GetViaIdentity'; + List = 'Az.Migrate.private\Get-AzMigrateHCIReplicationFabric_List'; + List1 = 'Az.Migrate.private\Get-AzMigrateHCIReplicationFabric_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.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $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.Migrate.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/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateHCIServerReplication.ps1 b/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateHCIServerReplication.ps1 new file mode 100644 index 000000000000..e17c6eccf699 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateHCIServerReplication.ps1 @@ -0,0 +1,282 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Retrieves the details of the replicating server. +.Description +The Get-AzMigrateHCIServerReplication cmdlet retrieves the object for the replicating server. +.Example +Get-AzMigrateHCIServerReplication -TargetObjectID '/subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/protectedItems/503a4f02-916c-d6b0-8d14-222bbd4767e5' +.Example +Get-AzMigrateHCIServerReplication -DiscoveredMachineId "/subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.OffAzure/HyperVSites/siteName1/machines/503a4f02-916c-d6b0-8d14-222bbd4767e5" + +.Example +Get-AzMigrateServerReplication -ResourceGroupName testResourceGroup -ProjectName testProjectName + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel +.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 : Specifies the machine object of the replicating server. + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratehciserverreplication +#> +function Get-AzMigrateHCIServerReplication { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel])] +[CmdletBinding(DefaultParameterSetName='ListByName', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='ListByName', Mandatory)] + [Parameter(ParameterSetName='GetByMachineName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the Resource Group of the Azure Migrate Project in the current subscription. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='ListByName', Mandatory)] + [Parameter(ParameterSetName='GetByMachineName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the Azure Migrate project in the current subscription. + ${ProjectName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure Subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetByItemID', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the replicating server ARM ID. + ${TargetObjectID}, + + [Parameter(ParameterSetName='GetByMachineName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the display name of the replicating machine. + ${MachineName}, + + [Parameter(ParameterSetName='GetBySDSID', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the machine ID of the discovered server. + ${DiscoveredMachineId}, + + [Parameter(ParameterSetName='GetByInputObject', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # Specifies the machine object of the replicating server. + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='ListById', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the Resource Group of the Azure Migrate Project in the current subscription. + ${ResourceGroupID}, + + [Parameter(ParameterSetName='ListById', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the Azure Migrate Project in which servers are replicating. + ${ProjectID}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + ListByName = 'Az.Migrate.custom\Get-AzMigrateHCIServerReplication'; + GetByItemID = 'Az.Migrate.custom\Get-AzMigrateHCIServerReplication'; + GetByMachineName = 'Az.Migrate.custom\Get-AzMigrateHCIServerReplication'; + GetBySDSID = 'Az.Migrate.custom\Get-AzMigrateHCIServerReplication'; + GetByInputObject = 'Az.Migrate.custom\Get-AzMigrateHCIServerReplication'; + ListById = 'Az.Migrate.custom\Get-AzMigrateHCIServerReplication'; + } + if (('ListByName', 'GetByItemID', 'GetByMachineName', 'GetBySDSID', 'GetByInputObject', 'ListById') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $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.Migrate.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/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateJob.ps1 b/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateJob.ps1 index 4986390747c7..4b774b830749 100644 --- a/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateJob.ps1 +++ b/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateJob.ps1 @@ -228,6 +228,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) diff --git a/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateProject.ps1 b/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateProject.ps1 index fcbeb3fa4796..9d3687679696 100644 --- a/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateProject.ps1 +++ b/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateProject.ps1 @@ -133,6 +133,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) diff --git a/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateReplicationFabric.ps1 b/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateReplicationFabric.ps1 index 35df6abe983d..ca146dfc2f75 100644 --- a/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateReplicationFabric.ps1 +++ b/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateReplicationFabric.ps1 @@ -147,6 +147,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) diff --git a/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateReplicationPolicy.ps1 b/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateReplicationPolicy.ps1 index d11dfeabc051..ff3d83cebb58 100644 --- a/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateReplicationPolicy.ps1 +++ b/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateReplicationPolicy.ps1 @@ -141,6 +141,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) diff --git a/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateReplicationProtectionContainer.ps1 b/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateReplicationProtectionContainer.ps1 index beb84aebc12a..531deb66c2fb 100644 --- a/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateReplicationProtectionContainer.ps1 +++ b/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateReplicationProtectionContainer.ps1 @@ -149,6 +149,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) diff --git a/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateReplicationProtectionContainerMapping.ps1 b/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateReplicationProtectionContainerMapping.ps1 index ada3ecdb3188..e87926c41108 100644 --- a/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateReplicationProtectionContainerMapping.ps1 +++ b/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateReplicationProtectionContainerMapping.ps1 @@ -154,6 +154,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) diff --git a/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateReplicationRecoveryServicesProvider.ps1 b/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateReplicationRecoveryServicesProvider.ps1 index ba328d3565b0..a57d42d0c6a8 100644 --- a/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateReplicationRecoveryServicesProvider.ps1 +++ b/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateReplicationRecoveryServicesProvider.ps1 @@ -145,6 +145,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) diff --git a/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateRunAsAccount.ps1 b/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateRunAsAccount.ps1 index 437f2e73befa..5d81e23cf87b 100644 --- a/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateRunAsAccount.ps1 +++ b/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateRunAsAccount.ps1 @@ -142,6 +142,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) diff --git a/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateServerReplication.ps1 b/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateServerReplication.ps1 index 6d96893fcd0b..24ee7e808008 100644 --- a/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateServerReplication.ps1 +++ b/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateServerReplication.ps1 @@ -202,6 +202,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) diff --git a/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateSite.ps1 b/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateSite.ps1 index eb3d440946ee..d96debd94796 100644 --- a/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateSite.ps1 +++ b/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateSite.ps1 @@ -134,6 +134,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) diff --git a/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateSolution.ps1 b/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateSolution.ps1 index 920dee4f9106..0c0d3cfb70ec 100644 --- a/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateSolution.ps1 +++ b/src/Migrate/Migrate.Autorest/exports/Get-AzMigrateSolution.ps1 @@ -139,6 +139,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) diff --git a/src/Migrate/Migrate.Autorest/exports/Initialize-AzMigrateHCIReplicationInfrastructure.ps1 b/src/Migrate/Migrate.Autorest/exports/Initialize-AzMigrateHCIReplicationInfrastructure.ps1 new file mode 100644 index 000000000000..a1e03d869a65 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/exports/Initialize-AzMigrateHCIReplicationInfrastructure.ps1 @@ -0,0 +1,210 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Initializes the infrastructure for the migrate project. +.Description +The Initialize-AzMigrateHCIReplicationInfrastructure cmdlet initializes the infrastructure for the migrate project in AzStackHCI scenario. +.Example +Initialize-AzMigrateHCIReplicationInfrastructure -ProjectName "testproj" -ResourceGroupName "test-rg" -SourceApplianceName "testsrcapp" -TargetApplianceName "testtgtapp" -PassThru:$true +.Example +$cacheStorageAccountId = "/subscriptions/xxx-xxx-xxxx/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/testSa" + +Initialize-AzMigrateHCIReplicationInfrastructure -ProjectName "testproj" -ResourceGroupName "test-rg" -CacheStorageAccountId $cacheStorageAccountId -SourceApplianceName "testsrcapp" -TargetApplianceName "testtgtapp" -PassThru:$true + +.Outputs +System.Boolean +.Link +https://learn.microsoft.com/powershell/module/az.migrate/initialize-azmigratehcireplicationinfrastructure +#> +function Initialize-AzMigrateHCIReplicationInfrastructure { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='AzStackHCI', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the Resource Group of the Azure Migrate Project in the current subscription. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the name of the Azure Migrate project to be used for server migration. + ${ProjectName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the source appliance name for the AzStackHCI scenario. + ${SourceApplianceName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the target appliance name for the AzStackHCI scenario. + ${TargetApplianceName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the Storage Account ARM Id to be used for private endpoint scenario. + ${CacheStorageAccountId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure Subscription ID. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + AzStackHCI = 'Az.Migrate.custom\Initialize-AzMigrateHCIReplicationInfrastructure'; + } + if (('AzStackHCI') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $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.Migrate.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/src/Migrate/Migrate.Autorest/exports/Initialize-AzMigrateReplicationInfrastructure.ps1 b/src/Migrate/Migrate.Autorest/exports/Initialize-AzMigrateReplicationInfrastructure.ps1 index 7031a582b514..89c822d7f8f5 100644 --- a/src/Migrate/Migrate.Autorest/exports/Initialize-AzMigrateReplicationInfrastructure.ps1 +++ b/src/Migrate/Migrate.Autorest/exports/Initialize-AzMigrateReplicationInfrastructure.ps1 @@ -155,6 +155,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) diff --git a/src/Migrate/Migrate.Autorest/exports/New-AzMigrateDiskMapping.ps1 b/src/Migrate/Migrate.Autorest/exports/New-AzMigrateDiskMapping.ps1 index a0266dab0bbd..7f2124ac4ec0 100644 --- a/src/Migrate/Migrate.Autorest/exports/New-AzMigrateDiskMapping.ps1 +++ b/src/Migrate/Migrate.Autorest/exports/New-AzMigrateDiskMapping.ps1 @@ -88,6 +88,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) diff --git a/src/Migrate/Migrate.Autorest/exports/New-AzMigrateHCIDiskMappingObject.ps1 b/src/Migrate/Migrate.Autorest/exports/New-AzMigrateHCIDiskMappingObject.ps1 new file mode 100644 index 000000000000..7235b3511cc2 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/exports/New-AzMigrateHCIDiskMappingObject.ps1 @@ -0,0 +1,144 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Creates a new disk mapping +.Description +The New-AzMigrateHCIDiskMappingObject cmdlet creates a mapping of the source disk attached to the server to be migrated +.Example +New-AzMigrateHCIDiskMappingObject -DiskID a -IsOSDisk true -IsDynamic true -Size 1 -Format VHDX + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHCIDiskInput +.Link +https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratehcidiskmappingobject +#> +function New-AzMigrateHCIDiskMappingObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHCIDiskInput])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the disk ID of the disk attached to the discovered server to be migrated. + ${DiskID}, + + [Parameter(Mandatory)] + [ArgumentCompleter({ "true" , "false" })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies whether the disk contains the Operating System for the source server to be migrated. + ${IsOSDisk}, + + [Parameter(Mandatory)] + [ArgumentCompleter({ "true" , "false" })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies whether the disk is dynamic. + ${IsDynamic}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.Int64] + # Specifies the disk size in GB. + ${Size}, + + [Parameter(Mandatory)] + [ArgumentCompleter({ "VHD", "VHDX" })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the disk format. + ${Format} +) + +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 = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + __AllParameterSets = 'Az.Migrate.custom\New-AzMigrateHCIDiskMappingObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $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.Migrate.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/src/Migrate/Migrate.Autorest/exports/New-AzMigrateHCINicMappingObject.ps1 b/src/Migrate/Migrate.Autorest/exports/New-AzMigrateHCINicMappingObject.ps1 new file mode 100644 index 000000000000..bda8c1625b52 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/exports/New-AzMigrateHCINicMappingObject.ps1 @@ -0,0 +1,137 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Creates an object to update NIC properties of a replicating server. +.Description +The New-AzMigrateHCINicMappingObject cmdlet creates a mapping of the source NIC attached to the server to be migrated. +This object is provided as an input to the Set-AzMigrateServerReplication cmdlet to update the NIC and its properties for a replicating server. +.Example +New-AzMigrateHCINicMappingObject -NicID a -TargetVirtualSwitchId "/subscriptions/xxx-xxx-xxx/resourceGroups/hciclus-rg/providers/Microsoft.AzureStackHCI/logicalnetworks/external" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHCINicInput +.Link +https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratehcinicmappingobject +#> +function New-AzMigrateHCINicMappingObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHCINicInput])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the ID of the NIC to be updated. + ${NicID}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the logical network ARM ID that the VMs will use. + ${TargetVirtualSwitchId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the test logical network ARM ID that the VMs will use. + ${TargetTestVirtualSwitchId}, + + [Parameter()] + [ArgumentCompleter({ "true" , "false" })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies whether the this Nic should be created at target. + ${CreateAtTarget} +) + +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 = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + __AllParameterSets = 'Az.Migrate.custom\New-AzMigrateHCINicMappingObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $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.Migrate.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/src/Migrate/Migrate.Autorest/exports/New-AzMigrateHCIServerReplication.ps1 b/src/Migrate/Migrate.Autorest/exports/New-AzMigrateHCIServerReplication.ps1 new file mode 100644 index 000000000000..5056dc9631dd --- /dev/null +++ b/src/Migrate/Migrate.Autorest/exports/New-AzMigrateHCIServerReplication.ps1 @@ -0,0 +1,254 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Starts replication for the specified server. +.Description +The New-AzMigrateHCIServerReplication cmdlet starts the replication for a particular discovered server in the Azure Migrate project. +.Example +New-AzMigrateHCIServerReplication -MachineId "/subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.OffAzure/HyperVSites/testsrc7972site/machines/005-005-005" -OSDiskID "Microsoft:0EC082D5-6827-457A-BAE2-F986E1B94851\83F8638B-8DCA-4152-9EDA-2CA8B33039B4\0\0\L" -TargetStoragePathId "/subscriptions/xxx-xxx-xxx/resourceGroups/hciclus-rg/providers/Microsoft.AzureStackHCI/storagecontainers/testStorageContainer1" -TargetVirtualSwitchId "/subscriptions/xxx-xxx-xxx/resourceGroups/hciclus-rg/providers/Microsoft.AzureStackHCI/logicalnetworks/external" -TargetResourceGroupId "/subscriptions//xxx-xxx-xxx/resourceGroups/target-rg"-TargetVMName "targetVM" +.Example +[AzStackHCIDiskInput[]]$DisksToInclude = @() +$OSDisk = New-AzMigrateHCIDiskMappingObject -DiskID "Microsoft:C1A34301-3BFF-4EC6-97F1-6C4BD5ADCDE0\83F8638B-8DCA-4152-9EDA-2CA8B33039B4\0\0\L" -IsOSDisk true -IsDynamic true -Size 42 -Format VHD +$DataDisk = New-AzMigrateHCIDiskMappingObject -DiskID "Microsoft:C1A34301-3BFF-4EC6-97F1-6C4BD5ADCDE0\C92FAB89-DA8B-47E9-92F3-364642ECDF39\0\0\L" -IsOSDisk false -IsDynamic true -Size 5 -Format VHD +$DisksToInclude += $OSDisk +$DisksToInclude += $DataDisk + +[AzStackHCINicInput[]]$NicsToInclude = @() +$Nic = New-AzMigrateHCINicMappingObject -NicID "Microsoft:C1A34301-3BFF-4EC6-97F1-6C4BD5ADCDE0\99CDFD2E-D60C-4218-AC2E-E7C2D8253EB9" -TargetVirtualSwitchId "/subscriptions/xxx-xxx-xxx/resourceGroups/hciclus-rg/providers/Microsoft.AzureStackHCI/logicalnetworks/external" +$NicsToInclude += $Nic + +New-AzMigrateHCIServerReplication -MachineId "/subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.OffAzure/HyperVSites/testsrc7972site/machines/005-005-005" -TargetStoragePathId "/subscriptions/xxx-xxx-xxx/resourceGroups/hciclus-rg/providers/Microsoft.AzureStackHCI/storagecontainers/testStorageContainer1" -TargetResourceGroupId "/subscriptions//xxx-xxx-xxx/resourceGroups/target-rg"-TargetVMName "targetVM" -DiskToInclude $DisksToInclude -NicToInclude $NicsToInclude + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel +.Link +https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratehciserverreplication +#> +function New-AzMigrateHCIServerReplication { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel])] +[CmdletBinding(DefaultParameterSetName='ByIdDefaultUser', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the machine ARM ID of the discovered server to be migrated. + ${MachineId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the storage path ARM ID where the VMs will be stored. + ${TargetStoragePathId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the target Resource Group Id where the migrated VM resources will reside. + ${TargetResourceGroupId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the name of the VM to be created. + ${TargetVMName}, + + [Parameter(ParameterSetName='ByIdDefaultUser', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the logical network ARM ID that the VMs will use. + ${TargetVirtualSwitchId}, + + [Parameter(ParameterSetName='ByIdDefaultUser', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the Operating System disk for the source server to be migrated. + ${OSDiskID}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.Int32] + # Specifies the number of CPU cores. + ${TargetVMCPUCore}, + + [Parameter(ParameterSetName='ByIdDefaultUser')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the test logical network ARM ID that the VMs will use. + ${TargetTestVirtualSwitchId}, + + [Parameter()] + [ArgumentCompleter({ "true" , "false" })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies if RAM is dynamic or not. + ${IsDynamicMemoryEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.Int64] + # Specifies the target RAM size in MB. + ${TargetVMRam}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure Subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByIdPowerUser', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHCIDiskInput[]] + # Specifies the disks on the source server to be included for replication. + ${DiskToInclude}, + + [Parameter(ParameterSetName='ByIdPowerUser', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHCINicInput[]] + # Specifies the NICs on the source server to be included for replication. + ${NicToInclude}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + ByIdDefaultUser = 'Az.Migrate.custom\New-AzMigrateHCIServerReplication'; + ByIdPowerUser = 'Az.Migrate.custom\New-AzMigrateHCIServerReplication'; + } + if (('ByIdDefaultUser', 'ByIdPowerUser') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $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.Migrate.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/src/Migrate/Migrate.Autorest/exports/New-AzMigrateNicMapping.ps1 b/src/Migrate/Migrate.Autorest/exports/New-AzMigrateNicMapping.ps1 index adbc433b2860..c9734bc13110 100644 --- a/src/Migrate/Migrate.Autorest/exports/New-AzMigrateNicMapping.ps1 +++ b/src/Migrate/Migrate.Autorest/exports/New-AzMigrateNicMapping.ps1 @@ -106,6 +106,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) diff --git a/src/Migrate/Migrate.Autorest/exports/New-AzMigrateProject.ps1 b/src/Migrate/Migrate.Autorest/exports/New-AzMigrateProject.ps1 index d1b23bffaa3d..faf2bab6aab2 100644 --- a/src/Migrate/Migrate.Autorest/exports/New-AzMigrateProject.ps1 +++ b/src/Migrate/Migrate.Autorest/exports/New-AzMigrateProject.ps1 @@ -108,6 +108,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) diff --git a/src/Migrate/Migrate.Autorest/exports/New-AzMigrateReplicationPolicy.ps1 b/src/Migrate/Migrate.Autorest/exports/New-AzMigrateReplicationPolicy.ps1 index 9e95b0b31558..1e1ad1fc0d60 100644 --- a/src/Migrate/Migrate.Autorest/exports/New-AzMigrateReplicationPolicy.ps1 +++ b/src/Migrate/Migrate.Autorest/exports/New-AzMigrateReplicationPolicy.ps1 @@ -169,6 +169,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) diff --git a/src/Migrate/Migrate.Autorest/exports/New-AzMigrateReplicationProtectionContainerMapping.ps1 b/src/Migrate/Migrate.Autorest/exports/New-AzMigrateReplicationProtectionContainerMapping.ps1 index ee60398162ad..8d74084ff132 100644 --- a/src/Migrate/Migrate.Autorest/exports/New-AzMigrateReplicationProtectionContainerMapping.ps1 +++ b/src/Migrate/Migrate.Autorest/exports/New-AzMigrateReplicationProtectionContainerMapping.ps1 @@ -197,6 +197,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) diff --git a/src/Migrate/Migrate.Autorest/exports/New-AzMigrateServerReplication.ps1 b/src/Migrate/Migrate.Autorest/exports/New-AzMigrateServerReplication.ps1 index 6e8d74288825..0ea3ed4c4c0c 100644 --- a/src/Migrate/Migrate.Autorest/exports/New-AzMigrateServerReplication.ps1 +++ b/src/Migrate/Migrate.Autorest/exports/New-AzMigrateServerReplication.ps1 @@ -318,6 +318,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) diff --git a/src/Migrate/Migrate.Autorest/exports/New-AzMigrateTestNicMapping.ps1 b/src/Migrate/Migrate.Autorest/exports/New-AzMigrateTestNicMapping.ps1 index ae59b715201d..4f4a48237444 100644 --- a/src/Migrate/Migrate.Autorest/exports/New-AzMigrateTestNicMapping.ps1 +++ b/src/Migrate/Migrate.Autorest/exports/New-AzMigrateTestNicMapping.ps1 @@ -75,6 +75,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) diff --git a/src/Migrate/Migrate.Autorest/exports/ProxyCmdletDefinitions.ps1 b/src/Migrate/Migrate.Autorest/exports/ProxyCmdletDefinitions.ps1 index 869ada34eed0..6a38e7a68885 100644 --- a/src/Migrate/Migrate.Autorest/exports/ProxyCmdletDefinitions.ps1 +++ b/src/Migrate/Migrate.Autorest/exports/ProxyCmdletDefinitions.ps1 @@ -14,6 +14,257 @@ # is regenerated. # ---------------------------------------------------------------------------------- +<# +.Synopsis +Gets the details of the fabric. +.Description +Gets the details of the fabric. +.Example +Get-AzMigrateHCIReplicationFabric -ResourceGroupName "test-rg" -Name "testsrcappreplicationfabric" +.Example +$InputObject = Get-AzMigrateHCIReplicationFabric -ResourceGroupName "test-rg" -Name "testsrcappreplicationfabric" + +Get-AzMigrateHCIReplicationFabric -InputObject $InputObject + +$InputObject | Get-AzMigrateHCIReplicationFabric +.Example +Get-AzMigrateHCIReplicationFabric -ResourceGroupName "test-rg" +.Example +Get-AzMigrateHCIReplicationFabric + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModel +.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 + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratehcireplicationfabric +#> +function Get-AzMigrateHCIReplicationFabric { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModel])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('FabricName')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The fabric name. + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure Subscription Id in which migrate project was created. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # 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.Migrate.Category('Query')] + [System.String] + # Continuation token from the previous call. + ${ContinuationToken}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.private\Get-AzMigrateHCIReplicationFabric_Get'; + GetViaIdentity = 'Az.Migrate.private\Get-AzMigrateHCIReplicationFabric_GetViaIdentity'; + List = 'Az.Migrate.private\Get-AzMigrateHCIReplicationFabric_List'; + List1 = 'Az.Migrate.private\Get-AzMigrateHCIReplicationFabric_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.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $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.Migrate.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 Method to get a migrate project. @@ -133,6 +384,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) @@ -310,6 +565,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) @@ -481,6 +740,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) @@ -665,6 +928,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) @@ -844,6 +1111,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) @@ -1019,6 +1290,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) @@ -1191,6 +1466,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) @@ -1355,6 +1634,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) @@ -1524,6 +1807,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) @@ -1723,6 +2010,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) @@ -1950,6 +2241,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) @@ -2125,6 +2420,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) @@ -2303,6 +2602,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) @@ -2364,14 +2667,18 @@ Get-AzMigrateDiscoveredServer -Name idclab-a360-fareast-corp-micros-86617dcf-eff Get-AzMigrateDiscoveredServer -SubscriptionId xxx-xxx-xxx -ResourceGroupName BugBashAVSVMware -ProjectName BugBashAVSVMware -DisplayName Contoso | Format-Table DisplayName,Name,Type .Example Get-AzMigrateDiscoveredServer -SubscriptionId xxx-xxx-xxx -ResourceGroupName BugBashAVSVMware -ProjectName BugBashAVSVMware -ApplianceName BBVMwareAVS -DisplayName Contoso | Format-Table DisplayName,Name,Type +.Example +Get-AzMigrateDiscoveredServer -SubscriptionId xxx-xxx-xxx -ResourceGroupName "test-rg" -ProjectName "testproj" -SourceMachineType "HyperV" | Format-Table DisplayName,Name,Type +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVMachine .Outputs Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVMwareMachine .Link https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratediscoveredserver #> function Get-AzMigrateDiscoveredServer { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVMwareMachine])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVMwareMachine], [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVMachine])] [CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(Mandatory)] @@ -2390,9 +2697,17 @@ param( [Parameter(ParameterSetName='ListInSite')] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [System.String] - # Specifies the VMware machine display name. + # Specifies the source machine display name. ${DisplayName}, + [Parameter()] + [ArgumentCompleter({ "VMware", "HyperV" })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the source machine type. + # Currently, only HyperV and VMware are supported. + ${SourceMachineType}, + [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] @@ -2404,7 +2719,7 @@ param( [Parameter(ParameterSetName='Get', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [System.String] - # Specifies the VMware machine name. + # Specifies the source machine name. # This is an internal Name. # For users, use display name. ${Name}, @@ -2454,6 +2769,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) @@ -2502,70 +2821,82 @@ end { .Synopsis Retrieves the status of an Azure Migrate job. .Description -The Get-AzMigrateJob cmdlet retrives the status of an Azure Migrate job. +The Get-AzMigrateHCIJob cmdlet retrives the status of an Azure Migrate job. .Example -Get-AzMigrateJob -JobID "/Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.RecoveryServices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationJobs/997e2a92-5afe-49c7-a81a-89660aec9b7b" +Get-AzMigrateHCIJob -ID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/jobs/0203aa1b-1dff-4653-89a9-b90a76d1601a" .Example -Get-AzMigrateJob -ResourceGroupName 'azmigratepwshtestasr13072020' -ProjectName 'AzMigrateTestProjectPWSH' +Get-AzMigrateHCIJob -ResourceGroupName "test-rg" -ProjectName "testproj" -Name "0203aa1b-1dff-4653-89a9-b90a76d1601a" .Example -Get-AzMigrateJob -ResourceGroupName 'azmigratepwshtestasr13072020' -ProjectName 'AzMigrateTestProjectPWSH' -JobName 7ae1ee7c-442c-499d-8b0e-81d52a42b71e +$InputObject = Get-AzMigrateHCIJob -ID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/jobs/0203aa1b-1dff-4653-89a9-b90a76d1601a" + +Get-AzMigrateHCIJob -InputObject $InputObject +$InputObject | Get-AzMigrateHCIJob +.Example +Get-AzMigrateHCIJob -ResourceGroupID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg" -ProjectID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.Migrate/MigrateProjects/testproj" +.Example +Get-AzMigrateHCIJob -ResourceGroupName "test-rg" -ProjectName "testproj" + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IJob +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel .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 : Specifies the job object of the replicating server. - [Location ]: Resource Location - [ActivityId ]: The activity id. - [AllowedAction ]: The Allowed action the job. - [CustomDetailAffectedObjectDetail ]: The affected object properties like source server, source cloud, target server, target cloud etc. based on the workflow object details. - [(Any) ]: This indicates any property can be added to this object. - [CustomDetailInstanceType ]: Gets the type of job details (see JobDetailsTypes enum for possible values). - [EndTime ]: The end time. - [Error ]: The errors. - [CreationTime ]: The creation time of job error. - [ErrorLevel ]: Error level of error. - [ProviderErrorDetailErrorCode ]: The Error code. - [ProviderErrorDetailErrorId ]: The Provider error Id. - [ProviderErrorDetailErrorMessage ]: The Error message. - [ProviderErrorDetailPossibleCaus ]: The possible causes for the error. - [ProviderErrorDetailRecommendedAction ]: The recommended action to resolve the error. - [ServiceErrorDetailActivityId ]: Activity Id. - [ServiceErrorDetailCode ]: Error code. - [ServiceErrorDetailMessage ]: Error message. - [ServiceErrorDetailPossibleCaus ]: Possible causes of error. - [ServiceErrorDetailRecommendedAction ]: Recommended action to resolve error. - [TaskId ]: The Id of the task. - [FriendlyName ]: The DisplayName. - [ScenarioName ]: The ScenarioName. - [StartTime ]: The start time. - [State ]: The status of the Job. It is one of these values - NotStarted, InProgress, Succeeded, Failed, Cancelled, Suspended or Other. - [StateDescription ]: The description of the state of the Job. For e.g. - For Succeeded state, description can be Completed, PartiallySucceeded, CompletedWithInformation or Skipped. - [TargetInstanceType ]: The type of the affected object which is of Microsoft.Azure.SiteRecovery.V2015_11_10.AffectedObjectType class. - [TargetObjectId ]: The affected Object Id. - [TargetObjectName ]: The name of the affected object. - [Task ]: The tasks. - [AllowedAction ]: The state/actions applicable on this task. - [CustomDetailInstanceType ]: The type of task details. - [EndTime ]: The end time. - [Error ]: The task error details. - [FriendlyName ]: The name. - [GroupTaskCustomDetailChildTask ]: The child tasks. - [GroupTaskCustomDetailInstanceType ]: The type of task details. - [Name ]: The unique Task name. - [StartTime ]: The start time. - [State ]: The State. It is one of these values - NotStarted, InProgress, Succeeded, Failed, Cancelled, Suspended or Other. - [StateDescription ]: The description of the task state. For example - For Succeeded state, description can be Completed, PartiallySucceeded, CompletedWithInformation or Skipped. - [TaskId ]: The Id. - [TaskType ]: The type of task. Details in CustomDetails property depend on this type. +INPUTOBJECT : Specifies the job object of the replicating server. + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. .Link -https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratejob +https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratehcijob #> -function Get-AzMigrateJob { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IJob])] +function Get-AzMigrateHCIJob { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel])] [CmdletBinding(DefaultParameterSetName='ListByName', PositionalBinding=$false)] param( [Parameter(ParameterSetName='ListByName', Mandatory)] @@ -2593,17 +2924,17 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [System.String] # Specifies the job id for which the details needs to be retrieved. - ${JobID}, + ${ID}, [Parameter(ParameterSetName='GetByName', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [System.String] # Job identifier - ${JobName}, + ${Name}, - [Parameter(ParameterSetName='GetByInputObject', Mandatory)] + [Parameter(ParameterSetName='GetByInputObject', Mandatory, ValueFromPipeline)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IJob] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] # Specifies the job object of the replicating server. # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, @@ -2620,13 +2951,6 @@ param( # Specifies the Azure Migrate Project in which servers are replicating. ${ProjectID}, - [Parameter(ParameterSetName='ListByName')] - [Parameter(ParameterSetName='ListById')] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')] - [System.String] - # OData filter options. - ${Filter}, - [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] @@ -2701,17 +3025,21 @@ begin { } $mapping = @{ - ListByName = 'Az.Migrate.custom\Get-AzMigrateJob'; - GetById = 'Az.Migrate.custom\Get-AzMigrateJob'; - GetByName = 'Az.Migrate.custom\Get-AzMigrateJob'; - GetByInputObject = 'Az.Migrate.custom\Get-AzMigrateJob'; - ListById = 'Az.Migrate.custom\Get-AzMigrateJob'; + ListByName = 'Az.Migrate.custom\Get-AzMigrateHCIJob'; + GetById = 'Az.Migrate.custom\Get-AzMigrateHCIJob'; + GetByName = 'Az.Migrate.custom\Get-AzMigrateHCIJob'; + GetByInputObject = 'Az.Migrate.custom\Get-AzMigrateHCIJob'; + ListById = 'Az.Migrate.custom\Get-AzMigrateHCIJob'; } if (('ListByName', 'GetById', 'GetByName', 'GetByInputObject', 'ListById') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) @@ -2760,30 +3088,75 @@ end { .Synopsis Retrieves the details of the replicating server. .Description -The Get-AzMigrateServerReplication cmdlet retrieves the object for the replicating server. +The Get-AzMigrateHCIServerReplication cmdlet retrieves the object for the replicating server. .Example -Get-AzMigrateServerReplication -TargetObjectID '/Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.RecoveryServices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationFabrics/AzMigratePWSHTc8d1replicationfabric/replicationProtectionContainers/AzMigratePWSHTc8d1replicationcontainer/replicationMigrationItems/bcdr-vcenter-fareast-corp-micro-cfcc5a24-a40e-56b9-a6af-e206c9ca4f93_50063baa-9806-d6d6-7e09-c0ae87309b4f' +Get-AzMigrateHCIServerReplication -TargetObjectID '/subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/protectedItems/503a4f02-916c-d6b0-8d14-222bbd4767e5' .Example -Get-AzMigrateServerReplication -ResourceGroupID /Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020 -ProjectID "/subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.Migrate/MigrateProjects/AzMigrateTestProjectPWSH" +Get-AzMigrateHCIServerReplication -DiscoveredMachineId "/subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.OffAzure/HyperVSites/siteName1/machines/503a4f02-916c-d6b0-8d14-222bbd4767e5" + .Example -Get-AzMigrateServerReplication -ResourceGroupName azmigratepwshtestasr13072020 -ProjectName AzMigrateTestProjectPWSH +Get-AzMigrateServerReplication -ResourceGroupName testResourceGroup -ProjectName testProjectName +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel .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 : Specifies the machine object of the replicating server. - [Location ]: Resource Location - [ProviderSpecificDetail ]: The migration provider custom settings. - InstanceType : Gets the instance type. +INPUTOBJECT : Specifies the machine object of the replicating server. + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. .Link -https://learn.microsoft.com/powershell/module/az.migrate/get-azmigrateserverreplication +https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratehciserverreplication #> -function Get-AzMigrateServerReplication { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem])] +function Get-AzMigrateHCIServerReplication { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel])] [CmdletBinding(DefaultParameterSetName='ListByName', PositionalBinding=$false)] param( [Parameter(ParameterSetName='ListByName', Mandatory)] @@ -2807,10 +3180,10 @@ param( # Azure Subscription ID. ${SubscriptionId}, - [Parameter(ParameterSetName='GetBySRSID', Mandatory)] + [Parameter(ParameterSetName='GetByItemID', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [System.String] - # Specifies the replicating server. + # Specifies the replicating server ARM ID. ${TargetObjectID}, [Parameter(ParameterSetName='GetByMachineName', Mandatory)] @@ -2825,9 +3198,9 @@ param( # Specifies the machine ID of the discovered server. ${DiscoveredMachineId}, - [Parameter(ParameterSetName='GetByInputObject', Mandatory)] + [Parameter(ParameterSetName='GetByInputObject', Mandatory, ValueFromPipeline)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] # Specifies the machine object of the replicating server. # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, @@ -2844,20 +3217,6 @@ param( # Specifies the Azure Migrate Project in which servers are replicating. ${ProjectID}, - [Parameter(ParameterSetName='ListByName')] - [Parameter(ParameterSetName='ListById')] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')] - [System.String] - # OData filter options. - ${Filter}, - - [Parameter(ParameterSetName='ListByName')] - [Parameter(ParameterSetName='ListById')] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')] - [System.String] - # The pagination token. - ${SkipToken}, - [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] @@ -2932,18 +3291,22 @@ begin { } $mapping = @{ - ListByName = 'Az.Migrate.custom\Get-AzMigrateServerReplication'; - GetBySRSID = 'Az.Migrate.custom\Get-AzMigrateServerReplication'; - GetByMachineName = 'Az.Migrate.custom\Get-AzMigrateServerReplication'; - GetBySDSID = 'Az.Migrate.custom\Get-AzMigrateServerReplication'; - GetByInputObject = 'Az.Migrate.custom\Get-AzMigrateServerReplication'; - ListById = 'Az.Migrate.custom\Get-AzMigrateServerReplication'; - } - if (('ListByName', 'GetBySRSID', 'GetByMachineName', 'GetBySDSID', 'GetByInputObject', 'ListById') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + ListByName = 'Az.Migrate.custom\Get-AzMigrateHCIServerReplication'; + GetByItemID = 'Az.Migrate.custom\Get-AzMigrateHCIServerReplication'; + GetByMachineName = 'Az.Migrate.custom\Get-AzMigrateHCIServerReplication'; + GetBySDSID = 'Az.Migrate.custom\Get-AzMigrateHCIServerReplication'; + GetByInputObject = 'Az.Migrate.custom\Get-AzMigrateHCIServerReplication'; + ListById = 'Az.Migrate.custom\Get-AzMigrateHCIServerReplication'; + } + if (('ListByName', 'GetByItemID', 'GetByMachineName', 'GetBySDSID', 'GetByInputObject', 'ListById') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) @@ -2990,63 +3353,132 @@ end { <# .Synopsis -Initialises the infrastructure for the migrate project. +Retrieves the status of an Azure Migrate job. .Description -The Initialize-AzMigrateReplicationInfrastructure cmdlet initialises the infrastructure for the migrate project. +The Get-AzMigrateJob cmdlet retrives the status of an Azure Migrate job. .Example -Initialize-AzMigrateReplicationInfrastructure -ResourceGroupName TestRG -ProjectName TestProject -TargetRegion centralus +Get-AzMigrateJob -JobID "/Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.RecoveryServices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationJobs/997e2a92-5afe-49c7-a81a-89660aec9b7b" .Example -Initialize-AzMigrateReplicationInfrastructure -ResourceGroupName "TestRG" -ProjectName "TestPEProject" -TargetRegion "centraluseuap" -Scenario "agentlessVMware" -CacheStorageAccountId "/subscriptions/b364ed8d-4279-4bf8-8fd1-56f8fa0ae05c/resourceGroups/singhabh-rg/providers/Microsoft.Storage/storageAccounts/singhabhstoragepe1" +Get-AzMigrateJob -ResourceGroupName 'azmigratepwshtestasr13072020' -ProjectName 'AzMigrateTestProjectPWSH' +.Example +Get-AzMigrateJob -ResourceGroupName 'azmigratepwshtestasr13072020' -ProjectName 'AzMigrateTestProjectPWSH' -JobName 7ae1ee7c-442c-499d-8b0e-81d52a42b71e .Outputs -System.Boolean +Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 : Specifies the job object of the replicating server. + [Location ]: Resource Location + [ActivityId ]: The activity id. + [AllowedAction ]: The Allowed action the job. + [CustomDetailAffectedObjectDetail ]: The affected object properties like source server, source cloud, target server, target cloud etc. based on the workflow object details. + [(Any) ]: This indicates any property can be added to this object. + [CustomDetailInstanceType ]: Gets the type of job details (see JobDetailsTypes enum for possible values). + [EndTime ]: The end time. + [Error ]: The errors. + [CreationTime ]: The creation time of job error. + [ErrorLevel ]: Error level of error. + [ProviderErrorDetailErrorCode ]: The Error code. + [ProviderErrorDetailErrorId ]: The Provider error Id. + [ProviderErrorDetailErrorMessage ]: The Error message. + [ProviderErrorDetailPossibleCaus ]: The possible causes for the error. + [ProviderErrorDetailRecommendedAction ]: The recommended action to resolve the error. + [ServiceErrorDetailActivityId ]: Activity Id. + [ServiceErrorDetailCode ]: Error code. + [ServiceErrorDetailMessage ]: Error message. + [ServiceErrorDetailPossibleCaus ]: Possible causes of error. + [ServiceErrorDetailRecommendedAction ]: Recommended action to resolve error. + [TaskId ]: The Id of the task. + [FriendlyName ]: The DisplayName. + [ScenarioName ]: The ScenarioName. + [StartTime ]: The start time. + [State ]: The status of the Job. It is one of these values - NotStarted, InProgress, Succeeded, Failed, Cancelled, Suspended or Other. + [StateDescription ]: The description of the state of the Job. For e.g. - For Succeeded state, description can be Completed, PartiallySucceeded, CompletedWithInformation or Skipped. + [TargetInstanceType ]: The type of the affected object which is of Microsoft.Azure.SiteRecovery.V2015_11_10.AffectedObjectType class. + [TargetObjectId ]: The affected Object Id. + [TargetObjectName ]: The name of the affected object. + [Task ]: The tasks. + [AllowedAction ]: The state/actions applicable on this task. + [CustomDetailInstanceType ]: The type of task details. + [EndTime ]: The end time. + [Error ]: The task error details. + [FriendlyName ]: The name. + [GroupTaskCustomDetailChildTask ]: The child tasks. + [GroupTaskCustomDetailInstanceType ]: The type of task details. + [Name ]: The unique Task name. + [StartTime ]: The start time. + [State ]: The State. It is one of these values - NotStarted, InProgress, Succeeded, Failed, Cancelled, Suspended or Other. + [StateDescription ]: The description of the task state. For example - For Succeeded state, description can be Completed, PartiallySucceeded, CompletedWithInformation or Skipped. + [TaskId ]: The Id. + [TaskType ]: The type of task. Details in CustomDetails property depend on this type. .Link -https://learn.microsoft.com/powershell/module/az.migrate/initialize-azmigratereplicationinfrastructure +https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratejob #> -function Initialize-AzMigrateReplicationInfrastructure { -[OutputType([System.Boolean])] -[CmdletBinding(DefaultParameterSetName='agentlessVMware', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +function Get-AzMigrateJob { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IJob])] +[CmdletBinding(DefaultParameterSetName='ListByName', PositionalBinding=$false)] param( - [Parameter(Mandatory)] - [ValidateNotNull()] + [Parameter(ParameterSetName='ListByName', Mandatory)] + [Parameter(ParameterSetName='GetByName', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [System.String] - # Specifies the Resource Group of the Azure Migrate Project in the current subscription. + # The name of the resource group where the recovery services vault is present. ${ResourceGroupName}, - [Parameter(Mandatory)] - [ValidateNotNull()] + [Parameter(ParameterSetName='ListByName', Mandatory)] + [Parameter(ParameterSetName='GetByName', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [System.String] - # Specifies the name of the Azure Migrate project to be used for server migration. + # The name of the migrate project. ${ProjectName}, - [Parameter(Mandatory)] - [ArgumentCompleter({ "agentlessVMware" })] + [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] [System.String] - # Specifies the server migration scenario for which the replication infrastructure needs to be initialized. - ${Scenario}, + # Azure Subscription ID. + ${SubscriptionId}, - [Parameter(Mandatory)] - [ValidateNotNull()] + [Parameter(ParameterSetName='GetById', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [System.String] - # Specifies the target Azure region for server migrations. - ${TargetRegion}, + # Specifies the job id for which the details needs to be retrieved. + ${JobID}, - [Parameter()] + [Parameter(ParameterSetName='GetByName', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [System.String] - # Specifies the Storage Account Id to be used for private endpoint scenario. - ${CacheStorageAccountId}, + # Job identifier + ${JobName}, - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [Parameter(ParameterSetName='GetByInputObject', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IJob] + # Specifies the job object of the replicating server. + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='ListById', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [System.String] - # Azure Subscription ID. - ${SubscriptionId}, + # Specifies the Resource Group of the Azure Migrate Project in the current subscription. + ${ResourceGroupID}, + + [Parameter(ParameterSetName='ListById', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the Azure Migrate Project in which servers are replicating. + ${ProjectID}, + + [Parameter(ParameterSetName='ListByName')] + [Parameter(ParameterSetName='ListById')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')] + [System.String] + # OData filter options. + ${Filter}, [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] @@ -3076,24 +3508,1024 @@ param( # SendAsync Pipeline Steps to be prepended to the front of the pipeline ${HttpPipelinePrepend}, - [Parameter(DontShow)] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] - [System.Uri] - # The URI for the proxy server to use - ${Proxy}, + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + ListByName = 'Az.Migrate.custom\Get-AzMigrateJob'; + GetById = 'Az.Migrate.custom\Get-AzMigrateJob'; + GetByName = 'Az.Migrate.custom\Get-AzMigrateJob'; + GetByInputObject = 'Az.Migrate.custom\Get-AzMigrateJob'; + ListById = 'Az.Migrate.custom\Get-AzMigrateJob'; + } + if (('ListByName', 'GetById', 'GetByName', 'GetByInputObject', 'ListById') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $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.Migrate.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 +Retrieves the details of the replicating server. +.Description +The Get-AzMigrateServerReplication cmdlet retrieves the object for the replicating server. +.Example +Get-AzMigrateServerReplication -TargetObjectID '/Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.RecoveryServices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationFabrics/AzMigratePWSHTc8d1replicationfabric/replicationProtectionContainers/AzMigratePWSHTc8d1replicationcontainer/replicationMigrationItems/bcdr-vcenter-fareast-corp-micro-cfcc5a24-a40e-56b9-a6af-e206c9ca4f93_50063baa-9806-d6d6-7e09-c0ae87309b4f' +.Example +Get-AzMigrateServerReplication -ResourceGroupID /Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020 -ProjectID "/subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.Migrate/MigrateProjects/AzMigrateTestProjectPWSH" +.Example +Get-AzMigrateServerReplication -ResourceGroupName azmigratepwshtestasr13072020 -ProjectName AzMigrateTestProjectPWSH + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 : Specifies the machine object of the replicating server. + [Location ]: Resource Location + [ProviderSpecificDetail ]: The migration provider custom settings. + InstanceType : Gets the instance type. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/get-azmigrateserverreplication +#> +function Get-AzMigrateServerReplication { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem])] +[CmdletBinding(DefaultParameterSetName='ListByName', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='ListByName', Mandatory)] + [Parameter(ParameterSetName='GetByMachineName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the Resource Group of the Azure Migrate Project in the current subscription. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='ListByName', Mandatory)] + [Parameter(ParameterSetName='GetByMachineName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the Azure Migrate project in the current subscription. + ${ProjectName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure Subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetBySRSID', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the replicating server. + ${TargetObjectID}, + + [Parameter(ParameterSetName='GetByMachineName', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the display name of the replicating machine. + ${MachineName}, + + [Parameter(ParameterSetName='GetBySDSID', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the machine ID of the discovered server. + ${DiscoveredMachineId}, + + [Parameter(ParameterSetName='GetByInputObject', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem] + # Specifies the machine object of the replicating server. + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='ListById', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the Resource Group of the Azure Migrate Project in the current subscription. + ${ResourceGroupID}, + + [Parameter(ParameterSetName='ListById', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the Azure Migrate Project in which servers are replicating. + ${ProjectID}, + + [Parameter(ParameterSetName='ListByName')] + [Parameter(ParameterSetName='ListById')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')] + [System.String] + # OData filter options. + ${Filter}, + + [Parameter(ParameterSetName='ListByName')] + [Parameter(ParameterSetName='ListById')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')] + [System.String] + # The pagination token. + ${SkipToken}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + ListByName = 'Az.Migrate.custom\Get-AzMigrateServerReplication'; + GetBySRSID = 'Az.Migrate.custom\Get-AzMigrateServerReplication'; + GetByMachineName = 'Az.Migrate.custom\Get-AzMigrateServerReplication'; + GetBySDSID = 'Az.Migrate.custom\Get-AzMigrateServerReplication'; + GetByInputObject = 'Az.Migrate.custom\Get-AzMigrateServerReplication'; + ListById = 'Az.Migrate.custom\Get-AzMigrateServerReplication'; + } + if (('ListByName', 'GetBySRSID', 'GetByMachineName', 'GetBySDSID', 'GetByInputObject', 'ListById') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $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.Migrate.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 +Initializes the infrastructure for the migrate project. +.Description +The Initialize-AzMigrateHCIReplicationInfrastructure cmdlet initializes the infrastructure for the migrate project in AzStackHCI scenario. +.Example +Initialize-AzMigrateHCIReplicationInfrastructure -ProjectName "testproj" -ResourceGroupName "test-rg" -SourceApplianceName "testsrcapp" -TargetApplianceName "testtgtapp" -PassThru:$true +.Example +$cacheStorageAccountId = "/subscriptions/xxx-xxx-xxxx/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/testSa" + +Initialize-AzMigrateHCIReplicationInfrastructure -ProjectName "testproj" -ResourceGroupName "test-rg" -CacheStorageAccountId $cacheStorageAccountId -SourceApplianceName "testsrcapp" -TargetApplianceName "testtgtapp" -PassThru:$true + +.Outputs +System.Boolean +.Link +https://learn.microsoft.com/powershell/module/az.migrate/initialize-azmigratehcireplicationinfrastructure +#> +function Initialize-AzMigrateHCIReplicationInfrastructure { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='AzStackHCI', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the Resource Group of the Azure Migrate Project in the current subscription. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the name of the Azure Migrate project to be used for server migration. + ${ProjectName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the source appliance name for the AzStackHCI scenario. + ${SourceApplianceName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the target appliance name for the AzStackHCI scenario. + ${TargetApplianceName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the Storage Account ARM Id to be used for private endpoint scenario. + ${CacheStorageAccountId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure Subscription ID. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + AzStackHCI = 'Az.Migrate.custom\Initialize-AzMigrateHCIReplicationInfrastructure'; + } + if (('AzStackHCI') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $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.Migrate.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 +Initialises the infrastructure for the migrate project. +.Description +The Initialize-AzMigrateReplicationInfrastructure cmdlet initialises the infrastructure for the migrate project. +.Example +Initialize-AzMigrateReplicationInfrastructure -ResourceGroupName TestRG -ProjectName TestProject -TargetRegion centralus +.Example +Initialize-AzMigrateReplicationInfrastructure -ResourceGroupName "TestRG" -ProjectName "TestPEProject" -TargetRegion "centraluseuap" -Scenario "agentlessVMware" -CacheStorageAccountId "/subscriptions/b364ed8d-4279-4bf8-8fd1-56f8fa0ae05c/resourceGroups/singhabh-rg/providers/Microsoft.Storage/storageAccounts/singhabhstoragepe1" + +.Outputs +System.Boolean +.Link +https://learn.microsoft.com/powershell/module/az.migrate/initialize-azmigratereplicationinfrastructure +#> +function Initialize-AzMigrateReplicationInfrastructure { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='agentlessVMware', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the Resource Group of the Azure Migrate Project in the current subscription. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the name of the Azure Migrate project to be used for server migration. + ${ProjectName}, + + [Parameter(Mandatory)] + [ArgumentCompleter({ "agentlessVMware" })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the server migration scenario for which the replication infrastructure needs to be initialized. + ${Scenario}, + + [Parameter(Mandatory)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the target Azure region for server migrations. + ${TargetRegion}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the Storage Account Id to be used for private endpoint scenario. + ${CacheStorageAccountId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure Subscription ID. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + agentlessVMware = 'Az.Migrate.custom\Initialize-AzMigrateReplicationInfrastructure'; + } + if (('agentlessVMware') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $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.Migrate.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 +Creates a new disk mapping +.Description +The New-AzMigrateDiskMapping cmdlet creates a mapping of the source disk attached to the server to be migrated +.Example +New-AzMigrateDiskMapping -DiskID a -DiskType Standard -IsOSDisk 'true' + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IVMwareCbtDiskInput +.Link +https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratediskmapping +#> +function New-AzMigrateDiskMapping { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IVMwareCbtDiskInput])] +[CmdletBinding(DefaultParameterSetName='VMwareCbt', PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the disk ID of the disk attached to the discovered server to be migrated. + ${DiskID}, + + [Parameter(Mandatory)] + [ArgumentCompleter({ "true" , "false" })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies whether the disk contains the Operating System for the source server to be migrated. + ${IsOSDisk}, + + [Parameter(Mandatory)] + [ArgumentCompleter({ "Standard_LRS", "Premium_LRS", "StandardSSD_LRS" })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the type of disks to be used for the Azure VM. + ${DiskType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the disk encyption set to be used. + ${DiskEncryptionSetID} +) + +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 = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + VMwareCbt = 'Az.Migrate.custom\New-AzMigrateDiskMapping'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $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.Migrate.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 +Creates a new disk mapping +.Description +The New-AzMigrateHCIDiskMappingObject cmdlet creates a mapping of the source disk attached to the server to be migrated +.Example +New-AzMigrateHCIDiskMappingObject -DiskID a -IsOSDisk true -IsDynamic true -Size 1 -Format VHDX + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHCIDiskInput +.Link +https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratehcidiskmappingobject +#> +function New-AzMigrateHCIDiskMappingObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHCIDiskInput])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the disk ID of the disk attached to the discovered server to be migrated. + ${DiskID}, + + [Parameter(Mandatory)] + [ArgumentCompleter({ "true" , "false" })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies whether the disk contains the Operating System for the source server to be migrated. + ${IsOSDisk}, + + [Parameter(Mandatory)] + [ArgumentCompleter({ "true" , "false" })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies whether the disk is dynamic. + ${IsDynamic}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.Int64] + # Specifies the disk size in GB. + ${Size}, + + [Parameter(Mandatory)] + [ArgumentCompleter({ "VHD", "VHDX" })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the disk format. + ${Format} +) + +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 = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + __AllParameterSets = 'Az.Migrate.custom\New-AzMigrateHCIDiskMappingObject'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $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.Migrate.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 +Creates an object to update NIC properties of a replicating server. +.Description +The New-AzMigrateHCINicMappingObject cmdlet creates a mapping of the source NIC attached to the server to be migrated. +This object is provided as an input to the Set-AzMigrateServerReplication cmdlet to update the NIC and its properties for a replicating server. +.Example +New-AzMigrateHCINicMappingObject -NicID a -TargetVirtualSwitchId "/subscriptions/xxx-xxx-xxx/resourceGroups/hciclus-rg/providers/Microsoft.AzureStackHCI/logicalnetworks/external" + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHCINicInput +.Link +https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratehcinicmappingobject +#> +function New-AzMigrateHCINicMappingObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHCINicInput])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the ID of the NIC to be updated. + ${NicID}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the logical network ARM ID that the VMs will use. + ${TargetVirtualSwitchId}, - [Parameter(DontShow)] - [ValidateNotNull()] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] - [System.Management.Automation.PSCredential] - # Credentials for a proxy server to use for the remote call - ${ProxyCredential}, + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the test logical network ARM ID that the VMs will use. + ${TargetTestVirtualSwitchId}, - [Parameter(DontShow)] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] - [System.Management.Automation.SwitchParameter] - # Use the default credentials for the proxy - ${ProxyUseDefaultCredentials} + [Parameter()] + [ArgumentCompleter({ "true" , "false" })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies whether the this Nic should be created at target. + ${CreateAtTarget} ) begin { @@ -3122,13 +4554,14 @@ begin { } $mapping = @{ - agentlessVMware = 'Az.Migrate.custom\Initialize-AzMigrateReplicationInfrastructure'; - } - if (('agentlessVMware') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + __AllParameterSets = 'Az.Migrate.custom\New-AzMigrateHCINicMappingObject'; } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) @@ -3175,46 +4608,159 @@ end { <# .Synopsis -Creates a new disk mapping +Starts replication for the specified server. .Description -The New-AzMigrateDiskMapping cmdlet creates a mapping of the source disk attached to the server to be migrated +The New-AzMigrateHCIServerReplication cmdlet starts the replication for a particular discovered server in the Azure Migrate project. .Example -New-AzMigrateDiskMapping -DiskID a -DiskType Standard -IsOSDisk 'true' +New-AzMigrateHCIServerReplication -MachineId "/subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.OffAzure/HyperVSites/testsrc7972site/machines/005-005-005" -OSDiskID "Microsoft:0EC082D5-6827-457A-BAE2-F986E1B94851\83F8638B-8DCA-4152-9EDA-2CA8B33039B4\0\0\L" -TargetStoragePathId "/subscriptions/xxx-xxx-xxx/resourceGroups/hciclus-rg/providers/Microsoft.AzureStackHCI/storagecontainers/testStorageContainer1" -TargetVirtualSwitchId "/subscriptions/xxx-xxx-xxx/resourceGroups/hciclus-rg/providers/Microsoft.AzureStackHCI/logicalnetworks/external" -TargetResourceGroupId "/subscriptions//xxx-xxx-xxx/resourceGroups/target-rg"-TargetVMName "targetVM" +.Example +[AzStackHCIDiskInput[]]$DisksToInclude = @() +$OSDisk = New-AzMigrateHCIDiskMappingObject -DiskID "Microsoft:C1A34301-3BFF-4EC6-97F1-6C4BD5ADCDE0\83F8638B-8DCA-4152-9EDA-2CA8B33039B4\0\0\L" -IsOSDisk true -IsDynamic true -Size 42 -Format VHD +$DataDisk = New-AzMigrateHCIDiskMappingObject -DiskID "Microsoft:C1A34301-3BFF-4EC6-97F1-6C4BD5ADCDE0\C92FAB89-DA8B-47E9-92F3-364642ECDF39\0\0\L" -IsOSDisk false -IsDynamic true -Size 5 -Format VHD +$DisksToInclude += $OSDisk +$DisksToInclude += $DataDisk + +[AzStackHCINicInput[]]$NicsToInclude = @() +$Nic = New-AzMigrateHCINicMappingObject -NicID "Microsoft:C1A34301-3BFF-4EC6-97F1-6C4BD5ADCDE0\99CDFD2E-D60C-4218-AC2E-E7C2D8253EB9" -TargetVirtualSwitchId "/subscriptions/xxx-xxx-xxx/resourceGroups/hciclus-rg/providers/Microsoft.AzureStackHCI/logicalnetworks/external" +$NicsToInclude += $Nic + +New-AzMigrateHCIServerReplication -MachineId "/subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.OffAzure/HyperVSites/testsrc7972site/machines/005-005-005" -TargetStoragePathId "/subscriptions/xxx-xxx-xxx/resourceGroups/hciclus-rg/providers/Microsoft.AzureStackHCI/storagecontainers/testStorageContainer1" -TargetResourceGroupId "/subscriptions//xxx-xxx-xxx/resourceGroups/target-rg"-TargetVMName "targetVM" -DiskToInclude $DisksToInclude -NicToInclude $NicsToInclude .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IVMwareCbtDiskInput +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel .Link -https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratediskmapping +https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratehciserverreplication #> -function New-AzMigrateDiskMapping { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IVMwareCbtDiskInput])] -[CmdletBinding(DefaultParameterSetName='VMwareCbt', PositionalBinding=$false)] +function New-AzMigrateHCIServerReplication { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel])] +[CmdletBinding(DefaultParameterSetName='ByIdDefaultUser', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [System.String] - # Specifies the disk ID of the disk attached to the discovered server to be migrated. - ${DiskID}, + # Specifies the machine ARM ID of the discovered server to be migrated. + ${MachineId}, [Parameter(Mandatory)] - [ArgumentCompleter({ "true" , "false" })] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [System.String] - # Specifies whether the disk contains the Operating System for the source server to be migrated. - ${IsOSDisk}, + # Specifies the storage path ARM ID where the VMs will be stored. + ${TargetStoragePathId}, [Parameter(Mandatory)] - [ArgumentCompleter({ "Standard_LRS", "Premium_LRS", "StandardSSD_LRS" })] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [System.String] - # Specifies the type of disks to be used for the Azure VM. - ${DiskType}, + # Specifies the target Resource Group Id where the migrated VM resources will reside. + ${TargetResourceGroupId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the name of the VM to be created. + ${TargetVMName}, + + [Parameter(ParameterSetName='ByIdDefaultUser', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the logical network ARM ID that the VMs will use. + ${TargetVirtualSwitchId}, + + [Parameter(ParameterSetName='ByIdDefaultUser', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the Operating System disk for the source server to be migrated. + ${OSDiskID}, [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.Int32] + # Specifies the number of CPU cores. + ${TargetVMCPUCore}, + + [Parameter(ParameterSetName='ByIdDefaultUser')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [System.String] - # Specifies the disk encyption set to be used. - ${DiskEncryptionSetID} + # Specifies the test logical network ARM ID that the VMs will use. + ${TargetTestVirtualSwitchId}, + + [Parameter()] + [ArgumentCompleter({ "true" , "false" })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies if RAM is dynamic or not. + ${IsDynamicMemoryEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.Int64] + # Specifies the target RAM size in MB. + ${TargetVMRam}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure Subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByIdPowerUser', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHCIDiskInput[]] + # Specifies the disks on the source server to be included for replication. + ${DiskToInclude}, + + [Parameter(ParameterSetName='ByIdPowerUser', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHCINicInput[]] + # Specifies the NICs on the source server to be included for replication. + ${NicToInclude}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} ) begin { @@ -3243,10 +4789,18 @@ begin { } $mapping = @{ - VMwareCbt = 'Az.Migrate.custom\New-AzMigrateDiskMapping'; + ByIdDefaultUser = 'Az.Migrate.custom\New-AzMigrateHCIServerReplication'; + ByIdPowerUser = 'Az.Migrate.custom\New-AzMigrateHCIServerReplication'; + } + if (('ByIdDefaultUser', 'ByIdPowerUser') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) @@ -3383,6 +4937,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) @@ -3521,6 +5079,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) @@ -3819,18 +5381,133 @@ param( # The URI for the proxy server to use ${Proxy}, - [Parameter(DontShow)] - [ValidateNotNull()] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] - [System.Management.Automation.PSCredential] - # Credentials for a proxy server to use for the remote call - ${ProxyCredential}, + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + ByIdDefaultUser = 'Az.Migrate.custom\New-AzMigrateServerReplication'; + ByIdPowerUser = 'Az.Migrate.custom\New-AzMigrateServerReplication'; + ByInputObjectPowerUser = 'Az.Migrate.custom\New-AzMigrateServerReplication'; + ByInputObjectDefaultUser = 'Az.Migrate.custom\New-AzMigrateServerReplication'; + } + if (('ByIdDefaultUser', 'ByIdPowerUser', 'ByInputObjectPowerUser', 'ByInputObjectDefaultUser') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $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.Migrate.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 +Creates an object to update NIC properties of a test migrating server. +.Description +The New-AzMigrateTestNicMapping cmdlet creates a mapping of the source NIC attached to the server to be test migrated. +This object is provided as an input to the Start-AzMigrateTestMigration cmdlet to update the NIC and its properties for a test migrating server. +.Example +New-AzMigrateTestNicMapping -NicID a2399354-653a-464e-a567-d30ef5467a31 -TestNicSubnet subnet1 + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IVMwareCbtNicInput +.Link +https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratetestnicmapping +#> +function New-AzMigrateTestNicMapping { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IVMwareCbtNicInput])] +[CmdletBinding(DefaultParameterSetName='VMwareCbt', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the ID of the NIC to be updated. + ${NicID}, - [Parameter(DontShow)] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] - [System.Management.Automation.SwitchParameter] - # Use the default credentials for the proxy - ${ProxyUseDefaultCredentials} + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the Subnet name for the NIC in the destination Virtual Network to which the server needs to be test migrated. + ${TestNicSubnet} ) begin { @@ -3859,16 +5536,14 @@ begin { } $mapping = @{ - ByIdDefaultUser = 'Az.Migrate.custom\New-AzMigrateServerReplication'; - ByIdPowerUser = 'Az.Migrate.custom\New-AzMigrateServerReplication'; - ByInputObjectPowerUser = 'Az.Migrate.custom\New-AzMigrateServerReplication'; - ByInputObjectDefaultUser = 'Az.Migrate.custom\New-AzMigrateServerReplication'; - } - if (('ByIdDefaultUser', 'ByIdPowerUser', 'ByInputObjectPowerUser', 'ByInputObjectDefaultUser') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { - $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + VMwareCbt = 'Az.Migrate.custom\New-AzMigrateTestNicMapping'; } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) @@ -3915,33 +5590,156 @@ end { <# .Synopsis -Creates an object to update NIC properties of a test migrating server. +Stops replication for the migrated server. .Description -The New-AzMigrateTestNicMapping cmdlet creates a mapping of the source NIC attached to the server to be test migrated. -This object is provided as an input to the Start-AzMigrateTestMigration cmdlet to update the NIC and its properties for a test migrating server. +The Remove-AzMigrateHCIServerReplication cmdlet stops the replication for a migrated server. .Example -New-AzMigrateTestNicMapping -NicID a2399354-653a-464e-a567-d30ef5467a31 -TestNicSubnet subnet1 +Remove-AzMigrateHCIServerReplication -TargetObjectID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851" +.Example +$InputObject = Get-AzMigrateHCIServerReplication -TargetObjectID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851" + +Remove-AzMigrateHCIServerReplication -InputObject $InputObject +$InputObject | Remove-AzMigrateHCIServerReplication + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IVMwareCbtNicInput +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel +.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 : Specifies the replcating server for which the replication needs to be disabled. The server object can be retrieved using the Get-AzMigrateHCIServerReplication cmdlet. + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. .Link -https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratetestnicmapping +https://learn.microsoft.com/powershell/module/az.migrate/remove-azmigratehciserverreplication #> -function New-AzMigrateTestNicMapping { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IVMwareCbtNicInput])] -[CmdletBinding(DefaultParameterSetName='VMwareCbt', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +function Remove-AzMigrateHCIServerReplication { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel])] +[CmdletBinding(DefaultParameterSetName='ByID', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( - [Parameter(Mandatory)] + [Parameter(ParameterSetName='ByID', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [System.String] - # Specifies the ID of the NIC to be updated. - ${NicID}, + # Specifies the replcating server for which the replication needs to be disabled. + # The ID should be retrieved using the Get-AzMigrateHCIServerReplication cmdlet. + ${TargetObjectID}, - [Parameter(Mandatory)] + [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] [System.String] - # Specifies the Subnet name for the NIC in the destination Virtual Network to which the server needs to be test migrated. - ${TestNicSubnet} + # Azure Subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByInputObject', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # Specifies the replcating server for which the replication needs to be disabled. + # The server object can be retrieved using the Get-AzMigrateHCIServerReplication cmdlet. + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [ArgumentCompleter({ "true" , "false" })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')] + [System.String] + # Specifies whether the replication needs to be force removed. + # Default to "false". + ${ForceRemove}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} ) begin { @@ -3970,10 +5768,18 @@ begin { } $mapping = @{ - VMwareCbt = 'Az.Migrate.custom\New-AzMigrateTestNicMapping'; + ByID = 'Az.Migrate.custom\Remove-AzMigrateHCIServerReplication'; + ByInputObject = 'Az.Migrate.custom\Remove-AzMigrateHCIServerReplication'; + } + if (('ByID', 'ByInputObject') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) @@ -4036,7 +5842,7 @@ COMPLEX PARAMETER PROPERTIES To 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 : Specifies the machine object of the replicating server. +INPUTOBJECT : Specifies the replcating server for which the replication needs to be disabled. The server object should be retrieved using the Get-AzMigrateServerReplication cmdlet. [Location ]: Resource Location [ProviderSpecificDetail ]: The migration provider custom settings. InstanceType : Gets the instance type. @@ -4050,7 +5856,7 @@ param( [Parameter(ParameterSetName='ByIDVMwareCbt', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [System.String] - # Specifies the replcating server for which the replicatio needs to be disabled. + # Specifies the replcating server for which the replication needs to be disabled. # The ID should be retrieved using the Get-AzMigrateServerReplication cmdlet. ${TargetObjectID}, @@ -4064,7 +5870,8 @@ param( [Parameter(ParameterSetName='ByInputObjectVMwareCbt', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem] - # Specifies the machine object of the replicating server. + # Specifies the replcating server for which the replication needs to be disabled. + # The server object should be retrieved using the Get-AzMigrateServerReplication cmdlet. # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, @@ -4156,6 +5963,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) @@ -4332,6 +6143,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) @@ -4521,6 +6336,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) @@ -4573,33 +6392,245 @@ The Set-AzMigrateDiskMapping cmdlet updates a mapping of the source disk attache .Example Set-AzMigrateDiskMapping -DiskID "6000C294-1217-dec3-bc18-81f117220424" -DiskName "ContosoDisk_1" -IsOSDisk "True" -.Outputs -Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IVMwareCbtUpdateDiskInput +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IVMwareCbtUpdateDiskInput +.Link +https://learn.microsoft.com/powershell/module/az.migrate/set-azmigratediskmapping +#> +function Set-AzMigrateDiskMapping { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IVMwareCbtUpdateDiskInput])] +[CmdletBinding(DefaultParameterSetName='VMwareCbt', PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the disk ID of the disk attached to the discovered server to be migrated. + ${DiskID}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the name of the managed disk to be created. + ${DiskName}, + + [Parameter()] + [ArgumentCompleter({ "true" , "false" })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies whether the disk contains the Operating System for the source server to be migrated. + ${IsOSDisk} +) + +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 = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + VMwareCbt = 'Az.Migrate.custom\Set-AzMigrateDiskMapping'; + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $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.Migrate.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 +Updates the target properties for the replicating server. +.Description +The Set-AzMigrateHCIServerReplication cmdlet updates the target properties for the replicating server. +.Example +Set-AzMigrateHCIServerReplication -TargetObjectID '/subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/protectedItems/503a4f02-916c-d6b0-8d14-222bbd4767e5' -TargetVMName "targetName1" +.Example +$memoryConfig = [PSCustomObject]@{ + MinimumMemoryInMegaByte = 1024 + MaximumMemoryInMegaByte = 34816 + TargetMemoryBufferPercentage = 20 +} + +Set-AzMigrateHCIServerReplication -TargetObjectID '/subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/protectedItems/503a4f02-916c-d6b0-8d14-222bbd4767e5' -DynamicMemoryConfig $memoryConfig + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel +.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. + +DYNAMICMEMORYCONFIG : Specifies the dynamic memory configration of RAM. + MaximumMemoryInMegaByte : Gets or sets maximum memory in MB. + MinimumMemoryInMegaByte : Gets or sets minimum memory in MB. + TargetMemoryBufferPercentage : Gets or sets target memory buffer in %. .Link -https://learn.microsoft.com/powershell/module/az.migrate/set-azmigratediskmapping +https://learn.microsoft.com/powershell/module/az.migrate/set-azmigratehciserverreplication #> -function Set-AzMigrateDiskMapping { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IVMwareCbtUpdateDiskInput])] -[CmdletBinding(DefaultParameterSetName='VMwareCbt', PositionalBinding=$false)] +function Set-AzMigrateHCIServerReplication { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel])] +[CmdletBinding(DefaultParameterSetName='ById', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [System.String] - # Specifies the disk ID of the disk attached to the discovered server to be migrated. - ${DiskID}, + # Specifies the replicating server for which the properties need to be updated. + # The ID should be retrieved using the Get-AzMigrateHCIServerReplication cmdlet. + ${TargetObjectID}, [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [System.String] - # Specifies the name of the managed disk to be created. - ${DiskName}, + # Specifies the target VM name. + ${TargetVMName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.Int32] + # Specifies the number of CPU cores. + ${TargetVMCPUCore}, [Parameter()] [ArgumentCompleter({ "true" , "false" })] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [System.String] - # Specifies whether the disk contains the Operating System for the source server to be migrated. - ${IsOSDisk} + # Specifies if RAM is dynamic or not. + ${IsDynamicMemoryEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemDynamicMemoryConfig] + # Specifies the dynamic memory configration of RAM. + # To construct, see NOTES section for DYNAMICMEMORYCONFIG properties and create a hash table. + ${DynamicMemoryConfig}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.Int64] + # Specifies the target RAM size in MB. + ${TargetVMRam}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHCINicInput[]] + # Specifies the nics on the source server to be included for replication. + ${NicToInclude}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} ) begin { @@ -4628,10 +6659,17 @@ begin { } $mapping = @{ - VMwareCbt = 'Az.Migrate.custom\Set-AzMigrateDiskMapping'; + ById = 'Az.Migrate.custom\Set-AzMigrateHCIServerReplication'; + } + if (('ById') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) @@ -4966,6 +7004,244 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $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.Migrate.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 +Starts the migration for the replicating server. +.Description +Starts the migration for the replicating server. +.Example +Start-AzMigrateHCIServerMigration -TargetObjectID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851" +.Example +$InputObject = Get-AzMigrateHCIServerReplication -TargetObjectID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851" + +Start-AzMigrateHCIServerMigration -InputObject $InputObject + +$InputObject | Start-AzMigrateHCIServerMigration + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel +.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 : Specifies the replicating server for which migration needs to be initiated. The server object can be retrieved using the Get-AzMigrateHCIServerReplication cmdlet. + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/start-azmigratehciservermigration +#> +function Start-AzMigrateHCIServerMigration { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel])] +[CmdletBinding(DefaultParameterSetName='ByID', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='ByID', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the replcating server for which migration needs to be initiated. + # The ID should be retrieved using the Get-AzMigrateHCIServerReplication cmdlet. + ${TargetObjectID}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.Management.Automation.SwitchParameter] + # Specifies whether the source server should be turned off post migration. + ${TurnOffSourceServer}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure Subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByInputObject', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # Specifies the replicating server for which migration needs to be initiated. + # The server object can be retrieved using the Get-AzMigrateHCIServerReplication cmdlet. + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + ByID = 'Az.Migrate.custom\Start-AzMigrateHCIServerMigration'; + ByInputObject = 'Az.Migrate.custom\Start-AzMigrateHCIServerMigration'; + } + if (('ByID', 'ByInputObject') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) @@ -5153,6 +7429,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) @@ -5360,6 +7640,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) @@ -5537,6 +7821,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) @@ -5714,6 +8002,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) diff --git a/src/Migrate/Migrate.Autorest/exports/Register-AzMigrateProjectTool.ps1 b/src/Migrate/Migrate.Autorest/exports/Register-AzMigrateProjectTool.ps1 index a32eb8044772..20feb5f42788 100644 --- a/src/Migrate/Migrate.Autorest/exports/Register-AzMigrateProjectTool.ps1 +++ b/src/Migrate/Migrate.Autorest/exports/Register-AzMigrateProjectTool.ps1 @@ -145,6 +145,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) diff --git a/src/Migrate/Migrate.Autorest/exports/Remove-AzMigrateHCIServerReplication.ps1 b/src/Migrate/Migrate.Autorest/exports/Remove-AzMigrateHCIServerReplication.ps1 new file mode 100644 index 000000000000..3126ccc7b10b --- /dev/null +++ b/src/Migrate/Migrate.Autorest/exports/Remove-AzMigrateHCIServerReplication.ps1 @@ -0,0 +1,251 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Stops replication for the migrated server. +.Description +The Remove-AzMigrateHCIServerReplication cmdlet stops the replication for a migrated server. +.Example +Remove-AzMigrateHCIServerReplication -TargetObjectID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851" +.Example +$InputObject = Get-AzMigrateHCIServerReplication -TargetObjectID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851" + +Remove-AzMigrateHCIServerReplication -InputObject $InputObject + +$InputObject | Remove-AzMigrateHCIServerReplication + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel +.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 : Specifies the replcating server for which the replication needs to be disabled. The server object can be retrieved using the Get-AzMigrateHCIServerReplication cmdlet. + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/remove-azmigratehciserverreplication +#> +function Remove-AzMigrateHCIServerReplication { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel])] +[CmdletBinding(DefaultParameterSetName='ByID', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='ByID', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the replcating server for which the replication needs to be disabled. + # The ID should be retrieved using the Get-AzMigrateHCIServerReplication cmdlet. + ${TargetObjectID}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure Subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByInputObject', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # Specifies the replcating server for which the replication needs to be disabled. + # The server object can be retrieved using the Get-AzMigrateHCIServerReplication cmdlet. + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [ArgumentCompleter({ "true" , "false" })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')] + [System.String] + # Specifies whether the replication needs to be force removed. + # Default to "false". + ${ForceRemove}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + ByID = 'Az.Migrate.custom\Remove-AzMigrateHCIServerReplication'; + ByInputObject = 'Az.Migrate.custom\Remove-AzMigrateHCIServerReplication'; + } + if (('ByID', 'ByInputObject') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $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.Migrate.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/src/Migrate/Migrate.Autorest/exports/Remove-AzMigrateProject.ps1 b/src/Migrate/Migrate.Autorest/exports/Remove-AzMigrateProject.ps1 index 6b13611847f9..848cb0cfacd5 100644 --- a/src/Migrate/Migrate.Autorest/exports/Remove-AzMigrateProject.ps1 +++ b/src/Migrate/Migrate.Autorest/exports/Remove-AzMigrateProject.ps1 @@ -148,6 +148,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) diff --git a/src/Migrate/Migrate.Autorest/exports/Remove-AzMigrateServerReplication.ps1 b/src/Migrate/Migrate.Autorest/exports/Remove-AzMigrateServerReplication.ps1 index 642d714d2099..9da76b8598e5 100644 --- a/src/Migrate/Migrate.Autorest/exports/Remove-AzMigrateServerReplication.ps1 +++ b/src/Migrate/Migrate.Autorest/exports/Remove-AzMigrateServerReplication.ps1 @@ -32,7 +32,7 @@ COMPLEX PARAMETER PROPERTIES To 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 : Specifies the machine object of the replicating server. +INPUTOBJECT : Specifies the replcating server for which the replication needs to be disabled. The server object should be retrieved using the Get-AzMigrateServerReplication cmdlet. [Location ]: Resource Location [ProviderSpecificDetail ]: The migration provider custom settings. InstanceType : Gets the instance type. @@ -46,7 +46,7 @@ param( [Parameter(ParameterSetName='ByIDVMwareCbt', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [System.String] - # Specifies the replcating server for which the replicatio needs to be disabled. + # Specifies the replcating server for which the replication needs to be disabled. # The ID should be retrieved using the Get-AzMigrateServerReplication cmdlet. ${TargetObjectID}, @@ -60,7 +60,8 @@ param( [Parameter(ParameterSetName='ByInputObjectVMwareCbt', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem] - # Specifies the machine object of the replicating server. + # Specifies the replcating server for which the replication needs to be disabled. + # The server object should be retrieved using the Get-AzMigrateServerReplication cmdlet. # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, @@ -152,6 +153,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) diff --git a/src/Migrate/Migrate.Autorest/exports/Restart-AzMigrateServerReplication.ps1 b/src/Migrate/Migrate.Autorest/exports/Restart-AzMigrateServerReplication.ps1 index 449663826ac7..ccd094a2c252 100644 --- a/src/Migrate/Migrate.Autorest/exports/Restart-AzMigrateServerReplication.ps1 +++ b/src/Migrate/Migrate.Autorest/exports/Restart-AzMigrateServerReplication.ps1 @@ -146,6 +146,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) diff --git a/src/Migrate/Migrate.Autorest/exports/Resume-AzMigrateServerReplication.ps1 b/src/Migrate/Migrate.Autorest/exports/Resume-AzMigrateServerReplication.ps1 index 92d23cb7dc33..9d4fa23a2226 100644 --- a/src/Migrate/Migrate.Autorest/exports/Resume-AzMigrateServerReplication.ps1 +++ b/src/Migrate/Migrate.Autorest/exports/Resume-AzMigrateServerReplication.ps1 @@ -159,6 +159,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) diff --git a/src/Migrate/Migrate.Autorest/exports/Set-AzMigrateDiskMapping.ps1 b/src/Migrate/Migrate.Autorest/exports/Set-AzMigrateDiskMapping.ps1 index 1561b47a7d7a..4d3af3b8c639 100644 --- a/src/Migrate/Migrate.Autorest/exports/Set-AzMigrateDiskMapping.ps1 +++ b/src/Migrate/Migrate.Autorest/exports/Set-AzMigrateDiskMapping.ps1 @@ -81,6 +81,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) diff --git a/src/Migrate/Migrate.Autorest/exports/Set-AzMigrateHCIServerReplication.ps1 b/src/Migrate/Migrate.Autorest/exports/Set-AzMigrateHCIServerReplication.ps1 new file mode 100644 index 000000000000..a411b659c8b7 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/exports/Set-AzMigrateHCIServerReplication.ps1 @@ -0,0 +1,230 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Updates the target properties for the replicating server. +.Description +The Set-AzMigrateHCIServerReplication cmdlet updates the target properties for the replicating server. +.Example +Set-AzMigrateHCIServerReplication -TargetObjectID '/subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/protectedItems/503a4f02-916c-d6b0-8d14-222bbd4767e5' -TargetVMName "targetName1" +.Example +$memoryConfig = [PSCustomObject]@{ + MinimumMemoryInMegaByte = 1024 + MaximumMemoryInMegaByte = 34816 + TargetMemoryBufferPercentage = 20 +} + +Set-AzMigrateHCIServerReplication -TargetObjectID '/subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/protectedItems/503a4f02-916c-d6b0-8d14-222bbd4767e5' -DynamicMemoryConfig $memoryConfig + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel +.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. + +DYNAMICMEMORYCONFIG : Specifies the dynamic memory configration of RAM. + MaximumMemoryInMegaByte : Gets or sets maximum memory in MB. + MinimumMemoryInMegaByte : Gets or sets minimum memory in MB. + TargetMemoryBufferPercentage : Gets or sets target memory buffer in %. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/set-azmigratehciserverreplication +#> +function Set-AzMigrateHCIServerReplication { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel])] +[CmdletBinding(DefaultParameterSetName='ById', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the replicating server for which the properties need to be updated. + # The ID should be retrieved using the Get-AzMigrateHCIServerReplication cmdlet. + ${TargetObjectID}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the target VM name. + ${TargetVMName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.Int32] + # Specifies the number of CPU cores. + ${TargetVMCPUCore}, + + [Parameter()] + [ArgumentCompleter({ "true" , "false" })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies if RAM is dynamic or not. + ${IsDynamicMemoryEnabled}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemDynamicMemoryConfig] + # Specifies the dynamic memory configration of RAM. + # To construct, see NOTES section for DYNAMICMEMORYCONFIG properties and create a hash table. + ${DynamicMemoryConfig}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.Int64] + # Specifies the target RAM size in MB. + ${TargetVMRam}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHCINicInput[]] + # Specifies the nics on the source server to be included for replication. + ${NicToInclude}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription Id. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + ById = 'Az.Migrate.custom\Set-AzMigrateHCIServerReplication'; + } + if (('ById') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $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.Migrate.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/src/Migrate/Migrate.Autorest/exports/Set-AzMigrateServerReplication.ps1 b/src/Migrate/Migrate.Autorest/exports/Set-AzMigrateServerReplication.ps1 index 39563ccec279..83279d409447 100644 --- a/src/Migrate/Migrate.Autorest/exports/Set-AzMigrateServerReplication.ps1 +++ b/src/Migrate/Migrate.Autorest/exports/Set-AzMigrateServerReplication.ps1 @@ -304,6 +304,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) diff --git a/src/Migrate/Migrate.Autorest/exports/Start-AzMigrateHCIServerMigration.ps1 b/src/Migrate/Migrate.Autorest/exports/Start-AzMigrateHCIServerMigration.ps1 new file mode 100644 index 000000000000..8a9ca19373d6 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/exports/Start-AzMigrateHCIServerMigration.ps1 @@ -0,0 +1,249 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Starts the migration for the replicating server. +.Description +Starts the migration for the replicating server. +.Example +Start-AzMigrateHCIServerMigration -TargetObjectID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851" +.Example +$InputObject = Get-AzMigrateHCIServerReplication -TargetObjectID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851" + +Start-AzMigrateHCIServerMigration -InputObject $InputObject + +$InputObject | Start-AzMigrateHCIServerMigration + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel +.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 : Specifies the replicating server for which migration needs to be initiated. The server object can be retrieved using the Get-AzMigrateHCIServerReplication cmdlet. + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/start-azmigratehciservermigration +#> +function Start-AzMigrateHCIServerMigration { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel])] +[CmdletBinding(DefaultParameterSetName='ByID', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='ByID', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Specifies the replcating server for which migration needs to be initiated. + # The ID should be retrieved using the Get-AzMigrateHCIServerReplication cmdlet. + ${TargetObjectID}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.Management.Automation.SwitchParameter] + # Specifies whether the source server should be turned off post migration. + ${TurnOffSourceServer}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure Subscription ID. + ${SubscriptionId}, + + [Parameter(ParameterSetName='ByInputObject', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # Specifies the replicating server for which migration needs to be initiated. + # The server object can be retrieved using the Get-AzMigrateHCIServerReplication cmdlet. + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = $PSVersionTable.PSVersion.ToString() + } + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId + if ($preTelemetryId -eq '') { + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + ByID = 'Az.Migrate.custom\Start-AzMigrateHCIServerMigration'; + ByInputObject = 'Az.Migrate.custom\Start-AzMigrateHCIServerMigration'; + } + if (('ByID', 'ByInputObject') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $cmdInfo = Get-Command -Name $mapping[$parameterSet] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } + $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.Migrate.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/src/Migrate/Migrate.Autorest/exports/Start-AzMigrateServerMigration.ps1 b/src/Migrate/Migrate.Autorest/exports/Start-AzMigrateServerMigration.ps1 index 3bb401e6ebd3..d340002dfbe5 100644 --- a/src/Migrate/Migrate.Autorest/exports/Start-AzMigrateServerMigration.ps1 +++ b/src/Migrate/Migrate.Autorest/exports/Start-AzMigrateServerMigration.ps1 @@ -157,6 +157,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) diff --git a/src/Migrate/Migrate.Autorest/exports/Start-AzMigrateTestMigration.ps1 b/src/Migrate/Migrate.Autorest/exports/Start-AzMigrateTestMigration.ps1 index 67eec38d61c2..4db157f2d3cf 100644 --- a/src/Migrate/Migrate.Autorest/exports/Start-AzMigrateTestMigration.ps1 +++ b/src/Migrate/Migrate.Autorest/exports/Start-AzMigrateTestMigration.ps1 @@ -177,6 +177,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) diff --git a/src/Migrate/Migrate.Autorest/exports/Start-AzMigrateTestMigrationCleanup.ps1 b/src/Migrate/Migrate.Autorest/exports/Start-AzMigrateTestMigrationCleanup.ps1 index 9f882e5c1c3f..78f30845cc99 100644 --- a/src/Migrate/Migrate.Autorest/exports/Start-AzMigrateTestMigrationCleanup.ps1 +++ b/src/Migrate/Migrate.Autorest/exports/Start-AzMigrateTestMigrationCleanup.ps1 @@ -147,6 +147,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) diff --git a/src/Migrate/Migrate.Autorest/exports/Suspend-AzMigrateServerReplication.ps1 b/src/Migrate/Migrate.Autorest/exports/Suspend-AzMigrateServerReplication.ps1 index e1fccdab89a0..31f49a3e37d8 100644 --- a/src/Migrate/Migrate.Autorest/exports/Suspend-AzMigrateServerReplication.ps1 +++ b/src/Migrate/Migrate.Autorest/exports/Suspend-AzMigrateServerReplication.ps1 @@ -147,6 +147,10 @@ begin { } $cmdInfo = Get-Command -Name $mapping[$parameterSet] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) + } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) $scriptCmd = {& $wrappedCmd @PSBoundParameters} $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) diff --git a/src/Migrate/Migrate.Autorest/generate-help.ps1 b/src/Migrate/Migrate.Autorest/generate-help.ps1 index 6904e5df16e0..e473c5e45d70 100644 --- a/src/Migrate/Migrate.Autorest/generate-help.ps1 +++ b/src/Migrate/Migrate.Autorest/generate-help.ps1 @@ -66,8 +66,8 @@ foreach($directory in $directories) $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 + $addComplexInterfaceInfo = ![System.Convert]::ToBoolean('true') + Export-HelpMarkdown -ModuleInfo $moduleInfo -FunctionInfo $cmdletFunctionInfo -HelpInfo $cmdletHelpInfo -DocsFolder $docsPath -ExamplesFolder $examplesPath -AddComplexInterfaceInfo:$addComplexInterfaceInfo Write-Host -ForegroundColor Green "Created documentation in '$docsPath'" } diff --git a/src/Migrate/Migrate.Autorest/generate-portal-ux.ps1 b/src/Migrate/Migrate.Autorest/generate-portal-ux.ps1 new file mode 100644 index 000000000000..81e93b40e5f2 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generate-portal-ux.ps1 @@ -0,0 +1,375 @@ +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# +# This Script will create a folder dedicated to Azure-specific content and includes metadata files essential for enhancing the user experience (UX) within the Azure portal. +# These files are utilized by the Azure portal to effectively present the usage of cmdlets related to specific resources on portal pages. +# ---------------------------------------------------------------------------------- +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 +} + +$moduleName = 'Az.Migrate' +$rootModuleName = '' +if ($rootModuleName -eq "") +{ + $rootModuleName = $moduleName +} +$modulePsd1 = Get-Item -Path (Join-Path $PSScriptRoot "./$moduleName.psd1") +$modulePath = $modulePsd1.FullName + +# Load DLL to use build-time cmdlets +Import-Module -Name $modulePath +Import-Module -Name (Join-Path $PSScriptRoot "./bin/$moduleName.private.dll") +$instance = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module]::Instance +# Module info is shared per profile +$moduleInfo = Get-Module -Name $moduleName +$parameterSetsInfo = Get-Module -Name "$moduleName.private" + +$buildinFunctions = @("Export-CmdletSurface", "Export-ExampleStub", "Export-FormatPs1xml", "Export-HelpMarkdown", "Export-ModelSurface", "Export-ProxyCmdlet", "Export-Psd1", "Export-TestStub", "Get-CommonParameter", "Get-ModuleGuid", "Get-ScriptCmdlet") + +function Test-FunctionSupported() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [string] + $FunctionName + ) + + If ($buildinfunctions.Contains($FunctionName)) { + return $false + } + + $cmdletName, $parameterSetName = $FunctionName.Split("_") + If ($parameterSetName.Contains("List") -or $parameterSetName.Contains("ViaIdentity")) { + return $false + } + If ($cmdletName.StartsWith("New") -or $cmdletName.StartsWith("Set") -or $cmdletName.StartsWith("Update")) { + return $false + } + + $parameterSetInfo = $parameterSetsInfo.ExportedCmdlets[$FunctionName] + foreach ($parameterInfo in $parameterSetInfo.Parameters.Values) + { + $category = (Get-ParameterAttribute -ParameterInfo $parameterInfo -AttributeName "CategoryAttribute").Categories + $invalideCategory = @('Query', 'Body') + if ($invalideCategory -contains $category) + { + return $false + } + } + + $customFiles = Get-ChildItem -Path custom -Filter "$cmdletName.*" + if ($customFiles.Length -ne 0) + { + return $false + } + + return $true +} + +function Get-MappedCmdletFromFunctionName() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [string] + $FunctionName + ) + + $cmdletName, $parameterSetName = $FunctionName.Split("_") + + return $cmdletName +} + +function Get-ParameterAttribute() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [System.Management.Automation.ParameterMetadata] + $ParameterInfo, + [Parameter()] + [String] + $AttributeName + ) + return $ParameterInfo.Attributes | Where-Object { $_.TypeId.Name -eq $AttributeName } +} + +function Get-CmdletAttribute() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [System.Management.Automation.CommandInfo] + $CmdletInfo, + [Parameter()] + [String] + $AttributeName + ) + + return $CmdletInfo.ImplementingType.GetTypeInfo().GetCustomAttributes([System.object], $true) | Where-Object { $_.TypeId.Name -eq $AttributeName } +} + +function Get-CmdletDescription() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [String] + $CmdletName + ) + $helpInfo = Get-Help $CmdletName -Full + + $description = $helpInfo.Description.Text + if ($null -eq $description) + { + return "" + } + return $description +} + +# Test whether the parameter is from swagger http path +function Test-ParameterFromSwagger() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [System.Management.Automation.ParameterMetadata] + $ParameterInfo + ) + $category = (Get-ParameterAttribute -ParameterInfo $ParameterInfo -AttributeName "CategoryAttribute").Categories + $doNotExport = Get-ParameterAttribute -ParameterInfo $ParameterInfo -AttributeName "DoNotExportAttribute" + if ($null -ne $doNotExport) + { + return $false + } + + $valideCategory = @('Path') + if ($valideCategory -contains $category) + { + return $true + } + return $false +} + +function New-ExampleForParameterSet() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [System.Management.Automation.CommandInfo] + $ParameterSetInfo + ) + $parameters = $ParameterSetInfo.Parameters.Values | Where-Object { Test-ParameterFromSwagger $_ } + $result = @() + foreach ($parameter in $parameters) + { + $category = (Get-ParameterAttribute -parameterInfo $parameter -AttributeName "CategoryAttribute").Categories + $sourceName = (Get-ParameterAttribute -parameterInfo $parameter -AttributeName "InfoAttribute").SerializedName + $name = $parameter.Name + $result += [ordered]@{ + name = "-$Name" + value = "[$category.$sourceName]" + } + } + + return $result +} + +function New-ParameterArrayInParameterSet() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [System.Management.Automation.CommandInfo] + $ParameterSetInfo + ) + $parameters = $ParameterSetInfo.Parameters.Values | Where-Object { Test-ParameterFromSwagger $_ } + $result = @() + foreach ($parameter in $parameters) + { + $isMandatory = (Get-ParameterAttribute -parameterInfo $parameter -AttributeName "ParameterAttribute").Mandatory + $parameterName = $parameter.Name + $parameterType = $parameter.ParameterType.ToString().Split('.')[1] + if ($parameter.SwitchParameter) + { + $parameterSignature = "-$parameterName" + } + else + { + $parameterSignature = "-$parameterName <$parameterType>" + } + if ($parameterName -eq "SubscriptionId") + { + $isMandatory = $false + } + if (-not $isMandatory) + { + $parameterSignature = "[$parameterSignature]" + } + $result += $parameterSignature + } + + return $result +} + +function New-MetadataForParameterSet() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [System.Management.Automation.CommandInfo] + $ParameterSetInfo + ) + $httpAttribute = Get-CmdletAttribute -CmdletInfo $ParameterSetInfo -AttributeName "HttpPathAttribute" + $httpPath = $httpAttribute.Path + $apiVersion = $httpAttribute.ApiVersion + $provider = [System.Text.RegularExpressions.Regex]::New("/providers/([\w+\.]+)/").Match($httpPath).Groups[1].Value + $resourcePath = "/" + $httpPath.Split("$provider/")[1] + $resourceType = [System.Text.RegularExpressions.Regex]::New("/([\w]+)/\{\w+\}").Matches($resourcePath) | ForEach-Object {$_.groups[1].Value} | Join-String -Separator "/" + $cmdletName = Get-MappedCmdletFromFunctionName $ParameterSetInfo.Name + $description = (Get-CmdletAttribute -CmdletInfo $ParameterSetInfo -AttributeName "DescriptionAttribute").Description + [object[]]$example = New-ExampleForParameterSet $ParameterSetInfo + [string[]]$signature = New-ParameterArrayInParameterSet $ParameterSetInfo + + return @{ + Path = $httpPath + Provider = $provider + ResourceType = $resourceType + ApiVersion = $apiVersion + CmdletName = $cmdletName + Description = $description + Example = $example + Signature = @{ + parameters = $signature + } + } +} + +function Merge-WithExistCmdletMetadata() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [System.Collections.Specialized.OrderedDictionary] + $ExistedCmdletInfo, + [Parameter()] + [Hashtable] + $ParameterSetMetadata + ) + $ExistedCmdletInfo.help.parameterSets += $ParameterSetMetadata.Signature + $ExistedCmdletInfo.examples += [ordered]@{ + description = $ParameterSetMetadata.Description + parameters = $ParameterSetMetadata.Example + } + + return $ExistedCmdletInfo +} + +function New-MetadataForCmdlet() +{ + [CmdletBinding()] + Param ( + [Parameter()] + [Hashtable] + $ParameterSetMetadata + ) + $cmdletName = $ParameterSetMetadata.CmdletName + $description = Get-CmdletDescription $cmdletName + $result = [ordered]@{ + name = $cmdletName + description = $description + path = $ParameterSetMetadata.Path + help = [ordered]@{ + learnMore = [ordered]@{ + url = "https://learn.microsoft.com/powershell/module/$rootModuleName/$cmdletName".ToLower() + } + parameterSets = @() + } + examples = @() + } + $result = Merge-WithExistCmdletMetadata -ExistedCmdletInfo $result -ParameterSetMetadata $ParameterSetMetadata + return $result +} + +$parameterSets = $parameterSetsInfo.ExportedCmdlets.Keys | Where-Object { Test-functionSupported($_) } +$resourceTypes = @{} +foreach ($parameterSetName in $parameterSets) +{ + $cmdletInfo = $parameterSetsInfo.ExportedCommands[$parameterSetName] + $parameterSetMetadata = New-MetadataForParameterSet -ParameterSetInfo $cmdletInfo + $cmdletName = $parameterSetMetadata.CmdletName + if (-not ($moduleInfo.ExportedCommands.ContainsKey($cmdletName))) + { + continue + } + if ($resourceTypes.ContainsKey($parameterSetMetadata.ResourceType)) + { + $ExistedCmdletInfo = $resourceTypes[$parameterSetMetadata.ResourceType].commands | Where-Object { $_.name -eq $cmdletName } + if ($ExistedCmdletInfo) + { + $ExistedCmdletInfo = Merge-WithExistCmdletMetadata -ExistedCmdletInfo $ExistedCmdletInfo -ParameterSetMetadata $parameterSetMetadata + } + else + { + $cmdletInfo = New-MetadataForCmdlet -ParameterSetMetadata $parameterSetMetadata + $resourceTypes[$parameterSetMetadata.ResourceType].commands += $cmdletInfo + } + } + else + { + $cmdletInfo = New-MetadataForCmdlet -ParameterSetMetadata $parameterSetMetadata + $resourceTypes[$parameterSetMetadata.ResourceType] = [ordered]@{ + resourceType = $parameterSetMetadata.ResourceType + apiVersion = $parameterSetMetadata.ApiVersion + learnMore = @{ + url = "https://learn.microsoft.com/powershell/module/$rootModuleName".ToLower() + } + commands = @($cmdletInfo) + provider = $parameterSetMetadata.Provider + } + } +} + +$UXFolder = 'UX' +if (Test-Path $UXFolder) +{ + Remove-Item -Path $UXFolder -Recurse +} +$null = New-Item -ItemType Directory -Path $UXFolder + +foreach ($resourceType in $resourceTypes.Keys) +{ + $resourceTypeFileName = $resourceType -replace "/", "-" + if ($resourceTypeFileName -eq "") + { + continue + } + $resourceTypeInfo = $resourceTypes[$resourceType] + $provider = $resourceTypeInfo.provider + $providerFolder = "$UXFolder/$provider" + if (-not (Test-Path $providerFolder)) + { + $null = New-Item -ItemType Directory -Path $providerFolder + } + $resourceTypeInfo.Remove("provider") + $resourceTypeInfo | ConvertTo-Json -Depth 10 | Out-File "$providerFolder/$resourceTypeFileName.json" +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Migrate.cs b/src/Migrate/Migrate.Autorest/generated/api/Migrate.cs index 227273888c9e..a7c899cb541b 100644 --- a/src/Migrate/Migrate.Autorest/generated/api/Migrate.cs +++ b/src/Migrate/Migrate.Autorest/generated/api/Migrate.cs @@ -14,6 +14,180 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate public partial class Migrate { + /// Checks the resource name availability. + /// Azure Subscription Id in which migrate project was created. + /// The name of the Azure region. + /// Resource details. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task CheckNameAvailability(string subscriptionId, string location, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ICheckNameAvailabilityModel body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + { + var apiVersion = @"2021-02-16-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.DataReplication/locations/" + + global::System.Uri.EscapeDataString(location) + + "/checkNameAvailability" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.CheckNameAvailability_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Checks the resource name availability. + /// + /// Resource details. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task CheckNameAvailabilityViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ICheckNameAvailabilityModel body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + { + var apiVersion = @"2021-02-16-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.DataReplication/locations/(?[^/]+)/checkNameAvailability$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/locations/{location}/checkNameAvailability'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var location = _match.Groups["location"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/providers/Microsoft.DataReplication/locations/" + + location + + "/checkNameAvailability" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.CheckNameAvailability_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 CheckNameAvailability_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.CheckNameAvailabilityResponseModel.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// + /// Azure Subscription Id in which migrate project was created. + /// The name of the Azure region. + /// Resource details. + /// 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 CheckNameAvailability_Validate(string subscriptionId, string location, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ICheckNameAvailabilityModel body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(location),location); + await eventListener.AssertMinimumLength(nameof(location),location,1); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + /// Gets a database instance in the migrate project. /// Azure Subscription Id in which migrate project was created. /// Name of the Azure Resource Group that migrate project is part of. @@ -768,22 +942,22 @@ public partial class Migrate } } - /// - /// Delete the migrate event. Deleting non-existent migrate event is a no-operation. - /// + /// Performs resource deployment validation. /// Azure Subscription Id in which migrate project was created. - /// Name of the Azure Resource Group that migrate project is part of. - /// Name of the Azure Migrate project. - /// Unique name of an event within a migrate project. + /// The name of the resource group. The name is case insensitive. + /// Deployment Id. + /// Deployment preflight model. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task EventsDeleteEvent(string subscriptionId, string resourceGroupName, string migrateProjectName, string eventName, global::System.Func onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task DeploymentPreflight(string subscriptionId, string resourceGroupName, string deploymentId, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightModel body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2018-09-01-preview"; + var apiVersion = @"2021-02-16-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -793,10 +967,9 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.Migrate/migrateProjects/" - + global::System.Uri.EscapeDataString(migrateProjectName) - + "/migrateEvents/" - + global::System.Uri.EscapeDataString(eventName) + + "/providers/Microsoft.DataReplication/deployments/" + + global::System.Uri.EscapeDataString(deploymentId) + + "/preflight" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -805,54 +978,57 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.EventsDeleteEvent_Call(request,onOk,eventListener,sender); + await this.DeploymentPreflight_Call(request,onOk,onDefault,eventListener,sender); } } - /// - /// Delete the migrate event. Deleting non-existent migrate event is a no-operation. - /// + /// Performs resource deployment validation. /// + /// Deployment preflight model. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task EventsDeleteEventViaIdentity(global::System.String viaIdentity, global::System.Func onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task DeploymentPreflightViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightModel body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2018-09-01-preview"; + var apiVersion = @"2021-02-16-preview"; // 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.Migrate/migrateProjects/(?[^/]+)/migrateEvents/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataReplication/deployments/(?[^/]+)/preflight$", 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.Migrate/migrateProjects/{migrateProjectName}/migrateEvents/{eventName}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/deployments/{deploymentId}/preflight'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var migrateProjectName = _match.Groups["migrateProjectName"].Value; - var eventName = _match.Groups["eventName"].Value; + var deploymentId = _match.Groups["deploymentId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.Migrate/migrateProjects/" - + migrateProjectName - + "/migrateEvents/" - + eventName + + "/providers/Microsoft.DataReplication/deployments/" + + deploymentId + + "/preflight" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -861,24 +1037,30 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.EventsDeleteEvent_Call(request,onOk,eventListener,sender); + await this.DeploymentPreflight_Call(request,onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 EventsDeleteEvent_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task DeploymentPreflight_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -896,12 +1078,14 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.DeploymentPreflightModel.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { - throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; } } } @@ -916,42 +1100,48 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation + /// Validation method for method. Call this like the actual call, but you will get validation /// events back. /// /// Azure Subscription Id in which migrate project was created. - /// Name of the Azure Resource Group that migrate project is part of. - /// Name of the Azure Migrate project. - /// Unique name of an event within a migrate project. + /// The name of the resource group. The name is case insensitive. + /// Deployment Id. + /// Deployment preflight model. /// 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 EventsDeleteEvent_Validate(string subscriptionId, string resourceGroupName, string migrateProjectName, string eventName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task DeploymentPreflight_Validate(string subscriptionId, string resourceGroupName, string deploymentId, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightModel body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(migrateProjectName),migrateProjectName); - await eventListener.AssertNotNull(nameof(eventName),eventName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(deploymentId),deploymentId); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// Gets an event in the migrate project. + /// Creates the fabric agent. /// Azure Subscription Id in which migrate project was created. - /// Name of the Azure Resource Group that migrate project is part of. - /// Name of the Azure Migrate project. - /// Unique name of an event within a migrate project. + /// The name of the resource group. The name is case insensitive. + /// The fabric name. + /// The fabric agent (Dra) name. + /// Dra model. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task EventsGetEvent(string subscriptionId, string resourceGroupName, string migrateProjectName, string eventName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task DraCreate(string subscriptionId, string resourceGroupName, string fabricName, string fabricAgentName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModel body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2018-09-01-preview"; + var apiVersion = @"2021-02-16-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -961,10 +1151,10 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.Migrate/migrateProjects/" - + global::System.Uri.EscapeDataString(migrateProjectName) - + "/migrateEvents/" - + global::System.Uri.EscapeDataString(eventName) + + "/providers/Microsoft.DataReplication/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/fabricAgents/" + + global::System.Uri.EscapeDataString(fabricAgentName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -973,52 +1163,59 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.EventsGetEvent_Call(request,onOk,eventListener,sender); + await this.DraCreate_Call(request,onOk,onDefault,eventListener,sender); } } - /// Gets an event in the migrate project. + /// Creates the fabric agent. /// + /// Dra model. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task EventsGetEventViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task DraCreateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModel body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2018-09-01-preview"; + var apiVersion = @"2021-02-16-preview"; // 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.Migrate/migrateProjects/(?[^/]+)/migrateEvents/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataReplication/replicationFabrics/(?[^/]+)/fabricAgents/(?[^/]+)$", 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.Migrate/migrateProjects/{migrateProjectName}/migrateEvents/{eventName}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var migrateProjectName = _match.Groups["migrateProjectName"].Value; - var eventName = _match.Groups["eventName"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var fabricAgentName = _match.Groups["fabricAgentName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.Migrate/migrateProjects/" - + migrateProjectName - + "/migrateEvents/" - + eventName + + "/providers/Microsoft.DataReplication/replicationFabrics/" + + fabricName + + "/fabricAgents/" + + fabricAgentName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -1027,24 +1224,30 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.EventsGetEvent_Call(request,onOk,eventListener,sender); + await this.DraCreate_Call(request,onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 EventsGetEvent_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task DraCreate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -1055,6 +1258,103 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -1062,12 +1362,14 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.MigrateEvent.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.DraModel.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { - throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; } } } @@ -1082,45 +1384,51 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation - /// events back. + /// Validation method for method. Call this like the actual call, but you will get validation events + /// back. /// /// Azure Subscription Id in which migrate project was created. - /// Name of the Azure Resource Group that migrate project is part of. - /// Name of the Azure Migrate project. - /// Unique name of an event within a migrate project. + /// The name of the resource group. The name is case insensitive. + /// The fabric name. + /// The fabric agent (Dra) name. + /// Dra model. /// 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 EventsGetEvent_Validate(string subscriptionId, string resourceGroupName, string migrateProjectName, string eventName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task DraCreate_Validate(string subscriptionId, string resourceGroupName, string fabricName, string fabricAgentName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModel body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(migrateProjectName),migrateProjectName); - await eventListener.AssertNotNull(nameof(eventName),eventName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertRegEx(nameof(fabricName),fabricName,@"^[a-zA-Z0-9]*$"); + await eventListener.AssertNotNull(nameof(fabricAgentName),fabricAgentName); + await eventListener.AssertRegEx(nameof(fabricAgentName),fabricAgentName,@"^[a-zA-Z0-9]*$"); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// Gets a list of events in the migrate project. + /// Deletes the fabric agent. /// Azure Subscription Id in which migrate project was created. - /// Name of the Azure Resource Group that migrate project is part of. - /// Name of the Azure Migrate project. - /// The continuation token. - /// The number of items to be returned in a single page. This value is honored only if it is less than - /// the 100. - /// Standard request header. Used by service to respond to client in appropriate language. - /// a delegate that is called when the remote service returns 200 (OK). + /// The name of the resource group. The name is case insensitive. + /// The fabric name. + /// The fabric agent (Dra) name. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task EventsList(string subscriptionId, string resourceGroupName, string migrateProjectName, string continuationToken, int? pageSize, string acceptLanguage, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task DraDelete(string subscriptionId, string resourceGroupName, string fabricName, string fabricAgentName, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2018-09-01-preview"; + var apiVersion = @"2021-02-16-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -1130,111 +1438,94 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.Migrate/migrateProjects/" - + global::System.Uri.EscapeDataString(migrateProjectName) - + "/migrateEvents" + + "/providers/Microsoft.DataReplication/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/fabricAgents/" + + global::System.Uri.EscapeDataString(fabricAgentName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) - + "&" - + (string.IsNullOrEmpty(continuationToken) ? global::System.String.Empty : "continuationToken=" + global::System.Uri.EscapeDataString(continuationToken)) - + "&" - + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - // add headers parameters - if (null != acceptLanguage) - { - request.Headers.Add("Accept-Language",acceptLanguage); - } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.EventsList_Call(request,onOk,eventListener,sender); + await this.DraDelete_Call(request,onNoContent,onDefault,eventListener,sender); } } - /// Gets a list of events in the migrate project. + /// Deletes the fabric agent. /// - /// The continuation token. - /// The number of items to be returned in a single page. This value is honored only if it is less than - /// the 100. - /// Standard request header. Used by service to respond to client in appropriate language. - /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task EventsListViaIdentity(global::System.String viaIdentity, string continuationToken, int? pageSize, string acceptLanguage, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task DraDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2018-09-01-preview"; + var apiVersion = @"2021-02-16-preview"; // 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.Migrate/migrateProjects/(?[^/]+)/migrateEvents$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataReplication/replicationFabrics/(?[^/]+)/fabricAgents/(?[^/]+)$", 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.Migrate/migrateProjects/{migrateProjectName}/migrateEvents'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var migrateProjectName = _match.Groups["migrateProjectName"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var fabricAgentName = _match.Groups["fabricAgentName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.Migrate/migrateProjects/" - + migrateProjectName - + "/migrateEvents" + + "/providers/Microsoft.DataReplication/replicationFabrics/" + + fabricName + + "/fabricAgents/" + + fabricAgentName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) - + "&" - + (string.IsNullOrEmpty(continuationToken) ? global::System.String.Empty : "continuationToken=" + global::System.Uri.EscapeDataString(continuationToken)) - + "&" - + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - // add headers parameters - if (null != acceptLanguage) - { - request.Headers.Add("Accept-Language",acceptLanguage); - } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.EventsList_Call(request,onOk,eventListener,sender); + await this.DraDelete_Call(request,onNoContent,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 EventsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task DraDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -1245,87 +1536,187 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - var _contentType = _response.Content.Headers.ContentType?.MediaType; - - switch ( _response.StatusCode ) + // 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 ) { - case global::System.Net.HttpStatusCode.OK: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.EventCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; + + // 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.Migrate.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"); } - default: - { - throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); } - } - } - finally - { - // finally statements - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Finally, request, _response); - _response?.Dispose(); - request?.Dispose(); - } - } - } + 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.Migrate.Runtime.Method.Get); - /// - /// Validation method for method. Call this like the actual call, but you will get validation events - /// back. - /// - /// Azure Subscription Id in which migrate project was created. - /// Name of the Azure Resource Group that migrate project is part of. - /// Name of the Azure Migrate project. - /// The continuation token. - /// The number of items to be returned in a single page. This value is honored only if it is less than - /// the 100. - /// Standard request header. Used by service to respond to client in appropriate language. - /// 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 EventsList_Validate(string subscriptionId, string resourceGroupName, string migrateProjectName, string continuationToken, int? pageSize, string acceptLanguage, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) - { - using( NoSynchronizationContext ) - { - await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); - await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(migrateProjectName),migrateProjectName); - await eventListener.AssertNotNull(nameof(continuationToken),continuationToken); - await eventListener.AssertNotNull(nameof(acceptLanguage),acceptLanguage); - } - } + // 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; - /// Method to create or update a cluster in site. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// Site name. - /// Cluster ARM name. - /// Put cluster body. - /// a delegate that is called when the remote service returns 202 (Accepted). - /// an instance that will receive events. - /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. - /// - /// A that will be complete when handling of the response is completed. - /// - public async global::System.Threading.Tasks.Task HyperVClusterCreateOrUpdate(string subscriptionId, string resourceGroupName, string siteName, string clusterName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVCluster body, global::System.Func onAccepted, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) - { - var apiVersion = @"2020-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.OffAzure/HyperVSites/" - + global::System.Uri.EscapeDataString(siteName) - + "/clusters/" - + global::System.Uri.EscapeDataString(clusterName) + // 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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// + /// Azure Subscription Id in which migrate project was created. + /// The name of the resource group. The name is case insensitive. + /// The fabric name. + /// The fabric agent (Dra) 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 DraDelete_Validate(string subscriptionId, string resourceGroupName, string fabricName, string fabricAgentName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertRegEx(nameof(fabricName),fabricName,@"^[a-zA-Z0-9]*$"); + await eventListener.AssertNotNull(nameof(fabricAgentName),fabricAgentName); + await eventListener.AssertRegEx(nameof(fabricAgentName),fabricAgentName,@"^[a-zA-Z0-9]*$"); + } + } + + /// Gets the details of the fabric agent. + /// Azure Subscription Id in which migrate project was created. + /// The name of the resource group. The name is case insensitive. + /// The fabric name. + /// The fabric agent (Dra) name. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task DraGet(string subscriptionId, string resourceGroupName, string fabricName, string fabricAgentName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + { + var apiVersion = @"2021-02-16-preview"; + // 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.DataReplication/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/fabricAgents/" + + global::System.Uri.EscapeDataString(fabricAgentName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -1334,57 +1725,54 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.HyperVClusterCreateOrUpdate_Call(request,onAccepted,eventListener,sender); + await this.DraGet_Call(request,onOk,onDefault,eventListener,sender); } } - /// Method to create or update a cluster in site. + /// Gets the details of the fabric agent. /// - /// Put cluster body. - /// a delegate that is called when the remote service returns 202 (Accepted). + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task HyperVClusterCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVCluster body, global::System.Func onAccepted, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task DraGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2021-02-16-preview"; // 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.OffAzure/HyperVSites/(?[^/]+)/clusters/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataReplication/replicationFabrics/(?[^/]+)/fabricAgents/(?[^/]+)$", 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.OffAzure/HyperVSites/{siteName}/clusters/{clusterName}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var siteName = _match.Groups["siteName"].Value; - var clusterName = _match.Groups["clusterName"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var fabricAgentName = _match.Groups["fabricAgentName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.OffAzure/HyperVSites/" - + siteName - + "/clusters/" - + clusterName + + "/providers/Microsoft.DataReplication/replicationFabrics/" + + fabricName + + "/fabricAgents/" + + fabricAgentName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -1393,28 +1781,26 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.HyperVClusterCreateOrUpdate_Call(request,onAccepted,eventListener,sender); + await this.DraGet_Call(request,onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 202 (Accepted). + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 HyperVClusterCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onAccepted, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task DraGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -1429,15 +1815,17 @@ public partial class Migrate switch ( _response.StatusCode ) { - case global::System.Net.HttpStatusCode.Accepted: + case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onAccepted(_response); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.DraModel.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { - throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; } } } @@ -1452,45 +1840,47 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will - /// get validation events back. + /// Validation method for method. Call this like the actual call, but you will get validation events + /// back. /// - /// The ID of the target subscription. + /// Azure Subscription Id in which migrate project was created. /// The name of the resource group. The name is case insensitive. - /// Site name. - /// Cluster ARM name. - /// Put cluster body. + /// The fabric name. + /// The fabric agent (Dra) 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 HyperVClusterCreateOrUpdate_Validate(string subscriptionId, string resourceGroupName, string siteName, string clusterName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVCluster body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task DraGet_Validate(string subscriptionId, string resourceGroupName, string fabricName, string fabricAgentName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(siteName),siteName); - await eventListener.AssertNotNull(nameof(clusterName),clusterName); - await eventListener.AssertNotNull(nameof(body), body); - await eventListener.AssertObjectIsValid(nameof(body), body); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertRegEx(nameof(fabricName),fabricName,@"^[a-zA-Z0-9]*$"); + await eventListener.AssertNotNull(nameof(fabricAgentName),fabricAgentName); + await eventListener.AssertRegEx(nameof(fabricAgentName),fabricAgentName,@"^[a-zA-Z0-9]*$"); } } - /// Method to get a Hyper-V cluster. - /// The ID of the target subscription. + /// Gets the list of fabric agents in the given fabric. + /// Azure Subscription Id in which migrate project was created. /// The name of the resource group. The name is case insensitive. - /// Site name. - /// Cluster ARM name. + /// The fabric name. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task HyperVClusterGet(string subscriptionId, string resourceGroupName, string siteName, string clusterName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task DraList(string subscriptionId, string resourceGroupName, string fabricName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2021-02-16-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -1500,10 +1890,9 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.OffAzure/HyperVSites/" - + global::System.Uri.EscapeDataString(siteName) - + "/clusters/" - + global::System.Uri.EscapeDataString(clusterName) + + "/providers/Microsoft.DataReplication/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/fabricAgents" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -1517,47 +1906,47 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.HyperVClusterGet_Call(request,onOk,eventListener,sender); + await this.DraList_Call(request,onOk,onDefault,eventListener,sender); } } - /// Method to get a Hyper-V cluster. + /// Gets the list of fabric agents in the given fabric. /// /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task HyperVClusterGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task DraListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2021-02-16-preview"; // 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.OffAzure/HyperVSites/(?[^/]+)/clusters/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataReplication/replicationFabrics/(?[^/]+)/fabricAgents$", 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.OffAzure/HyperVSites/{siteName}/clusters/{clusterName}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var siteName = _match.Groups["siteName"].Value; - var clusterName = _match.Groups["clusterName"].Value; + var fabricName = _match.Groups["fabricName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.OffAzure/HyperVSites/" - + siteName - + "/clusters/" - + clusterName + + "/providers/Microsoft.DataReplication/replicationFabrics/" + + fabricName + + "/fabricAgents" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -1571,19 +1960,21 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.HyperVClusterGet_Call(request,onOk,eventListener,sender); + await this.DraList_Call(request,onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 HyperVClusterGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task DraList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -1601,12 +1992,14 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.HyperVCluster.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.DraModelCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { - throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; } } } @@ -1621,42 +2014,46 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation - /// events back. + /// Validation method for method. Call this like the actual call, but you will get validation events + /// back. /// - /// The ID of the target subscription. + /// Azure Subscription Id in which migrate project was created. /// The name of the resource group. The name is case insensitive. - /// Site name. - /// Cluster ARM name. + /// The 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 HyperVClusterGet_Validate(string subscriptionId, string resourceGroupName, string siteName, string clusterName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task DraList_Validate(string subscriptionId, string resourceGroupName, string fabricName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(siteName),siteName); - await eventListener.AssertNotNull(nameof(clusterName),clusterName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertRegEx(nameof(fabricName),fabricName,@"^[a-zA-Z0-9]*$"); } } - /// Method to get all clusters in a site. - /// The ID of the target subscription. + /// Tracks the results of an asynchronous operation on the fabric agent. + /// Azure Subscription Id in which migrate project was created. /// The name of the resource group. The name is case insensitive. - /// Site name. - /// + /// The fabric name. + /// The fabric agent (Dra) name. + /// The ID of an ongoing async operation. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task HyperVClusterList(string subscriptionId, string resourceGroupName, string siteName, string Filter, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task DraOperationStatusGet(string subscriptionId, string resourceGroupName, string fabricName, string fabricAgentName, string operationId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2021-02-16-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -1666,13 +2063,14 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.OffAzure/HyperVSites/" - + global::System.Uri.EscapeDataString(siteName) - + "/clusters" + + "/providers/Microsoft.DataReplication/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/fabricAgents/" + + global::System.Uri.EscapeDataString(fabricAgentName) + + "/operations/" + + global::System.Uri.EscapeDataString(operationId) + "?" + "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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -1684,50 +2082,54 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.HyperVClusterList_Call(request,onOk,eventListener,sender); + await this.DraOperationStatusGet_Call(request,onOk,onDefault,eventListener,sender); } } - /// Method to get all clusters in a site. + /// Tracks the results of an asynchronous operation on the fabric agent. /// - /// /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task HyperVClusterListViaIdentity(global::System.String viaIdentity, string Filter, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task DraOperationStatusGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2021-02-16-preview"; // 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.OffAzure/HyperVSites/(?[^/]+)/clusters$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataReplication/replicationFabrics/(?[^/]+)/fabricAgents/(?[^/]+)/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.OffAzure/HyperVSites/{siteName}/clusters'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}/operations/{operationId}'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var siteName = _match.Groups["siteName"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var fabricAgentName = _match.Groups["fabricAgentName"].Value; + var operationId = _match.Groups["operationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.OffAzure/HyperVSites/" - + siteName - + "/clusters" + + "/providers/Microsoft.DataReplication/replicationFabrics/" + + fabricName + + "/fabricAgents/" + + fabricAgentName + + "/operations/" + + operationId + "?" + "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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -1739,19 +2141,21 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.HyperVClusterList_Call(request,onOk,eventListener,sender); + await this.DraOperationStatusGet_Call(request,onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 HyperVClusterList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task DraOperationStatusGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -1769,12 +2173,14 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.HyperVClusterCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.OperationStatusAutoGenerated.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { - throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; } } } @@ -1789,43 +2195,53 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation + /// Validation method for method. Call this like the actual call, but you will get validation /// events back. /// - /// The ID of the target subscription. + /// Azure Subscription Id in which migrate project was created. /// The name of the resource group. The name is case insensitive. - /// Site name. - /// + /// The fabric name. + /// The fabric agent (Dra) name. + /// The ID of an ongoing async 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 HyperVClusterList_Validate(string subscriptionId, string resourceGroupName, string siteName, string Filter, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task DraOperationStatusGet_Validate(string subscriptionId, string resourceGroupName, string fabricName, string fabricAgentName, string operationId, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(siteName),siteName); - await eventListener.AssertNotNull(nameof(Filter),Filter); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertRegEx(nameof(fabricName),fabricName,@"^[a-zA-Z0-9]*$"); + await eventListener.AssertNotNull(nameof(fabricAgentName),fabricAgentName); + await eventListener.AssertRegEx(nameof(fabricAgentName),fabricAgentName,@"^[a-zA-Z0-9]*$"); + await eventListener.AssertNotNull(nameof(operationId),operationId); + await eventListener.AssertMinimumLength(nameof(operationId),operationId,1); } } - /// Method to create or update a host in site. - /// The ID of the target subscription. + /// Creates an alert configuration setting for the given vault. + /// Azure Subscription Id in which migrate project was created. /// The name of the resource group. The name is case insensitive. - /// Site name. - /// Host ARM name. - /// Put host body. - /// a delegate that is called when the remote service returns 202 (Accepted). + /// The vault name. + /// The email configuration name. + /// EmailConfiguration model. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task HyperVHostCreateOrUpdate(string subscriptionId, string resourceGroupName, string siteName, string hostName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVHost body, global::System.Func onAccepted, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task EmailConfigurationCreate(string subscriptionId, string resourceGroupName, string vaultName, string emailConfigurationName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModel body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2021-02-16-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -1835,10 +2251,10 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.OffAzure/HyperVSites/" - + global::System.Uri.EscapeDataString(siteName) - + "/hosts/" - + global::System.Uri.EscapeDataString(hostName) + + "/providers/Microsoft.DataReplication/replicationVaults/" + + global::System.Uri.EscapeDataString(vaultName) + + "/alertSettings/" + + global::System.Uri.EscapeDataString(emailConfigurationName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -1856,48 +2272,51 @@ public partial class Migrate request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.HyperVHostCreateOrUpdate_Call(request,onAccepted,eventListener,sender); + await this.EmailConfigurationCreate_Call(request,onOk,onCreated,onDefault,eventListener,sender); } } - /// Method to create or update a host in site. + /// Creates an alert configuration setting for the given vault. /// - /// Put host body. - /// a delegate that is called when the remote service returns 202 (Accepted). + /// EmailConfiguration model. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task HyperVHostCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVHost body, global::System.Func onAccepted, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task EmailConfigurationCreateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModel body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2021-02-16-preview"; // 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.OffAzure/HyperVSites/(?[^/]+)/hosts/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataReplication/replicationVaults/(?[^/]+)/alertSettings/(?[^/]+)$", 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.OffAzure/HyperVSites/{siteName}/hosts/{hostName}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/alertSettings/{emailConfigurationName}'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var siteName = _match.Groups["siteName"].Value; - var hostName = _match.Groups["hostName"].Value; + var vaultName = _match.Groups["vaultName"].Value; + var emailConfigurationName = _match.Groups["emailConfigurationName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.OffAzure/HyperVSites/" - + siteName - + "/hosts/" - + hostName + + "/providers/Microsoft.DataReplication/replicationVaults/" + + vaultName + + "/alertSettings/" + + emailConfigurationName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -1915,19 +2334,22 @@ public partial class Migrate request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.HyperVHostCreateOrUpdate_Call(request,onAccepted,eventListener,sender); + await this.EmailConfigurationCreate_Call(request,onOk,onCreated,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 202 (Accepted). + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 HyperVHostCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onAccepted, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task EmailConfigurationCreate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -1942,15 +2364,23 @@ public partial class Migrate switch ( _response.StatusCode ) { - case global::System.Net.HttpStatusCode.Accepted: + case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onAccepted(_response); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EmailConfigurationModel.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + case global::System.Net.HttpStatusCode.Created: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onCreated(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EmailConfigurationModel.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { - throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; } } } @@ -1965,45 +2395,51 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get + /// Validation method for method. Call this like the actual call, but you will get /// validation events back. /// - /// The ID of the target subscription. + /// Azure Subscription Id in which migrate project was created. /// The name of the resource group. The name is case insensitive. - /// Site name. - /// Host ARM name. - /// Put host body. + /// The vault name. + /// The email configuration name. + /// EmailConfiguration model. /// 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 HyperVHostCreateOrUpdate_Validate(string subscriptionId, string resourceGroupName, string siteName, string hostName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVHost body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task EmailConfigurationCreate_Validate(string subscriptionId, string resourceGroupName, string vaultName, string emailConfigurationName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModel body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(siteName),siteName); - await eventListener.AssertNotNull(nameof(hostName),hostName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(vaultName),vaultName); + await eventListener.AssertRegEx(nameof(vaultName),vaultName,@"^[a-zA-Z0-9]*$"); + await eventListener.AssertNotNull(nameof(emailConfigurationName),emailConfigurationName); + await eventListener.AssertRegEx(nameof(emailConfigurationName),emailConfigurationName,@"^[a-zA-Z0-9]*$"); await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// Method to get a Hyper-V host. - /// The ID of the target subscription. + /// Gets the details of the alert configuration setting. + /// Azure Subscription Id in which migrate project was created. /// The name of the resource group. The name is case insensitive. - /// Site name. - /// Host ARM name. + /// The vault name. + /// The email configuration name. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task HyperVHostGet(string subscriptionId, string resourceGroupName, string siteName, string hostName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task EmailConfigurationGet(string subscriptionId, string resourceGroupName, string vaultName, string emailConfigurationName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2021-02-16-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -2013,10 +2449,10 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.OffAzure/HyperVSites/" - + global::System.Uri.EscapeDataString(siteName) - + "/hosts/" - + global::System.Uri.EscapeDataString(hostName) + + "/providers/Microsoft.DataReplication/replicationVaults/" + + global::System.Uri.EscapeDataString(vaultName) + + "/alertSettings/" + + global::System.Uri.EscapeDataString(emailConfigurationName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -2030,47 +2466,49 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.HyperVHostGet_Call(request,onOk,eventListener,sender); + await this.EmailConfigurationGet_Call(request,onOk,onDefault,eventListener,sender); } } - /// Method to get a Hyper-V host. + /// Gets the details of the alert configuration setting. /// /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task HyperVHostGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task EmailConfigurationGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2021-02-16-preview"; // 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.OffAzure/HyperVSites/(?[^/]+)/hosts/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataReplication/replicationVaults/(?[^/]+)/alertSettings/(?[^/]+)$", 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.OffAzure/HyperVSites/{siteName}/hosts/{hostName}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/alertSettings/{emailConfigurationName}'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var siteName = _match.Groups["siteName"].Value; - var hostName = _match.Groups["hostName"].Value; + var vaultName = _match.Groups["vaultName"].Value; + var emailConfigurationName = _match.Groups["emailConfigurationName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.OffAzure/HyperVSites/" - + siteName - + "/hosts/" - + hostName + + "/providers/Microsoft.DataReplication/replicationVaults/" + + vaultName + + "/alertSettings/" + + emailConfigurationName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -2084,19 +2522,21 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.HyperVHostGet_Call(request,onOk,eventListener,sender); + await this.EmailConfigurationGet_Call(request,onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 HyperVHostGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task EmailConfigurationGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -2114,12 +2554,14 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.HyperVHost.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EmailConfigurationModel.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { - throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; } } } @@ -2134,42 +2576,47 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation + /// Validation method for method. Call this like the actual call, but you will get validation /// events back. /// - /// The ID of the target subscription. + /// Azure Subscription Id in which migrate project was created. /// The name of the resource group. The name is case insensitive. - /// Site name. - /// Host ARM name. + /// The vault name. + /// The email configuration 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 HyperVHostGet_Validate(string subscriptionId, string resourceGroupName, string siteName, string hostName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task EmailConfigurationGet_Validate(string subscriptionId, string resourceGroupName, string vaultName, string emailConfigurationName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(siteName),siteName); - await eventListener.AssertNotNull(nameof(hostName),hostName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(vaultName),vaultName); + await eventListener.AssertRegEx(nameof(vaultName),vaultName,@"^[a-zA-Z0-9]*$"); + await eventListener.AssertNotNull(nameof(emailConfigurationName),emailConfigurationName); + await eventListener.AssertRegEx(nameof(emailConfigurationName),emailConfigurationName,@"^[a-zA-Z0-9]*$"); } } - /// Method to get all hosts in a site. - /// The ID of the target subscription. + /// Gets the list of alert configuration settings for the given vault. + /// Azure Subscription Id in which migrate project was created. /// The name of the resource group. The name is case insensitive. - /// Site name. - /// + /// The vault name. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task HyperVHostList(string subscriptionId, string resourceGroupName, string siteName, string Filter, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task EmailConfigurationList(string subscriptionId, string resourceGroupName, string vaultName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2021-02-16-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -2179,13 +2626,11 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.OffAzure/HyperVSites/" - + global::System.Uri.EscapeDataString(siteName) - + "/hosts" + + "/providers/Microsoft.DataReplication/replicationVaults/" + + global::System.Uri.EscapeDataString(vaultName) + + "/alertSettings" + "?" + "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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -2197,50 +2642,49 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.HyperVHostList_Call(request,onOk,eventListener,sender); + await this.EmailConfigurationList_Call(request,onOk,onDefault,eventListener,sender); } } - /// Method to get all hosts in a site. + /// Gets the list of alert configuration settings for the given vault. /// - /// /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task HyperVHostListViaIdentity(global::System.String viaIdentity, string Filter, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task EmailConfigurationListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2021-02-16-preview"; // 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.OffAzure/HyperVSites/(?[^/]+)/hosts$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataReplication/replicationVaults/(?[^/]+)/alertSettings$", 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.OffAzure/HyperVSites/{siteName}/hosts'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/alertSettings'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var siteName = _match.Groups["siteName"].Value; + var vaultName = _match.Groups["vaultName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.OffAzure/HyperVSites/" - + siteName - + "/hosts" + + "/providers/Microsoft.DataReplication/replicationVaults/" + + vaultName + + "/alertSettings" + "?" + "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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -2252,19 +2696,21 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.HyperVHostList_Call(request,onOk,eventListener,sender); + await this.EmailConfigurationList_Call(request,onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 HyperVHostList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task EmailConfigurationList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -2282,12 +2728,14 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.HyperVHostCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EmailConfigurationModelCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { - throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; } } } @@ -2302,42 +2750,45 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation + /// Validation method for method. Call this like the actual call, but you will get validation /// events back. /// - /// The ID of the target subscription. + /// Azure Subscription Id in which migrate project was created. /// The name of the resource group. The name is case insensitive. - /// Site name. - /// + /// The vault 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 HyperVHostList_Validate(string subscriptionId, string resourceGroupName, string siteName, string Filter, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task EmailConfigurationList_Validate(string subscriptionId, string resourceGroupName, string vaultName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(siteName),siteName); - await eventListener.AssertNotNull(nameof(Filter),Filter); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(vaultName),vaultName); + await eventListener.AssertRegEx(nameof(vaultName),vaultName,@"^[a-zA-Z0-9]*$"); } } - /// Method to get job. - /// The ID of the target subscription. + /// Gets the details of the event. + /// Azure Subscription Id in which migrate project was created. /// The name of the resource group. The name is case insensitive. - /// Site name. - /// Job ARM name. + /// The vault name. + /// The event name. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task HyperVJobsGet(string subscriptionId, string resourceGroupName, string siteName, string jobName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task EventGet(string subscriptionId, string resourceGroupName, string vaultName, string eventName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2021-02-16-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -2347,10 +2798,10 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.OffAzure/HyperVSites/" - + global::System.Uri.EscapeDataString(siteName) - + "/jobs/" - + global::System.Uri.EscapeDataString(jobName) + + "/providers/Microsoft.DataReplication/replicationVaults/" + + global::System.Uri.EscapeDataString(vaultName) + + "/events/" + + global::System.Uri.EscapeDataString(eventName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -2364,47 +2815,49 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.HyperVJobsGet_Call(request,onOk,eventListener,sender); + await this.EventGet_Call(request,onOk,onDefault,eventListener,sender); } } - /// Method to get job. + /// Gets the details of the event. /// /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task HyperVJobsGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task EventGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2021-02-16-preview"; // 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.OffAzure/HyperVSites/(?[^/]+)/jobs/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataReplication/replicationVaults/(?[^/]+)/events/(?[^/]+)$", 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.OffAzure/HyperVSites/{siteName}/jobs/{jobName}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/events/{eventName}'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var siteName = _match.Groups["siteName"].Value; - var jobName = _match.Groups["jobName"].Value; + var vaultName = _match.Groups["vaultName"].Value; + var eventName = _match.Groups["eventName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.OffAzure/HyperVSites/" - + siteName - + "/jobs/" - + jobName + + "/providers/Microsoft.DataReplication/replicationVaults/" + + vaultName + + "/events/" + + eventName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -2418,19 +2871,21 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.HyperVJobsGet_Call(request,onOk,eventListener,sender); + await this.EventGet_Call(request,onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 HyperVJobsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task EventGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -2448,12 +2903,14 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.HyperVJob.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EventModel.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { - throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; } } } @@ -2468,41 +2925,49 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation - /// events back. + /// Validation method for method. Call this like the actual call, but you will get validation events + /// back. /// - /// The ID of the target subscription. + /// Azure Subscription Id in which migrate project was created. /// The name of the resource group. The name is case insensitive. - /// Site name. - /// Job ARM name. + /// The vault name. + /// The event 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 HyperVJobsGet_Validate(string subscriptionId, string resourceGroupName, string siteName, string jobName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task EventGet_Validate(string subscriptionId, string resourceGroupName, string vaultName, string eventName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(siteName),siteName); - await eventListener.AssertNotNull(nameof(jobName),jobName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(vaultName),vaultName); + await eventListener.AssertRegEx(nameof(vaultName),vaultName,@"^[a-zA-Z0-9]*$"); + await eventListener.AssertNotNull(nameof(eventName),eventName); + await eventListener.AssertRegEx(nameof(eventName),eventName,@"^[a-zA-Z0-9]*$"); } } - /// Method to get all jobs in a site. - /// The ID of the target subscription. + /// Gets the list of events in the given vault. + /// Azure Subscription Id in which migrate project was created. /// The name of the resource group. The name is case insensitive. - /// Site name. + /// The vault name. + /// Filter string. + /// Continuation token. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task HyperVJobsList(string subscriptionId, string resourceGroupName, string siteName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task EventList(string subscriptionId, string resourceGroupName, string vaultName, string Filter, string continuationToken, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2021-02-16-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -2512,10 +2977,14 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.OffAzure/HyperVSites/" - + global::System.Uri.EscapeDataString(siteName) - + "/jobs" + + "/providers/Microsoft.DataReplication/replicationVaults/" + + global::System.Uri.EscapeDataString(vaultName) + + "/events" + "?" + + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter)) + + "&" + + (string.IsNullOrEmpty(continuationToken) ? global::System.String.Empty : "continuationToken=" + global::System.Uri.EscapeDataString(continuationToken)) + + "&" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -2528,46 +2997,54 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.HyperVJobsList_Call(request,onOk,eventListener,sender); + await this.EventList_Call(request,onOk,onDefault,eventListener,sender); } } - /// Method to get all jobs in a site. + /// Gets the list of events in the given vault. /// + /// Filter string. + /// Continuation token. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task HyperVJobsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task EventListViaIdentity(global::System.String viaIdentity, string Filter, string continuationToken, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2021-02-16-preview"; // 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.OffAzure/HyperVSites/(?[^/]+)/jobs$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataReplication/replicationVaults/(?[^/]+)/events$", 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.OffAzure/HyperVSites/{siteName}/jobs'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/events'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var siteName = _match.Groups["siteName"].Value; + var vaultName = _match.Groups["vaultName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.OffAzure/HyperVSites/" - + siteName - + "/jobs" + + "/providers/Microsoft.DataReplication/replicationVaults/" + + vaultName + + "/events" + "?" + + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter)) + + "&" + + (string.IsNullOrEmpty(continuationToken) ? global::System.String.Empty : "continuationToken=" + global::System.Uri.EscapeDataString(continuationToken)) + + "&" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -2580,19 +3057,21 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.HyperVJobsList_Call(request,onOk,eventListener,sender); + await this.EventList_Call(request,onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 HyperVJobsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task EventList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -2610,12 +3089,14 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.HyperVJobCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EventModelCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { - throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; } } } @@ -2630,40 +3111,49 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation - /// events back. + /// Validation method for method. Call this like the actual call, but you will get validation events + /// back. /// - /// The ID of the target subscription. + /// Azure Subscription Id in which migrate project was created. /// The name of the resource group. The name is case insensitive. - /// Site name. + /// The vault name. + /// Filter string. + /// Continuation token. /// 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 HyperVJobsList_Validate(string subscriptionId, string resourceGroupName, string siteName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task EventList_Validate(string subscriptionId, string resourceGroupName, string vaultName, string Filter, string continuationToken, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(siteName),siteName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(vaultName),vaultName); + await eventListener.AssertRegEx(nameof(vaultName),vaultName,@"^[a-zA-Z0-9]*$"); + await eventListener.AssertNotNull(nameof(Filter),Filter); + await eventListener.AssertNotNull(nameof(continuationToken),continuationToken); } } - /// Method to get machine. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// Site name. - /// Machine ARM name. + /// + /// Delete the migrate event. Deleting non-existent migrate event is a no-operation. + /// + /// Azure Subscription Id in which migrate project was created. + /// Name of the Azure Resource Group that migrate project is part of. + /// Name of the Azure Migrate project. + /// Unique name of an event within a migrate project. /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task HyperVMachinesGet(string subscriptionId, string resourceGroupName, string siteName, string machineName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task EventsDeleteEvent(string subscriptionId, string resourceGroupName, string migrateProjectName, string eventName, global::System.Func onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2018-09-01-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -2673,10 +3163,10 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.OffAzure/HyperVSites/" - + global::System.Uri.EscapeDataString(siteName) - + "/machines/" - + global::System.Uri.EscapeDataString(machineName) + + "/providers/Microsoft.Migrate/migrateProjects/" + + global::System.Uri.EscapeDataString(migrateProjectName) + + "/migrateEvents/" + + global::System.Uri.EscapeDataString(eventName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -2685,16 +3175,18 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.HyperVMachinesGet_Call(request,onOk,eventListener,sender); + await this.EventsDeleteEvent_Call(request,onOk,eventListener,sender); } } - /// Method to get machine. + /// + /// Delete the migrate event. Deleting non-existent migrate event is a no-operation. + /// /// /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. @@ -2702,35 +3194,35 @@ public partial class Migrate /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task HyperVMachinesGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task EventsDeleteEventViaIdentity(global::System.String viaIdentity, global::System.Func onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2018-09-01-preview"; // 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.OffAzure/HyperVSites/(?[^/]+)/machines/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Migrate/migrateProjects/(?[^/]+)/migrateEvents/(?[^/]+)$", 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.OffAzure/HyperVSites/{siteName}/machines/{machineName}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/migrateProjects/{migrateProjectName}/migrateEvents/{eventName}'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var siteName = _match.Groups["siteName"].Value; - var machineName = _match.Groups["machineName"].Value; + var migrateProjectName = _match.Groups["migrateProjectName"].Value; + var eventName = _match.Groups["eventName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.OffAzure/HyperVSites/" - + siteName - + "/machines/" - + machineName + + "/providers/Microsoft.Migrate/migrateProjects/" + + migrateProjectName + + "/migrateEvents/" + + eventName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -2739,16 +3231,16 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.HyperVMachinesGet_Call(request,onOk,eventListener,sender); + await this.EventsDeleteEvent_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -2756,7 +3248,7 @@ public partial class Migrate /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task HyperVMachinesGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task EventsDeleteEvent_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -2774,7 +3266,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.HyperVMachine.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response); break; } default: @@ -2794,45 +3286,42 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation + /// Validation method for method. Call this like the actual call, but you will get validation /// events back. /// - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// Site name. - /// Machine ARM name. + /// Azure Subscription Id in which migrate project was created. + /// Name of the Azure Resource Group that migrate project is part of. + /// Name of the Azure Migrate project. + /// Unique name of an event within a migrate project. /// 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 HyperVMachinesGet_Validate(string subscriptionId, string resourceGroupName, string siteName, string machineName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task EventsDeleteEvent_Validate(string subscriptionId, string resourceGroupName, string migrateProjectName, string eventName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(siteName),siteName); - await eventListener.AssertNotNull(nameof(machineName),machineName); + await eventListener.AssertNotNull(nameof(migrateProjectName),migrateProjectName); + await eventListener.AssertNotNull(nameof(eventName),eventName); } } - /// Method to get machine. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// Site name. - /// - /// - /// Optional parameter for continuation token. - /// Total count of machines in the given site. + /// Gets an event in the migrate project. + /// Azure Subscription Id in which migrate project was created. + /// Name of the Azure Resource Group that migrate project is part of. + /// Name of the Azure Migrate project. + /// Unique name of an event within a migrate project. /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task HyperVMachinesList(string subscriptionId, string resourceGroupName, string siteName, string Filter, int? Top, string continuationToken, int? totalRecordCount, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task EventsGetEvent(string subscriptionId, string resourceGroupName, string migrateProjectName, string eventName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2018-09-01-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -2842,19 +3331,12 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.OffAzure/HyperVSites/" - + global::System.Uri.EscapeDataString(siteName) - + "/machines" + + "/providers/Microsoft.Migrate/migrateProjects/" + + global::System.Uri.EscapeDataString(migrateProjectName) + + "/migrateEvents/" + + global::System.Uri.EscapeDataString(eventName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) - + "&" - + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter)) - + "&" - + (null == Top ? global::System.String.Empty : "$top=" + global::System.Uri.EscapeDataString(Top.ToString())) - + "&" - + (string.IsNullOrEmpty(continuationToken) ? global::System.String.Empty : "continuationToken=" + global::System.Uri.EscapeDataString(continuationToken)) - + "&" - + (null == totalRecordCount ? global::System.String.Empty : "totalRecordCount=" + global::System.Uri.EscapeDataString(totalRecordCount.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -2866,59 +3348,49 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.HyperVMachinesList_Call(request,onOk,eventListener,sender); + await this.EventsGetEvent_Call(request,onOk,eventListener,sender); } } - /// Method to get machine. + /// Gets an event in the migrate project. /// - /// - /// - /// Optional parameter for continuation token. - /// Total count of machines in the given site. /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task HyperVMachinesListViaIdentity(global::System.String viaIdentity, string Filter, int? Top, string continuationToken, int? totalRecordCount, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task EventsGetEventViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2018-09-01-preview"; // 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.OffAzure/HyperVSites/(?[^/]+)/machines$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Migrate/migrateProjects/(?[^/]+)/migrateEvents/(?[^/]+)$", 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.OffAzure/HyperVSites/{siteName}/machines'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/migrateProjects/{migrateProjectName}/migrateEvents/{eventName}'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var siteName = _match.Groups["siteName"].Value; + var migrateProjectName = _match.Groups["migrateProjectName"].Value; + var eventName = _match.Groups["eventName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.OffAzure/HyperVSites/" - + siteName - + "/machines" + + "/providers/Microsoft.Migrate/migrateProjects/" + + migrateProjectName + + "/migrateEvents/" + + eventName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) - + "&" - + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter)) - + "&" - + (null == Top ? global::System.String.Empty : "$top=" + global::System.Uri.EscapeDataString(Top.ToString())) - + "&" - + (string.IsNullOrEmpty(continuationToken) ? global::System.String.Empty : "continuationToken=" + global::System.Uri.EscapeDataString(continuationToken)) - + "&" - + (null == totalRecordCount ? global::System.String.Empty : "totalRecordCount=" + global::System.Uri.EscapeDataString(totalRecordCount.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -2930,11 +3402,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.HyperVMachinesList_Call(request,onOk,eventListener,sender); + await this.EventsGetEvent_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -2942,7 +3414,7 @@ public partial class Migrate /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task HyperVMachinesList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task EventsGetEvent_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -2960,7 +3432,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.HyperVMachineCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.MigrateEvent.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -2980,46 +3452,45 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation + /// Validation method for method. Call this like the actual call, but you will get validation /// events back. /// - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// Site name. - /// - /// - /// Optional parameter for continuation token. - /// Total count of machines in the given site. + /// Azure Subscription Id in which migrate project was created. + /// Name of the Azure Resource Group that migrate project is part of. + /// Name of the Azure Migrate project. + /// Unique name of an event within a migrate project. /// 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 HyperVMachinesList_Validate(string subscriptionId, string resourceGroupName, string siteName, string Filter, int? Top, string continuationToken, int? totalRecordCount, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task EventsGetEvent_Validate(string subscriptionId, string resourceGroupName, string migrateProjectName, string eventName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(siteName),siteName); - await eventListener.AssertNotNull(nameof(Filter),Filter); - await eventListener.AssertNotNull(nameof(continuationToken),continuationToken); + await eventListener.AssertNotNull(nameof(migrateProjectName),migrateProjectName); + await eventListener.AssertNotNull(nameof(eventName),eventName); } } - /// Method to get operation status. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// Site name. - /// Operation status ARM name. + /// Gets a list of events in the migrate project. + /// Azure Subscription Id in which migrate project was created. + /// Name of the Azure Resource Group that migrate project is part of. + /// Name of the Azure Migrate project. + /// The continuation token. + /// The number of items to be returned in a single page. This value is honored only if it is less than + /// the 100. + /// Standard request header. Used by service to respond to client in appropriate language. /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task HyperVOperationsStatusGet(string subscriptionId, string resourceGroupName, string siteName, string operationStatusName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task EventsList(string subscriptionId, string resourceGroupName, string migrateProjectName, string continuationToken, int? pageSize, string acceptLanguage, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2018-09-01-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -3029,12 +3500,15 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.OffAzure/HyperVSites/" - + global::System.Uri.EscapeDataString(siteName) - + "/operationsStatus/" - + global::System.Uri.EscapeDataString(operationStatusName) + + "/providers/Microsoft.Migrate/migrateProjects/" + + global::System.Uri.EscapeDataString(migrateProjectName) + + "/migrateEvents" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(continuationToken) ? global::System.String.Empty : "continuationToken=" + global::System.Uri.EscapeDataString(continuationToken)) + + "&" + + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -3044,51 +3518,63 @@ public partial class Migrate var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + // add headers parameters + if (null != acceptLanguage) + { + request.Headers.Add("Accept-Language",acceptLanguage); + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.HyperVOperationsStatusGet_Call(request,onOk,eventListener,sender); + await this.EventsList_Call(request,onOk,eventListener,sender); } } - /// Method to get operation status. + /// Gets a list of events in the migrate project. /// + /// The continuation token. + /// The number of items to be returned in a single page. This value is honored only if it is less than + /// the 100. + /// Standard request header. Used by service to respond to client in appropriate language. /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task HyperVOperationsStatusGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task EventsListViaIdentity(global::System.String viaIdentity, string continuationToken, int? pageSize, string acceptLanguage, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2018-09-01-preview"; // 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.OffAzure/HyperVSites/(?[^/]+)/operationsStatus/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Migrate/migrateProjects/(?[^/]+)/migrateEvents$", 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.OffAzure/HyperVSites/{siteName}/operationsStatus/{operationStatusName}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/migrateProjects/{migrateProjectName}/migrateEvents'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var siteName = _match.Groups["siteName"].Value; - var operationStatusName = _match.Groups["operationStatusName"].Value; + var migrateProjectName = _match.Groups["migrateProjectName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.OffAzure/HyperVSites/" - + siteName - + "/operationsStatus/" - + operationStatusName + + "/providers/Microsoft.Migrate/migrateProjects/" + + migrateProjectName + + "/migrateEvents" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(continuationToken) ? global::System.String.Empty : "continuationToken=" + global::System.Uri.EscapeDataString(continuationToken)) + + "&" + + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -3098,13 +3584,19 @@ public partial class Migrate var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + // add headers parameters + if (null != acceptLanguage) + { + request.Headers.Add("Accept-Language",acceptLanguage); + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.HyperVOperationsStatusGet_Call(request,onOk,eventListener,sender); + await this.EventsList_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -3112,7 +3604,7 @@ public partial class Migrate /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task HyperVOperationsStatusGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task EventsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -3130,7 +3622,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.OperationStatus.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.EventCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -3150,42 +3642,48 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get - /// validation events back. + /// Validation method for method. Call this like the actual call, but you will get validation events + /// back. /// - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// Site name. - /// Operation status ARM name. + /// Azure Subscription Id in which migrate project was created. + /// Name of the Azure Resource Group that migrate project is part of. + /// Name of the Azure Migrate project. + /// The continuation token. + /// The number of items to be returned in a single page. This value is honored only if it is less than + /// the 100. + /// Standard request header. Used by service to respond to client in appropriate language. /// 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 HyperVOperationsStatusGet_Validate(string subscriptionId, string resourceGroupName, string siteName, string operationStatusName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task EventsList_Validate(string subscriptionId, string resourceGroupName, string migrateProjectName, string continuationToken, int? pageSize, string acceptLanguage, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(siteName),siteName); - await eventListener.AssertNotNull(nameof(operationStatusName),operationStatusName); + await eventListener.AssertNotNull(nameof(migrateProjectName),migrateProjectName); + await eventListener.AssertNotNull(nameof(continuationToken),continuationToken); + await eventListener.AssertNotNull(nameof(acceptLanguage),acceptLanguage); } } - /// Method to get run as account. - /// The ID of the target subscription. + /// Creates the fabric. + /// Azure Subscription Id in which migrate project was created. /// The name of the resource group. The name is case insensitive. - /// Site name. - /// Run as account ARM name. + /// The fabric name. + /// Fabric properties. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task HyperVRunAsAccountsGet(string subscriptionId, string resourceGroupName, string siteName, string accountName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task FabricCreate(string subscriptionId, string resourceGroupName, string fabricName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModel body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2021-02-16-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -3195,10 +3693,8 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.OffAzure/HyperVSites/" - + global::System.Uri.EscapeDataString(siteName) - + "/runAsAccounts/" - + global::System.Uri.EscapeDataString(accountName) + + "/providers/Microsoft.DataReplication/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -3207,52 +3703,56 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.HyperVRunAsAccountsGet_Call(request,onOk,eventListener,sender); + await this.FabricCreate_Call(request,onOk,onDefault,eventListener,sender); } } - /// Method to get run as account. + /// Creates the fabric. /// + /// Fabric properties. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task HyperVRunAsAccountsGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task FabricCreateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModel body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2021-02-16-preview"; // 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.OffAzure/HyperVSites/(?[^/]+)/runAsAccounts/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataReplication/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.OffAzure/HyperVSites/{siteName}/runAsAccounts/{accountName}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var siteName = _match.Groups["siteName"].Value; - var accountName = _match.Groups["accountName"].Value; + var fabricName = _match.Groups["fabricName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.OffAzure/HyperVSites/" - + siteName - + "/runAsAccounts/" - + accountName + + "/providers/Microsoft.DataReplication/replicationFabrics/" + + fabricName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -3261,24 +3761,30 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.HyperVRunAsAccountsGet_Call(request,onOk,eventListener,sender); + await this.FabricCreate_Call(request,onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 HyperVRunAsAccountsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task FabricCreate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -3289,6 +3795,103 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -3296,12 +3899,14 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.HyperVRunAsAccount.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModel.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { - throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; } } } @@ -3316,41 +3921,47 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation + /// Validation method for method. Call this like the actual call, but you will get validation /// events back. /// - /// The ID of the target subscription. + /// Azure Subscription Id in which migrate project was created. /// The name of the resource group. The name is case insensitive. - /// Site name. - /// Run as account ARM name. + /// The fabric name. + /// Fabric properties. /// 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 HyperVRunAsAccountsGet_Validate(string subscriptionId, string resourceGroupName, string siteName, string accountName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task FabricCreate_Validate(string subscriptionId, string resourceGroupName, string fabricName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModel body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(siteName),siteName); - await eventListener.AssertNotNull(nameof(accountName),accountName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertRegEx(nameof(fabricName),fabricName,@"^[a-zA-Z0-9]*$"); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// Method to get run as accounts. - /// The ID of the target subscription. + /// Removes the fabric. + /// Azure Subscription Id in which migrate project was created. /// The name of the resource group. The name is case insensitive. - /// Site name. - /// a delegate that is called when the remote service returns 200 (OK). + /// The fabric name. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task HyperVRunAsAccountsList(string subscriptionId, string resourceGroupName, string siteName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task FabricDelete(string subscriptionId, string resourceGroupName, string fabricName, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2021-02-16-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -3360,9 +3971,8 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.OffAzure/HyperVSites/" - + global::System.Uri.EscapeDataString(siteName) - + "/runAsAccounts" + + "/providers/Microsoft.DataReplication/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -3371,50 +3981,51 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.HyperVRunAsAccountsList_Call(request,onOk,eventListener,sender); + await this.FabricDelete_Call(request,onNoContent,onDefault,eventListener,sender); } } - /// Method to get run as accounts. + /// Removes the fabric. /// - /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task HyperVRunAsAccountsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task FabricDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2021-02-16-preview"; // 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.OffAzure/HyperVSites/(?[^/]+)/runAsAccounts$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataReplication/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.OffAzure/HyperVSites/{siteName}/runAsAccounts'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var siteName = _match.Groups["siteName"].Value; + var fabricName = _match.Groups["fabricName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.OffAzure/HyperVSites/" - + siteName - + "/runAsAccounts" + + "/providers/Microsoft.DataReplication/replicationFabrics/" + + fabricName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -3423,24 +4034,26 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.HyperVRunAsAccountsList_Call(request,onOk,eventListener,sender); + await this.FabricDelete_Call(request,onNoContent,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 HyperVRunAsAccountsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task FabricDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -3451,197 +4064,119 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - var _contentType = _response.Content.Headers.ContentType?.MediaType; - - switch ( _response.StatusCode ) + // 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 ) { - case global::System.Net.HttpStatusCode.OK: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.HyperVRunAsAccountCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; + + // 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.Migrate.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"); } - default: - { - throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); } - } - } - finally - { - // finally statements - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Finally, request, _response); - _response?.Dispose(); - request?.Dispose(); - } - } - } + 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.Migrate.Runtime.Method.Get); - /// - /// Validation method for method. Call this like the actual call, but you will get - /// validation events back. - /// - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// Site 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 HyperVRunAsAccountsList_Validate(string subscriptionId, string resourceGroupName, string siteName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) - { - using( NoSynchronizationContext ) - { - await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); - await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(siteName),siteName); - } - } - - /// Method to create or update a site. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// Site name. - /// Body with site details. - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns 201 (Created). - /// an instance that will receive events. - /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. - /// - /// A that will be complete when handling of the response is completed. - /// - public async global::System.Threading.Tasks.Task HyperVSitesCreateOrUpdate(string subscriptionId, string resourceGroupName, string siteName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVSite body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) - { - var apiVersion = @"2020-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.OffAzure/HyperVSites/" - + global::System.Uri.EscapeDataString(siteName) - + "?" - + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) - ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + // 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; - // generate request object - var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } - // make the call - await this.HyperVSitesCreateOrUpdate_Call(request,onOk,onCreated,eventListener,sender); - } - } + // drop the old response + _response?.Dispose(); - /// Method to create or update a site. - /// - /// Body with site details. - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns 201 (Created). - /// an instance that will receive events. - /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. - /// - /// A that will be complete when handling of the response is completed. - /// - public async global::System.Threading.Tasks.Task HyperVSitesCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVSite body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) - { - var apiVersion = @"2020-01-01"; - // Constant Parameters - using( NoSynchronizationContext ) - { - // verify that Identity format is an exact match for uri + // make the polling call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/HyperVSites/(?[^/]+)$", 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.OffAzure/HyperVSites/{siteName}'"); - } + // 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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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; + } - // replace URI parameters with values from identity - var subscriptionId = _match.Groups["subscriptionId"].Value; - var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var siteName = _match.Groups["siteName"].Value; - // construct URL - var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( - "/subscriptions/" - + subscriptionId - + "/resourceGroups/" - + resourceGroupName - + "/providers/Microsoft.OffAzure/HyperVSites/" - + siteName - + "?" - + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) - ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + switch( state?.ToString()?.ToLower() ) + { + case "failed": + error = true; + break; + case "succeeded": + case "canceled": + // we're done polling. + break; - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + 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.Migrate.Runtime.UndeclaredResponseException(_response); + } + } - // generate request object - var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + // 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.Migrate.Runtime.Method.Get); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } - // make the call - await this.HyperVSitesCreateOrUpdate_Call(request,onOk,onCreated,eventListener,sender); - } - } + // drop the old response + _response?.Dispose(); - /// Actual wire call for method. - /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns 201 (Created). - /// an instance that will receive events. - /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 HyperVSitesCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } - _response = await sendTask; - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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: + case global::System.Net.HttpStatusCode.NoContent: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.HyperVSite.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onNoContent(_response); break; } - case global::System.Net.HttpStatusCode.Created: + default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onCreated(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.HyperVSite.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } - default: - { - throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); - } } } finally @@ -3655,43 +4190,44 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get - /// validation events back. + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. /// - /// The ID of the target subscription. + /// Azure Subscription Id in which migrate project was created. /// The name of the resource group. The name is case insensitive. - /// Site name. - /// Body with site details. + /// The 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 HyperVSitesCreateOrUpdate_Validate(string subscriptionId, string resourceGroupName, string siteName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVSite body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task FabricDelete_Validate(string subscriptionId, string resourceGroupName, string fabricName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(siteName),siteName); - await eventListener.AssertNotNull(nameof(body), body); - await eventListener.AssertObjectIsValid(nameof(body), body); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertRegEx(nameof(fabricName),fabricName,@"^[a-zA-Z0-9]*$"); } } - /// Method to delete a site. - /// The ID of the target subscription. + /// Gets the details of the fabric. + /// Azure Subscription Id in which migrate project was created. /// The name of the resource group. The name is case insensitive. - /// Site name. + /// The fabric name. /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task HyperVSitesDeleteSite(string subscriptionId, string resourceGroupName, string siteName, global::System.Func onOk, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task FabricGet(string subscriptionId, string resourceGroupName, string fabricName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2021-02-16-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -3701,8 +4237,8 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.OffAzure/HyperVSites/" - + global::System.Uri.EscapeDataString(siteName) + + "/providers/Microsoft.DataReplication/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -3711,50 +4247,51 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.HyperVSitesDeleteSite_Call(request,onOk,onNoContent,eventListener,sender); + await this.FabricGet_Call(request,onOk,onDefault,eventListener,sender); } } - /// Method to delete a site. + /// Gets the details of the fabric. /// /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task HyperVSitesDeleteSiteViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task FabricGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2021-02-16-preview"; // 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.OffAzure/HyperVSites/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataReplication/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.OffAzure/HyperVSites/{siteName}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var siteName = _match.Groups["siteName"].Value; + var fabricName = _match.Groups["fabricName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.OffAzure/HyperVSites/" - + siteName + + "/providers/Microsoft.DataReplication/replicationFabrics/" + + fabricName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -3763,25 +4300,26 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.HyperVSitesDeleteSite_Call(request,onOk,onNoContent,eventListener,sender); + await this.FabricGet_Call(request,onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 HyperVSitesDeleteSite_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task FabricGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -3799,19 +4337,15 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModel.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } - case global::System.Net.HttpStatusCode.NoContent: + default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onNoContent(_response); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } - default: - { - throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); - } } } finally @@ -3825,39 +4359,44 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation - /// events back. + /// Validation method for method. Call this like the actual call, but you will get validation events + /// back. /// - /// The ID of the target subscription. + /// Azure Subscription Id in which migrate project was created. /// The name of the resource group. The name is case insensitive. - /// Site name. + /// The 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 HyperVSitesDeleteSite_Validate(string subscriptionId, string resourceGroupName, string siteName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task FabricGet_Validate(string subscriptionId, string resourceGroupName, string fabricName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(siteName),siteName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertRegEx(nameof(fabricName),fabricName,@"^[a-zA-Z0-9]*$"); } } - /// Method to get a site. - /// The ID of the target subscription. + /// Gets the list of fabrics in the given subscription and resource group. + /// Azure Subscription Id in which migrate project was created. /// The name of the resource group. The name is case insensitive. - /// Site name. + /// Continuation token from the previous call. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task HyperVSitesGet(string subscriptionId, string resourceGroupName, string siteName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task FabricList(string subscriptionId, string resourceGroupName, string continuationToken, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2021-02-16-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -3867,9 +4406,10 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.OffAzure/HyperVSites/" - + global::System.Uri.EscapeDataString(siteName) + + "/providers/Microsoft.DataReplication/replicationFabrics" + "?" + + (string.IsNullOrEmpty(continuationToken) ? global::System.String.Empty : "continuationToken=" + global::System.Uri.EscapeDataString(continuationToken)) + + "&" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -3882,23 +4422,24 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.HyperVSitesGet_Call(request,onOk,eventListener,sender); + await this.FabricList_Call(request,onOk,onDefault,eventListener,sender); } } - /// Method to get site health summary. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// Site name. + /// Gets the list of fabrics in the given subscription. + /// Azure Subscription Id in which migrate project was created. + /// Continuation token from the previous call. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task HyperVSitesGet1(string subscriptionId, string resourceGroupName, string siteName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task FabricListBySubscription(string subscriptionId, string continuationToken, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2021-02-16-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -3906,12 +4447,10 @@ public partial class Migrate var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + global::System.Uri.EscapeDataString(subscriptionId) - + "/resourceGroups/" - + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.OffAzure/HyperVSites/" - + global::System.Uri.EscapeDataString(siteName) - + "/healthSummary" + + "/providers/Microsoft.DataReplication/replicationFabrics" + "?" + + (string.IsNullOrEmpty(continuationToken) ? global::System.String.Empty : "continuationToken=" + global::System.Uri.EscapeDataString(continuationToken)) + + "&" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -3919,51 +4458,50 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.HyperVSitesGet1_Call(request,onOk,eventListener,sender); + await this.FabricListBySubscription_Call(request,onOk,onDefault,eventListener,sender); } } - /// Method to get site health summary. + /// Gets the list of fabrics in the given subscription. /// + /// Continuation token from the previous call. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task HyperVSitesGet1ViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task FabricListBySubscriptionViaIdentity(global::System.String viaIdentity, string continuationToken, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2021-02-16-preview"; // 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.OffAzure/HyperVSites/(?[^/]+)/healthSummary$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.DataReplication/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.OffAzure/HyperVSites/{siteName}/healthSummary'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/replicationFabrics'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; - var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var siteName = _match.Groups["siteName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId - + "/resourceGroups/" - + resourceGroupName - + "/providers/Microsoft.OffAzure/HyperVSites/" - + siteName - + "/healthSummary" + + "/providers/Microsoft.DataReplication/replicationFabrics" + "?" + + (string.IsNullOrEmpty(continuationToken) ? global::System.String.Empty : "continuationToken=" + global::System.Uri.EscapeDataString(continuationToken)) + + "&" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -3971,24 +4509,26 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.HyperVSitesGet1_Call(request,onOk,eventListener,sender); + await this.FabricListBySubscription_Call(request,onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 HyperVSitesGet1_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task FabricListBySubscription_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -4006,12 +4546,14 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.SiteHealthSummaryCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { - throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; } } } @@ -4026,104 +4568,62 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation - /// events back. + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. /// - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// Site name. + /// Azure Subscription Id in which migrate project was created. + /// Continuation token from the previous call. /// 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 HyperVSitesGet1_Validate(string subscriptionId, string resourceGroupName, string siteName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task FabricListBySubscription_Validate(string subscriptionId, string continuationToken, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); - await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(siteName),siteName); - } - } - - /// Method to get site usage. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// Site 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.Migrate.Runtime.ISendAsync pipeline to use to make the request. - /// - /// A that will be complete when handling of the response is completed. - /// - public async global::System.Threading.Tasks.Task HyperVSitesGet2(string subscriptionId, string resourceGroupName, string siteName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) - { - var apiVersion = @"2020-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.OffAzure/HyperVSites/" - + global::System.Uri.EscapeDataString(siteName) - + "/summary" - + "?" - + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) - ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - // generate request object - var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } - // make the call - await this.HyperVSitesGet2_Call(request,onOk,eventListener,sender); + await eventListener.AssertNotNull(nameof(continuationToken),continuationToken); } } - /// Method to get site usage. + /// Gets the list of fabrics in the given subscription and resource group. /// + /// Continuation token from the previous call. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task HyperVSitesGet2ViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task FabricListViaIdentity(global::System.String viaIdentity, string continuationToken, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2021-02-16-preview"; // 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.OffAzure/HyperVSites/(?[^/]+)/summary$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataReplication/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.OffAzure/HyperVSites/{siteName}/summary'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var siteName = _match.Groups["siteName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.OffAzure/HyperVSites/" - + siteName - + "/summary" + + "/providers/Microsoft.DataReplication/replicationFabrics" + "?" + + (string.IsNullOrEmpty(continuationToken) ? global::System.String.Empty : "continuationToken=" + global::System.Uri.EscapeDataString(continuationToken)) + + "&" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -4131,24 +4631,26 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.HyperVSitesGet2_Call(request,onOk,eventListener,sender); + await this.FabricList_Call(request,onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 HyperVSitesGet2_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task FabricList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -4166,12 +4668,14 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.HyperVSiteUsage.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { - throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; } } } @@ -4186,60 +4690,113 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation - /// events back. + /// Validation method for method. Call this like the actual call, but you will get validation events + /// back. /// - /// The ID of the target subscription. + /// Azure Subscription Id in which migrate project was created. /// The name of the resource group. The name is case insensitive. - /// Site name. + /// Continuation token from the previous call. /// 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 HyperVSitesGet2_Validate(string subscriptionId, string resourceGroupName, string siteName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task FabricList_Validate(string subscriptionId, string resourceGroupName, string continuationToken, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(siteName),siteName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(continuationToken),continuationToken); } } - /// Method to get a site. + /// Tracks the results of an asynchronous operation on the fabric. + /// Azure Subscription Id in which migrate project was created. + /// The name of the resource group. The name is case insensitive. + /// The fabric name. + /// The ID of an ongoing async operation. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task FabricOperationsStatusGet(string subscriptionId, string resourceGroupName, string fabricName, string operationId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + { + var apiVersion = @"2021-02-16-preview"; + // 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.DataReplication/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/operations/" + + global::System.Uri.EscapeDataString(operationId) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.FabricOperationsStatusGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Tracks the results of an asynchronous operation on the fabric. /// /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task HyperVSitesGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task FabricOperationsStatusGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2021-02-16-preview"; // 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.OffAzure/HyperVSites/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataReplication/replicationFabrics/(?[^/]+)/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.OffAzure/HyperVSites/{siteName}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/operations/{operationId}'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var siteName = _match.Groups["siteName"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var operationId = _match.Groups["operationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.OffAzure/HyperVSites/" - + siteName + + "/providers/Microsoft.DataReplication/replicationFabrics/" + + fabricName + + "/operations/" + + operationId + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -4253,19 +4810,21 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.HyperVSitesGet_Call(request,onOk,eventListener,sender); + await this.FabricOperationsStatusGet_Call(request,onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 HyperVSitesGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task FabricOperationsStatusGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -4283,12 +4842,14 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.HyperVSite.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.OperationStatusAutoGenerated.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { - throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; } } } @@ -4303,39 +4864,48 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation - /// events back. + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. /// - /// The ID of the target subscription. + /// Azure Subscription Id in which migrate project was created. /// The name of the resource group. The name is case insensitive. - /// Site name. + /// The fabric name. + /// The ID of an ongoing async 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 HyperVSitesGet_Validate(string subscriptionId, string resourceGroupName, string siteName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task FabricOperationsStatusGet_Validate(string subscriptionId, string resourceGroupName, string fabricName, string operationId, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(siteName),siteName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertRegEx(nameof(fabricName),fabricName,@"^[a-zA-Z0-9]*$"); + await eventListener.AssertNotNull(nameof(operationId),operationId); + await eventListener.AssertMinimumLength(nameof(operationId),operationId,1); } } - /// Method to refresh a site. - /// The ID of the target subscription. + /// Performs update on the fabric. + /// Azure Subscription Id in which migrate project was created. /// The name of the resource group. The name is case insensitive. - /// Site name. - /// a delegate that is called when the remote service returns 202 (Accepted). + /// The fabric name. + /// Fabric properties. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task HyperVSitesRefresh(string subscriptionId, string resourceGroupName, string siteName, global::System.Func onAccepted, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task FabricUpdate(string subscriptionId, string resourceGroupName, string fabricName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdate body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2021-02-16-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -4345,9 +4915,8 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.OffAzure/HyperVSites/" - + global::System.Uri.EscapeDataString(siteName) - + "/refresh" + + "/providers/Microsoft.DataReplication/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -4356,50 +4925,56 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.HyperVSitesRefresh_Call(request,onAccepted,eventListener,sender); + await this.FabricUpdate_Call(request,onOk,onDefault,eventListener,sender); } } - /// Method to refresh a site. + /// Performs update on the fabric. /// - /// a delegate that is called when the remote service returns 202 (Accepted). + /// Fabric properties. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task HyperVSitesRefreshViaIdentity(global::System.String viaIdentity, global::System.Func onAccepted, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task FabricUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdate body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2021-02-16-preview"; // 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.OffAzure/HyperVSites/(?[^/]+)/refresh$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataReplication/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.OffAzure/HyperVSites/{siteName}/refresh'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var siteName = _match.Groups["siteName"].Value; + var fabricName = _match.Groups["fabricName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.OffAzure/HyperVSites/" - + siteName - + "/refresh" + + "/providers/Microsoft.DataReplication/replicationFabrics/" + + fabricName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -4408,24 +4983,30 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.HyperVSitesRefresh_Call(request,onAccepted,eventListener,sender); + await this.FabricUpdate_Call(request,onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 202 (Accepted). + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 HyperVSitesRefresh_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onAccepted, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task FabricUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -4436,19 +5017,118 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - var _contentType = _response.Content.Headers.ContentType?.MediaType; - - switch ( _response.StatusCode ) + // 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 ) { - case 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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onAccepted(_response); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModel.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { - throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; } } } @@ -4463,39 +5143,45 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation + /// Validation method for method. Call this like the actual call, but you will get validation /// events back. /// - /// The ID of the target subscription. + /// Azure Subscription Id in which migrate project was created. /// The name of the resource group. The name is case insensitive. - /// Site name. + /// The fabric name. + /// Fabric properties. /// 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 HyperVSitesRefresh_Validate(string subscriptionId, string resourceGroupName, string siteName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task FabricUpdate_Validate(string subscriptionId, string resourceGroupName, string fabricName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdate body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(siteName),siteName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertRegEx(nameof(fabricName),fabricName,@"^[a-zA-Z0-9]*$"); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// Method to patch an existing site. + /// Method to create or update a cluster in site. /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Site name. - /// Body with site details. - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns 201 (Created). + /// Cluster ARM name. + /// Put cluster body. + /// a delegate that is called when the remote service returns 202 (Accepted). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task HyperVSitesUpdate(string subscriptionId, string resourceGroupName, string siteName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVSite body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task HyperVClusterCreateOrUpdate(string subscriptionId, string resourceGroupName, string siteName, string clusterName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVCluster body, global::System.Func onAccepted, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2020-01-01"; // Constant Parameters @@ -4509,6 +5195,8 @@ public partial class Migrate + global::System.Uri.EscapeDataString(resourceGroupName) + "/providers/Microsoft.OffAzure/HyperVSites/" + global::System.Uri.EscapeDataString(siteName) + + "/clusters/" + + global::System.Uri.EscapeDataString(clusterName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -4517,7 +5205,7 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -4526,21 +5214,20 @@ public partial class Migrate request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.HyperVSitesUpdate_Call(request,onOk,onCreated,eventListener,sender); + await this.HyperVClusterCreateOrUpdate_Call(request,onAccepted,eventListener,sender); } } - /// Method to patch an existing site. + /// Method to create or update a cluster in site. /// - /// Body with site details. - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns 201 (Created). + /// Put cluster body. + /// a delegate that is called when the remote service returns 202 (Accepted). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task HyperVSitesUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVSite body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task HyperVClusterCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVCluster body, global::System.Func onAccepted, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2020-01-01"; // Constant Parameters @@ -4548,16 +5235,17 @@ public partial class Migrate { // verify that Identity format is an exact match for uri - var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/HyperVSites/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/HyperVSites/(?[^/]+)/clusters/(?[^/]+)$", 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.OffAzure/HyperVSites/{siteName}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/HyperVSites/{siteName}/clusters/{clusterName}'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; var siteName = _match.Groups["siteName"].Value; + var clusterName = _match.Groups["clusterName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -4566,6 +5254,8 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.OffAzure/HyperVSites/" + siteName + + "/clusters/" + + clusterName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -4574,7 +5264,7 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -4583,20 +5273,19 @@ public partial class Migrate request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.HyperVSitesUpdate_Call(request,onOk,onCreated,eventListener,sender); + await this.HyperVClusterCreateOrUpdate_Call(request,onAccepted,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns 201 (Created). + /// a delegate that is called when the remote service returns 202 (Accepted). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 HyperVSitesUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task HyperVClusterCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onAccepted, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -4611,16 +5300,10 @@ public partial class Migrate switch ( _response.StatusCode ) { - case global::System.Net.HttpStatusCode.OK: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.HyperVSite.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - case global::System.Net.HttpStatusCode.Created: + case global::System.Net.HttpStatusCode.Accepted: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onCreated(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.HyperVSite.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onAccepted(_response); break; } default: @@ -4640,41 +5323,43 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation - /// events back. + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. /// /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Site name. - /// Body with site details. + /// Cluster ARM name. + /// Put cluster body. /// 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 HyperVSitesUpdate_Validate(string subscriptionId, string resourceGroupName, string siteName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVSite body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task HyperVClusterCreateOrUpdate_Validate(string subscriptionId, string resourceGroupName, string siteName, string clusterName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVCluster body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); await eventListener.AssertNotNull(nameof(siteName),siteName); + await eventListener.AssertNotNull(nameof(clusterName),clusterName); await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// Method to get job. + /// Method to get a Hyper-V cluster. /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Site name. - /// Job ARM name. + /// Cluster ARM 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.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task JobsGet(string subscriptionId, string resourceGroupName, string siteName, string jobName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task HyperVClusterGet(string subscriptionId, string resourceGroupName, string siteName, string clusterName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2020-01-01"; // Constant Parameters @@ -4686,10 +5371,10 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.OffAzure/VMwareSites/" + + "/providers/Microsoft.OffAzure/HyperVSites/" + global::System.Uri.EscapeDataString(siteName) - + "/jobs/" - + global::System.Uri.EscapeDataString(jobName) + + "/clusters/" + + global::System.Uri.EscapeDataString(clusterName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -4703,11 +5388,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.JobsGet_Call(request,onOk,eventListener,sender); + await this.HyperVClusterGet_Call(request,onOk,eventListener,sender); } } - /// Method to get job. + /// Method to get a Hyper-V cluster. /// /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. @@ -4715,7 +5400,7 @@ public partial class Migrate /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task JobsGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task HyperVClusterGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2020-01-01"; // Constant Parameters @@ -4723,27 +5408,27 @@ public partial class Migrate { // verify that Identity format is an exact match for uri - var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/VMwareSites/(?[^/]+)/jobs/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/HyperVSites/(?[^/]+)/clusters/(?[^/]+)$", 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.OffAzure/VMwareSites/{siteName}/jobs/{jobName}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/HyperVSites/{siteName}/clusters/{clusterName}'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; var siteName = _match.Groups["siteName"].Value; - var jobName = _match.Groups["jobName"].Value; + var clusterName = _match.Groups["clusterName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.OffAzure/VMwareSites/" + + "/providers/Microsoft.OffAzure/HyperVSites/" + siteName - + "/jobs/" - + jobName + + "/clusters/" + + clusterName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -4757,11 +5442,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.JobsGet_Call(request,onOk,eventListener,sender); + await this.HyperVClusterGet_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -4769,7 +5454,7 @@ public partial class Migrate /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task JobsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task HyperVClusterGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -4787,7 +5472,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.VMwareJob.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.HyperVCluster.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -4807,39 +5492,40 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation events - /// back. + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. /// /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Site name. - /// Job ARM name. + /// Cluster 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 JobsGet_Validate(string subscriptionId, string resourceGroupName, string siteName, string jobName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task HyperVClusterGet_Validate(string subscriptionId, string resourceGroupName, string siteName, string clusterName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); await eventListener.AssertNotNull(nameof(siteName),siteName); - await eventListener.AssertNotNull(nameof(jobName),jobName); + await eventListener.AssertNotNull(nameof(clusterName),clusterName); } } - /// Method to get all jobs in a site. + /// Method to get all clusters in a site. /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Site 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.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task JobsList(string subscriptionId, string resourceGroupName, string siteName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task HyperVClusterList(string subscriptionId, string resourceGroupName, string siteName, string Filter, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2020-01-01"; // Constant Parameters @@ -4851,11 +5537,13 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.OffAzure/VMwareSites/" + + "/providers/Microsoft.OffAzure/HyperVSites/" + global::System.Uri.EscapeDataString(siteName) - + "/jobs" + + "/clusters" + "?" + "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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -4867,19 +5555,20 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.JobsList_Call(request,onOk,eventListener,sender); + await this.HyperVClusterList_Call(request,onOk,eventListener,sender); } } - /// Method to get all jobs in a site. + /// Method to get all clusters in a site. /// + /// /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task JobsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task HyperVClusterListViaIdentity(global::System.String viaIdentity, string Filter, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2020-01-01"; // Constant Parameters @@ -4887,10 +5576,10 @@ public partial class Migrate { // verify that Identity format is an exact match for uri - var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/VMwareSites/(?[^/]+)/jobs$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/HyperVSites/(?[^/]+)/clusters$", 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.OffAzure/VMwareSites/{siteName}/jobs'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/HyperVSites/{siteName}/clusters'"); } // replace URI parameters with values from identity @@ -4903,11 +5592,13 @@ public partial class Migrate + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.OffAzure/VMwareSites/" + + "/providers/Microsoft.OffAzure/HyperVSites/" + siteName - + "/jobs" + + "/clusters" + "?" + "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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -4919,11 +5610,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.JobsList_Call(request,onOk,eventListener,sender); + await this.HyperVClusterList_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -4931,7 +5622,7 @@ public partial class Migrate /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task JobsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task HyperVClusterList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -4949,7 +5640,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.VMwareJobCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.HyperVClusterCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -4969,38 +5660,41 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation events - /// back. + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. /// /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Site 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 JobsList_Validate(string subscriptionId, string resourceGroupName, string siteName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task HyperVClusterList_Validate(string subscriptionId, string resourceGroupName, string siteName, string Filter, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); await eventListener.AssertNotNull(nameof(siteName),siteName); + await eventListener.AssertNotNull(nameof(Filter),Filter); } } - /// Method to get machine. + /// Method to create or update a host in site. /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Site name. - /// Machine ARM name. - /// a delegate that is called when the remote service returns 200 (OK). + /// Host ARM name. + /// Put host body. + /// a delegate that is called when the remote service returns 202 (Accepted). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task MachinesGet(string subscriptionId, string resourceGroupName, string siteName, string machineName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task HyperVHostCreateOrUpdate(string subscriptionId, string resourceGroupName, string siteName, string hostName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVHost body, global::System.Func onAccepted, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2020-01-01"; // Constant Parameters @@ -5012,54 +5706,10 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.OffAzure/VMwareSites/" + + "/providers/Microsoft.OffAzure/HyperVSites/" + global::System.Uri.EscapeDataString(siteName) - + "/machines/" - + global::System.Uri.EscapeDataString(machineName) - + "?" - + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) - ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - // generate request object - var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } - // make the call - await this.MachinesGet_Call(request,onOk,eventListener,sender); - } - } - - /// Gets a machine in the migrate project. - /// Azure Subscription Id in which migrate project was created. - /// Name of the Azure Resource Group that migrate project is part of. - /// Name of the Azure Migrate project. - /// Unique name of a machine in Azure migration hub. - /// a delegate that is called when the remote service returns 200 (OK). - /// an instance that will receive events. - /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. - /// - /// A that will be complete when handling of the response is completed. - /// - public async global::System.Threading.Tasks.Task MachinesGetMachine(string subscriptionId, string resourceGroupName, string migrateProjectName, string machineName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) - { - var apiVersion = @"2018-09-01-preview"; - // 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.Migrate/migrateProjects/" - + global::System.Uri.EscapeDataString(migrateProjectName) - + "/machines/" - + global::System.Uri.EscapeDataString(machineName) + + "/hosts/" + + global::System.Uri.EscapeDataString(hostName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -5068,52 +5718,57 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.MachinesGetMachine_Call(request,onOk,eventListener,sender); + await this.HyperVHostCreateOrUpdate_Call(request,onAccepted,eventListener,sender); } } - /// Gets a machine in the migrate project. + /// Method to create or update a host in site. /// - /// a delegate that is called when the remote service returns 200 (OK). + /// Put host body. + /// a delegate that is called when the remote service returns 202 (Accepted). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task MachinesGetMachineViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task HyperVHostCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVHost body, global::System.Func onAccepted, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2018-09-01-preview"; + var apiVersion = @"2020-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.Migrate/migrateProjects/(?[^/]+)/machines/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/HyperVSites/(?[^/]+)/hosts/(?[^/]+)$", 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.Migrate/migrateProjects/{migrateProjectName}/machines/{machineName}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/HyperVSites/{siteName}/hosts/{hostName}'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var migrateProjectName = _match.Groups["migrateProjectName"].Value; - var machineName = _match.Groups["machineName"].Value; + var siteName = _match.Groups["siteName"].Value; + var hostName = _match.Groups["hostName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.Migrate/migrateProjects/" - + migrateProjectName - + "/machines/" - + machineName + + "/providers/Microsoft.OffAzure/HyperVSites/" + + siteName + + "/hosts/" + + hostName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -5122,24 +5777,28 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.MachinesGetMachine_Call(request,onOk,eventListener,sender); + await this.HyperVHostCreateOrUpdate_Call(request,onAccepted,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 202 (Accepted). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 MachinesGetMachine_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task HyperVHostCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onAccepted, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -5154,10 +5813,10 @@ public partial class Migrate switch ( _response.StatusCode ) { - case global::System.Net.HttpStatusCode.OK: + case global::System.Net.HttpStatusCode.Accepted: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.Machine.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onAccepted(_response); break; } default: @@ -5177,29 +5836,76 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation - /// events back. + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. /// - /// Azure Subscription Id in which migrate project was created. - /// Name of the Azure Resource Group that migrate project is part of. - /// Name of the Azure Migrate project. - /// Unique name of a machine in Azure migration hub. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site name. + /// Host ARM name. + /// Put host body. /// 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 MachinesGetMachine_Validate(string subscriptionId, string resourceGroupName, string migrateProjectName, string machineName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task HyperVHostCreateOrUpdate_Validate(string subscriptionId, string resourceGroupName, string siteName, string hostName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVHost body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(migrateProjectName),migrateProjectName); - await eventListener.AssertNotNull(nameof(machineName),machineName); + await eventListener.AssertNotNull(nameof(siteName),siteName); + await eventListener.AssertNotNull(nameof(hostName),hostName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// Method to get machine. + /// Method to get a Hyper-V host. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site name. + /// Host ARM 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.Migrate.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task HyperVHostGet(string subscriptionId, string resourceGroupName, string siteName, string hostName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-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.OffAzure/HyperVSites/" + + global::System.Uri.EscapeDataString(siteName) + + "/hosts/" + + global::System.Uri.EscapeDataString(hostName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.HyperVHostGet_Call(request,onOk,eventListener,sender); + } + } + + /// Method to get a Hyper-V host. /// /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. @@ -5207,7 +5913,7 @@ public partial class Migrate /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task MachinesGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task HyperVHostGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2020-01-01"; // Constant Parameters @@ -5215,27 +5921,27 @@ public partial class Migrate { // verify that Identity format is an exact match for uri - var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/VMwareSites/(?[^/]+)/machines/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/HyperVSites/(?[^/]+)/hosts/(?[^/]+)$", 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.OffAzure/VMwareSites/{siteName}/machines/{machineName}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/HyperVSites/{siteName}/hosts/{hostName}'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; var siteName = _match.Groups["siteName"].Value; - var machineName = _match.Groups["machineName"].Value; + var hostName = _match.Groups["hostName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.OffAzure/VMwareSites/" + + "/providers/Microsoft.OffAzure/HyperVSites/" + siteName - + "/machines/" - + machineName + + "/hosts/" + + hostName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -5249,11 +5955,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.MachinesGet_Call(request,onOk,eventListener,sender); + await this.HyperVHostGet_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -5261,7 +5967,7 @@ public partial class Migrate /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task MachinesGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task HyperVHostGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -5279,7 +5985,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.VMwareMachine.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.HyperVHost.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -5299,43 +6005,40 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation events - /// back. + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. /// /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Site name. - /// Machine ARM name. + /// Host 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 MachinesGet_Validate(string subscriptionId, string resourceGroupName, string siteName, string machineName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task HyperVHostGet_Validate(string subscriptionId, string resourceGroupName, string siteName, string hostName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); await eventListener.AssertNotNull(nameof(siteName),siteName); - await eventListener.AssertNotNull(nameof(machineName),machineName); + await eventListener.AssertNotNull(nameof(hostName),hostName); } } - /// Method to get machine. + /// Method to get all hosts in a site. /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Site name. /// - /// - /// Optional parameter for continuation token. - /// Total count of machines in the given site. /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task MachinesList(string subscriptionId, string resourceGroupName, string siteName, string Filter, int? Top, string continuationToken, int? totalRecordCount, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task HyperVHostList(string subscriptionId, string resourceGroupName, string siteName, string Filter, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2020-01-01"; // Constant Parameters @@ -5347,19 +6050,13 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.OffAzure/VMwareSites/" + + "/providers/Microsoft.OffAzure/HyperVSites/" + global::System.Uri.EscapeDataString(siteName) - + "/machines" + + "/hosts" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + "&" + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter)) - + "&" - + (null == Top ? global::System.String.Empty : "$top=" + global::System.Uri.EscapeDataString(Top.ToString())) - + "&" - + (string.IsNullOrEmpty(continuationToken) ? global::System.String.Empty : "continuationToken=" + global::System.Uri.EscapeDataString(continuationToken)) - + "&" - + (null == totalRecordCount ? global::System.String.Empty : "totalRecordCount=" + global::System.Uri.EscapeDataString(totalRecordCount.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -5371,103 +6068,50 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.MachinesList_Call(request,onOk,eventListener,sender); + await this.HyperVHostList_Call(request,onOk,eventListener,sender); } } - /// Gets a list of machines in the migrate project. - /// Azure Subscription Id in which migrate project was created. - /// Name of the Azure Resource Group that migrate project is part of. - /// Name of the Azure Migrate project. - /// The continuation token. - /// The number of items to be returned in a single page. This value is honored only if it is less than - /// the 100. + /// Method to get all hosts in a site. + /// + /// /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task MachinesList1(string subscriptionId, string resourceGroupName, string migrateProjectName, string continuationToken, int? pageSize, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task HyperVHostListViaIdentity(global::System.String viaIdentity, string Filter, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2018-09-01-preview"; - // 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.Migrate/migrateProjects/" - + global::System.Uri.EscapeDataString(migrateProjectName) - + "/machines" - + "?" - + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) - + "&" - + (string.IsNullOrEmpty(continuationToken) ? global::System.String.Empty : "continuationToken=" + global::System.Uri.EscapeDataString(continuationToken)) - + "&" - + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) - ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - // generate request object - var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } - // make the call - await this.MachinesList1_Call(request,onOk,eventListener,sender); - } - } - - /// Gets a list of machines in the migrate project. - /// - /// The continuation token. - /// The number of items to be returned in a single page. This value is honored only if it is less than - /// the 100. - /// a delegate that is called when the remote service returns 200 (OK). - /// an instance that will receive events. - /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. - /// - /// A that will be complete when handling of the response is completed. - /// - public async global::System.Threading.Tasks.Task MachinesList1ViaIdentity(global::System.String viaIdentity, string continuationToken, int? pageSize, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) - { - var apiVersion = @"2018-09-01-preview"; + var apiVersion = @"2020-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.Migrate/migrateProjects/(?[^/]+)/machines$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/HyperVSites/(?[^/]+)/hosts$", 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.Migrate/migrateProjects/{migrateProjectName}/machines'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/HyperVSites/{siteName}/hosts'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var migrateProjectName = _match.Groups["migrateProjectName"].Value; + var siteName = _match.Groups["siteName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.Migrate/migrateProjects/" - + migrateProjectName - + "/machines" + + "/providers/Microsoft.OffAzure/HyperVSites/" + + siteName + + "/hosts" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + "&" - + (string.IsNullOrEmpty(continuationToken) ? global::System.String.Empty : "continuationToken=" + global::System.Uri.EscapeDataString(continuationToken)) - + "&" - + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -5479,11 +6123,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.MachinesList1_Call(request,onOk,eventListener,sender); + await this.HyperVHostList_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -5491,7 +6135,7 @@ public partial class Migrate /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task MachinesList1_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task HyperVHostList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -5509,7 +6153,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.MachineCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.HyperVHostCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -5529,43 +6173,81 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation + /// Validation method for method. Call this like the actual call, but you will get validation /// events back. /// - /// Azure Subscription Id in which migrate project was created. - /// Name of the Azure Resource Group that migrate project is part of. - /// Name of the Azure Migrate project. - /// The continuation token. - /// The number of items to be returned in a single page. This value is honored only if it is less than - /// the 100. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site 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 MachinesList1_Validate(string subscriptionId, string resourceGroupName, string migrateProjectName, string continuationToken, int? pageSize, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task HyperVHostList_Validate(string subscriptionId, string resourceGroupName, string siteName, string Filter, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(migrateProjectName),migrateProjectName); - await eventListener.AssertNotNull(nameof(continuationToken),continuationToken); + await eventListener.AssertNotNull(nameof(siteName),siteName); + await eventListener.AssertNotNull(nameof(Filter),Filter); } } - /// Method to get machine. + /// Method to get job. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site name. + /// Job ARM 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.Migrate.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task HyperVJobsGet(string subscriptionId, string resourceGroupName, string siteName, string jobName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-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.OffAzure/HyperVSites/" + + global::System.Uri.EscapeDataString(siteName) + + "/jobs/" + + global::System.Uri.EscapeDataString(jobName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.HyperVJobsGet_Call(request,onOk,eventListener,sender); + } + } + + /// Method to get job. /// - /// - /// - /// Optional parameter for continuation token. - /// Total count of machines in the given site. /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task MachinesListViaIdentity(global::System.String viaIdentity, string Filter, int? Top, string continuationToken, int? totalRecordCount, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task HyperVJobsGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2020-01-01"; // Constant Parameters @@ -5573,35 +6255,29 @@ public partial class Migrate { // verify that Identity format is an exact match for uri - var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/VMwareSites/(?[^/]+)/machines$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/HyperVSites/(?[^/]+)/jobs/(?[^/]+)$", 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.OffAzure/VMwareSites/{siteName}/machines'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/HyperVSites/{siteName}/jobs/{jobName}'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; var siteName = _match.Groups["siteName"].Value; + var jobName = _match.Groups["jobName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.OffAzure/VMwareSites/" + + "/providers/Microsoft.OffAzure/HyperVSites/" + siteName - + "/machines" + + "/jobs/" + + jobName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) - + "&" - + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter)) - + "&" - + (null == Top ? global::System.String.Empty : "$top=" + global::System.Uri.EscapeDataString(Top.ToString())) - + "&" - + (string.IsNullOrEmpty(continuationToken) ? global::System.String.Empty : "continuationToken=" + global::System.Uri.EscapeDataString(continuationToken)) - + "&" - + (null == totalRecordCount ? global::System.String.Empty : "totalRecordCount=" + global::System.Uri.EscapeDataString(totalRecordCount.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -5613,11 +6289,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.MachinesList_Call(request,onOk,eventListener,sender); + await this.HyperVJobsGet_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -5625,7 +6301,7 @@ public partial class Migrate /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task MachinesList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task HyperVJobsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -5643,7 +6319,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.VMwareMachineCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.HyperVJob.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -5663,44 +6339,39 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation + /// Validation method for method. Call this like the actual call, but you will get validation /// events back. /// /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Site name. - /// - /// - /// Optional parameter for continuation token. - /// Total count of machines in the given site. + /// Job 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 MachinesList_Validate(string subscriptionId, string resourceGroupName, string siteName, string Filter, int? Top, string continuationToken, int? totalRecordCount, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task HyperVJobsGet_Validate(string subscriptionId, string resourceGroupName, string siteName, string jobName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); await eventListener.AssertNotNull(nameof(siteName),siteName); - await eventListener.AssertNotNull(nameof(Filter),Filter); - await eventListener.AssertNotNull(nameof(continuationToken),continuationToken); + await eventListener.AssertNotNull(nameof(jobName),jobName); } } - /// Method to start a machine. + /// Method to get all jobs in a site. /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Site name. - /// Machine ARM name. - /// a delegate that is called when the remote service returns 202 (Accepted). + /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task MachinesStartMachine(string subscriptionId, string resourceGroupName, string siteName, string machineName, global::System.Func onAccepted, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task HyperVJobsList(string subscriptionId, string resourceGroupName, string siteName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2020-01-01"; // Constant Parameters @@ -5712,11 +6383,9 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.OffAzure/VMwareSites/" + + "/providers/Microsoft.OffAzure/HyperVSites/" + global::System.Uri.EscapeDataString(siteName) - + "/machines/" - + global::System.Uri.EscapeDataString(machineName) - + "/start" + + "/jobs" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -5725,24 +6394,24 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.MachinesStartMachine_Call(request,onAccepted,eventListener,sender); + await this.HyperVJobsList_Call(request,onOk,eventListener,sender); } } - /// Method to start a machine. + /// Method to get all jobs in a site. /// - /// a delegate that is called when the remote service returns 202 (Accepted). + /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task MachinesStartMachineViaIdentity(global::System.String viaIdentity, global::System.Func onAccepted, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task HyperVJobsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2020-01-01"; // Constant Parameters @@ -5750,28 +6419,25 @@ public partial class Migrate { // verify that Identity format is an exact match for uri - var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/VMwareSites/(?[^/]+)/machines/(?[^/]+)/start$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/HyperVSites/(?[^/]+)/jobs$", 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.OffAzure/VMwareSites/{siteName}/machines/{machineName}/start'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/HyperVSites/{siteName}/jobs'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; var siteName = _match.Groups["siteName"].Value; - var machineName = _match.Groups["machineName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.OffAzure/VMwareSites/" + + "/providers/Microsoft.OffAzure/HyperVSites/" + siteName - + "/machines/" - + machineName - + "/start" + + "/jobs" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -5780,24 +6446,24 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.MachinesStartMachine_Call(request,onAccepted,eventListener,sender); + await this.HyperVJobsList_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 202 (Accepted). + /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 MachinesStartMachine_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onAccepted, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task HyperVJobsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -5812,10 +6478,10 @@ public partial class Migrate switch ( _response.StatusCode ) { - case global::System.Net.HttpStatusCode.Accepted: + case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onAccepted(_response); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.HyperVJobCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -5835,40 +6501,38 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation + /// Validation method for method. Call this like the actual call, but you will get validation /// events back. /// /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Site name. - /// Machine 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 MachinesStartMachine_Validate(string subscriptionId, string resourceGroupName, string siteName, string machineName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task HyperVJobsList_Validate(string subscriptionId, string resourceGroupName, string siteName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); await eventListener.AssertNotNull(nameof(siteName),siteName); - await eventListener.AssertNotNull(nameof(machineName),machineName); } } - /// Method to stop a machine. + /// Method to get machine. /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Site name. /// Machine ARM name. - /// a delegate that is called when the remote service returns 202 (Accepted). + /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task MachinesStopMachine(string subscriptionId, string resourceGroupName, string siteName, string machineName, global::System.Func onAccepted, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task HyperVMachinesGet(string subscriptionId, string resourceGroupName, string siteName, string machineName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2020-01-01"; // Constant Parameters @@ -5880,11 +6544,10 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.OffAzure/VMwareSites/" + + "/providers/Microsoft.OffAzure/HyperVSites/" + global::System.Uri.EscapeDataString(siteName) + "/machines/" + global::System.Uri.EscapeDataString(machineName) - + "/stop" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -5893,24 +6556,24 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.MachinesStopMachine_Call(request,onAccepted,eventListener,sender); + await this.HyperVMachinesGet_Call(request,onOk,eventListener,sender); } } - /// Method to stop a machine. + /// Method to get machine. /// - /// a delegate that is called when the remote service returns 202 (Accepted). + /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task MachinesStopMachineViaIdentity(global::System.String viaIdentity, global::System.Func onAccepted, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task HyperVMachinesGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2020-01-01"; // Constant Parameters @@ -5918,10 +6581,10 @@ public partial class Migrate { // verify that Identity format is an exact match for uri - var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/VMwareSites/(?[^/]+)/machines/(?[^/]+)/stop$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/HyperVSites/(?[^/]+)/machines/(?[^/]+)$", 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.OffAzure/VMwareSites/{siteName}/machines/{machineName}/stop'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/HyperVSites/{siteName}/machines/{machineName}'"); } // replace URI parameters with values from identity @@ -5935,11 +6598,10 @@ public partial class Migrate + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.OffAzure/VMwareSites/" + + "/providers/Microsoft.OffAzure/HyperVSites/" + siteName + "/machines/" + machineName - + "/stop" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -5948,24 +6610,24 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.MachinesStopMachine_Call(request,onAccepted,eventListener,sender); + await this.HyperVMachinesGet_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 202 (Accepted). + /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 MachinesStopMachine_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onAccepted, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task HyperVMachinesGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -5980,10 +6642,10 @@ public partial class Migrate switch ( _response.StatusCode ) { - case global::System.Net.HttpStatusCode.Accepted: + case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onAccepted(_response); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.HyperVMachine.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -6003,7 +6665,7 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation + /// Validation method for method. Call this like the actual call, but you will get validation /// events back. /// /// The ID of the target subscription. @@ -6014,7 +6676,7 @@ public partial class Migrate /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task MachinesStopMachine_Validate(string subscriptionId, string resourceGroupName, string siteName, string machineName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task HyperVMachinesGet_Validate(string subscriptionId, string resourceGroupName, string siteName, string machineName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -6025,20 +6687,23 @@ public partial class Migrate } } - /// Delete the migrate project. Deleting non-existent project is a no-operation. - /// Azure Subscription Id in which migrate project was created. - /// Name of the Azure Resource Group that migrate project is part of. - /// Name of the Azure Migrate project. - /// Standard request header. Used by service to respond to client in appropriate language. + /// Method to get machine. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site name. + /// + /// + /// Optional parameter for continuation token. + /// Total count of machines in the given site. /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task MigrateProjectsDeleteMigrateProject(string subscriptionId, string resourceGroupName, string migrateProjectName, string acceptLanguage, global::System.Func onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task HyperVMachinesList(string subscriptionId, string resourceGroupName, string siteName, string Filter, int? Top, string continuationToken, int? totalRecordCount, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2018-09-01-preview"; + var apiVersion = @"2020-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -6048,90 +6713,99 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.Migrate/migrateProjects/" - + global::System.Uri.EscapeDataString(migrateProjectName) + + "/providers/Microsoft.OffAzure/HyperVSites/" + + global::System.Uri.EscapeDataString(siteName) + + "/machines" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter)) + + "&" + + (null == Top ? global::System.String.Empty : "$top=" + global::System.Uri.EscapeDataString(Top.ToString())) + + "&" + + (string.IsNullOrEmpty(continuationToken) ? global::System.String.Empty : "continuationToken=" + global::System.Uri.EscapeDataString(continuationToken)) + + "&" + + (null == totalRecordCount ? global::System.String.Empty : "totalRecordCount=" + global::System.Uri.EscapeDataString(totalRecordCount.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - // add headers parameters - if (null != acceptLanguage) - { - request.Headers.Add("Accept-Language",acceptLanguage); - } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.MigrateProjectsDeleteMigrateProject_Call(request,onOk,eventListener,sender); + await this.HyperVMachinesList_Call(request,onOk,eventListener,sender); } } - /// Delete the migrate project. Deleting non-existent project is a no-operation. + /// Method to get machine. /// - /// Standard request header. Used by service to respond to client in appropriate language. + /// + /// + /// Optional parameter for continuation token. + /// Total count of machines in the given site. /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task MigrateProjectsDeleteMigrateProjectViaIdentity(global::System.String viaIdentity, string acceptLanguage, global::System.Func onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task HyperVMachinesListViaIdentity(global::System.String viaIdentity, string Filter, int? Top, string continuationToken, int? totalRecordCount, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2018-09-01-preview"; + var apiVersion = @"2020-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.Migrate/migrateProjects/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/HyperVSites/(?[^/]+)/machines$", 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.Migrate/migrateProjects/{migrateProjectName}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/HyperVSites/{siteName}/machines'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var migrateProjectName = _match.Groups["migrateProjectName"].Value; + var siteName = _match.Groups["siteName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.Migrate/migrateProjects/" - + migrateProjectName + + "/providers/Microsoft.OffAzure/HyperVSites/" + + siteName + + "/machines" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter)) + + "&" + + (null == Top ? global::System.String.Empty : "$top=" + global::System.Uri.EscapeDataString(Top.ToString())) + + "&" + + (string.IsNullOrEmpty(continuationToken) ? global::System.String.Empty : "continuationToken=" + global::System.Uri.EscapeDataString(continuationToken)) + + "&" + + (null == totalRecordCount ? global::System.String.Empty : "totalRecordCount=" + global::System.Uri.EscapeDataString(totalRecordCount.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - // add headers parameters - if (null != acceptLanguage) - { - request.Headers.Add("Accept-Language",acceptLanguage); - } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.MigrateProjectsDeleteMigrateProject_Call(request,onOk,eventListener,sender); + await this.HyperVMachinesList_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -6139,7 +6813,7 @@ public partial class Migrate /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task MigrateProjectsDeleteMigrateProject_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task HyperVMachinesList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -6157,7 +6831,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.HyperVMachineCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -6177,41 +6851,46 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you - /// will get validation events back. + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. /// - /// Azure Subscription Id in which migrate project was created. - /// Name of the Azure Resource Group that migrate project is part of. - /// Name of the Azure Migrate project. - /// Standard request header. Used by service to respond to client in appropriate language. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site name. + /// + /// + /// Optional parameter for continuation token. + /// Total count of machines in the given site. /// 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 MigrateProjectsDeleteMigrateProject_Validate(string subscriptionId, string resourceGroupName, string migrateProjectName, string acceptLanguage, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task HyperVMachinesList_Validate(string subscriptionId, string resourceGroupName, string siteName, string Filter, int? Top, string continuationToken, int? totalRecordCount, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(migrateProjectName),migrateProjectName); - await eventListener.AssertNotNull(nameof(acceptLanguage),acceptLanguage); + await eventListener.AssertNotNull(nameof(siteName),siteName); + await eventListener.AssertNotNull(nameof(Filter),Filter); + await eventListener.AssertNotNull(nameof(continuationToken),continuationToken); } } - /// Method to get a migrate project. - /// Azure Subscription Id in which migrate project was created. - /// Name of the Azure Resource Group that migrate project is part of. - /// Name of the Azure Migrate project. + /// Method to get operation status. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site name. + /// Operation status ARM 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.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task MigrateProjectsGetMigrateProject(string subscriptionId, string resourceGroupName, string migrateProjectName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task HyperVOperationsStatusGet(string subscriptionId, string resourceGroupName, string siteName, string operationStatusName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2018-09-01-preview"; + var apiVersion = @"2020-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -6221,8 +6900,10 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.Migrate/migrateProjects/" - + global::System.Uri.EscapeDataString(migrateProjectName) + + "/providers/Microsoft.OffAzure/HyperVSites/" + + global::System.Uri.EscapeDataString(siteName) + + "/operationsStatus/" + + global::System.Uri.EscapeDataString(operationStatusName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -6236,11 +6917,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.MigrateProjectsGetMigrateProject_Call(request,onOk,eventListener,sender); + await this.HyperVOperationsStatusGet_Call(request,onOk,eventListener,sender); } } - /// Method to get a migrate project. + /// Method to get operation status. /// /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. @@ -6248,32 +6929,35 @@ public partial class Migrate /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task MigrateProjectsGetMigrateProjectViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task HyperVOperationsStatusGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2018-09-01-preview"; + var apiVersion = @"2020-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.Migrate/migrateProjects/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/HyperVSites/(?[^/]+)/operationsStatus/(?[^/]+)$", 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.Migrate/migrateProjects/{migrateProjectName}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/HyperVSites/{siteName}/operationsStatus/{operationStatusName}'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var migrateProjectName = _match.Groups["migrateProjectName"].Value; + var siteName = _match.Groups["siteName"].Value; + var operationStatusName = _match.Groups["operationStatusName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.Migrate/migrateProjects/" - + migrateProjectName + + "/providers/Microsoft.OffAzure/HyperVSites/" + + siteName + + "/operationsStatus/" + + operationStatusName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -6287,11 +6971,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.MigrateProjectsGetMigrateProject_Call(request,onOk,eventListener,sender); + await this.HyperVOperationsStatusGet_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -6299,7 +6983,7 @@ public partial class Migrate /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task MigrateProjectsGetMigrateProject_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task HyperVOperationsStatusGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -6317,7 +7001,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.MigrateProject.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.OperationStatus.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -6337,43 +7021,42 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you - /// will get validation events back. + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. /// - /// Azure Subscription Id in which migrate project was created. - /// Name of the Azure Resource Group that migrate project is part of. - /// Name of the Azure Migrate project. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site name. + /// Operation status 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 MigrateProjectsGetMigrateProject_Validate(string subscriptionId, string resourceGroupName, string migrateProjectName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task HyperVOperationsStatusGet_Validate(string subscriptionId, string resourceGroupName, string siteName, string operationStatusName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(migrateProjectName),migrateProjectName); + await eventListener.AssertNotNull(nameof(siteName),siteName); + await eventListener.AssertNotNull(nameof(operationStatusName),operationStatusName); } } - /// - /// Update a migrate project with specified name. Supports partial updates, for example only tags can be provided. - /// - /// Azure Subscription Id in which migrate project was created. - /// Name of the Azure Resource Group that migrate project is part of. - /// Name of the Azure Migrate project. - /// Standard request header. Used by service to respond to client in appropriate language. - /// Body with migrate project details. + /// Method to get run as account. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site name. + /// Run as account ARM 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.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task MigrateProjectsPatchMigrateProject(string subscriptionId, string resourceGroupName, string migrateProjectName, string acceptLanguage, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IMigrateProject body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task HyperVRunAsAccountsGet(string subscriptionId, string resourceGroupName, string siteName, string accountName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2018-09-01-preview"; + var apiVersion = @"2020-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -6383,8 +7066,10 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.Migrate/migrateProjects/" - + global::System.Uri.EscapeDataString(migrateProjectName) + + "/providers/Microsoft.OffAzure/HyperVSites/" + + global::System.Uri.EscapeDataString(siteName) + + "/runAsAccounts/" + + global::System.Uri.EscapeDataString(accountName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -6393,63 +7078,52 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - // add headers parameters - if (null != acceptLanguage) - { - request.Headers.Add("Accept-Language",acceptLanguage); - } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.MigrateProjectsPatchMigrateProject_Call(request,onOk,eventListener,sender); + await this.HyperVRunAsAccountsGet_Call(request,onOk,eventListener,sender); } } - /// - /// Update a migrate project with specified name. Supports partial updates, for example only tags can be provided. - /// + /// Method to get run as account. /// - /// Standard request header. Used by service to respond to client in appropriate language. - /// Body with migrate project details. /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task MigrateProjectsPatchMigrateProjectViaIdentity(global::System.String viaIdentity, string acceptLanguage, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IMigrateProject body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task HyperVRunAsAccountsGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2018-09-01-preview"; + var apiVersion = @"2020-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.Migrate/migrateProjects/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/HyperVSites/(?[^/]+)/runAsAccounts/(?[^/]+)$", 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.Migrate/migrateProjects/{migrateProjectName}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/HyperVSites/{siteName}/runAsAccounts/{accountName}'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var migrateProjectName = _match.Groups["migrateProjectName"].Value; + var siteName = _match.Groups["siteName"].Value; + var accountName = _match.Groups["accountName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.Migrate/migrateProjects/" - + migrateProjectName + + "/providers/Microsoft.OffAzure/HyperVSites/" + + siteName + + "/runAsAccounts/" + + accountName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -6458,26 +7132,16 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - // add headers parameters - if (null != acceptLanguage) - { - request.Headers.Add("Accept-Language",acceptLanguage); - } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.MigrateProjectsPatchMigrateProject_Call(request,onOk,eventListener,sender); + await this.HyperVRunAsAccountsGet_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -6485,7 +7149,7 @@ public partial class Migrate /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task MigrateProjectsPatchMigrateProject_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task HyperVRunAsAccountsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -6503,7 +7167,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.MigrateProject.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.HyperVRunAsAccount.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -6523,47 +7187,41 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you - /// will get validation events back. + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. /// - /// Azure Subscription Id in which migrate project was created. - /// Name of the Azure Resource Group that migrate project is part of. - /// Name of the Azure Migrate project. - /// Standard request header. Used by service to respond to client in appropriate language. - /// Body with migrate project details. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site name. + /// Run as account 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 MigrateProjectsPatchMigrateProject_Validate(string subscriptionId, string resourceGroupName, string migrateProjectName, string acceptLanguage, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IMigrateProject body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task HyperVRunAsAccountsGet_Validate(string subscriptionId, string resourceGroupName, string siteName, string accountName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(migrateProjectName),migrateProjectName); - await eventListener.AssertNotNull(nameof(acceptLanguage),acceptLanguage); - await eventListener.AssertNotNull(nameof(body), body); - await eventListener.AssertObjectIsValid(nameof(body), body); + await eventListener.AssertNotNull(nameof(siteName),siteName); + await eventListener.AssertNotNull(nameof(accountName),accountName); } } - /// Method to create or update a migrate project. - /// Azure Subscription Id in which migrate project was created. - /// Name of the Azure Resource Group that migrate project is part of. - /// Name of the Azure Migrate project. - /// Standard request header. Used by service to respond to client in appropriate language. - /// Body with migrate project details. + /// Method to get run as accounts. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site name. /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns 201 (Created). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task MigrateProjectsPutMigrateProject(string subscriptionId, string resourceGroupName, string migrateProjectName, string acceptLanguage, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IMigrateProject body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task HyperVRunAsAccountsList(string subscriptionId, string resourceGroupName, string siteName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2018-09-01-preview"; + var apiVersion = @"2020-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -6573,8 +7231,9 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.Migrate/migrateProjects/" - + global::System.Uri.EscapeDataString(migrateProjectName) + + "/providers/Microsoft.OffAzure/HyperVSites/" + + global::System.Uri.EscapeDataString(siteName) + + "/runAsAccounts" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -6583,62 +7242,50 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - // add headers parameters - if (null != acceptLanguage) - { - request.Headers.Add("Accept-Language",acceptLanguage); - } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.MigrateProjectsPutMigrateProject_Call(request,onOk,onCreated,eventListener,sender); + await this.HyperVRunAsAccountsList_Call(request,onOk,eventListener,sender); } } - /// Method to create or update a migrate project. + /// Method to get run as accounts. /// - /// Standard request header. Used by service to respond to client in appropriate language. - /// Body with migrate project details. /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns 201 (Created). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task MigrateProjectsPutMigrateProjectViaIdentity(global::System.String viaIdentity, string acceptLanguage, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IMigrateProject body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task HyperVRunAsAccountsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2018-09-01-preview"; + var apiVersion = @"2020-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.Migrate/migrateProjects/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/HyperVSites/(?[^/]+)/runAsAccounts$", 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.Migrate/migrateProjects/{migrateProjectName}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/HyperVSites/{siteName}/runAsAccounts'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var migrateProjectName = _match.Groups["migrateProjectName"].Value; + var siteName = _match.Groups["siteName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.Migrate/migrateProjects/" - + migrateProjectName + + "/providers/Microsoft.OffAzure/HyperVSites/" + + siteName + + "/runAsAccounts" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -6647,35 +7294,24 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - // add headers parameters - if (null != acceptLanguage) - { - request.Headers.Add("Accept-Language",acceptLanguage); - } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.MigrateProjectsPutMigrateProject_Call(request,onOk,onCreated,eventListener,sender); + await this.HyperVRunAsAccountsList_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns 201 (Created). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 MigrateProjectsPutMigrateProject_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task HyperVRunAsAccountsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -6693,13 +7329,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.MigrateProject.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - case global::System.Net.HttpStatusCode.Created: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onCreated(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.MigrateProject.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.HyperVRunAsAccountCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -6719,45 +7349,41 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you - /// will get validation events back. + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. /// - /// Azure Subscription Id in which migrate project was created. - /// Name of the Azure Resource Group that migrate project is part of. - /// Name of the Azure Migrate project. - /// Standard request header. Used by service to respond to client in appropriate language. - /// Body with migrate project details. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site 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 MigrateProjectsPutMigrateProject_Validate(string subscriptionId, string resourceGroupName, string migrateProjectName, string acceptLanguage, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IMigrateProject body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task HyperVRunAsAccountsList_Validate(string subscriptionId, string resourceGroupName, string siteName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(migrateProjectName),migrateProjectName); - await eventListener.AssertNotNull(nameof(acceptLanguage),acceptLanguage); - await eventListener.AssertNotNull(nameof(body), body); - await eventListener.AssertObjectIsValid(nameof(body), body); + await eventListener.AssertNotNull(nameof(siteName),siteName); } } - /// Refresh the summary of the migrate project. - /// Azure Subscription Id in which migrate project was created. - /// Name of the Azure Resource Group that migrate project is part of. - /// Name of the Azure Migrate project. - /// The goal input which needs to be refreshed. + /// Method to create or update a site. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site name. + /// Body with site details. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task MigrateProjectsRefreshMigrateProjectSummary(string subscriptionId, string resourceGroupName, string migrateProjectName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IRefreshSummaryInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task HyperVSitesCreateOrUpdate(string subscriptionId, string resourceGroupName, string siteName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVSite body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2018-09-01-preview"; + var apiVersion = @"2020-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -6767,9 +7393,8 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.Migrate/migrateProjects/" - + global::System.Uri.EscapeDataString(migrateProjectName) - + "/refreshSummary" + + "/providers/Microsoft.OffAzure/HyperVSites/" + + global::System.Uri.EscapeDataString(siteName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -6778,7 +7403,7 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -6787,46 +7412,46 @@ public partial class Migrate request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.MigrateProjectsRefreshMigrateProjectSummary_Call(request,onOk,eventListener,sender); + await this.HyperVSitesCreateOrUpdate_Call(request,onOk,onCreated,eventListener,sender); } } - /// Refresh the summary of the migrate project. + /// Method to create or update a site. /// - /// The goal input which needs to be refreshed. + /// Body with site details. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task MigrateProjectsRefreshMigrateProjectSummaryViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IRefreshSummaryInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task HyperVSitesCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVSite body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2018-09-01-preview"; + var apiVersion = @"2020-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.Migrate/migrateProjects/(?[^/]+)/refreshSummary$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/HyperVSites/(?[^/]+)$", 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.Migrate/migrateProjects/{migrateProjectName}/refreshSummary'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/HyperVSites/{siteName}'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var migrateProjectName = _match.Groups["migrateProjectName"].Value; + var siteName = _match.Groups["siteName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.Migrate/migrateProjects/" - + migrateProjectName - + "/refreshSummary" + + "/providers/Microsoft.OffAzure/HyperVSites/" + + siteName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -6835,7 +7460,7 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -6844,21 +7469,20 @@ public partial class Migrate request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.MigrateProjectsRefreshMigrateProjectSummary_Call(request,onOk,eventListener,sender); + await this.HyperVSitesCreateOrUpdate_Call(request,onOk,onCreated,eventListener,sender); } } - /// - /// Actual wire call for method. - /// + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 MigrateProjectsRefreshMigrateProjectSummary_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task HyperVSitesCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -6876,7 +7500,13 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.RefreshSummaryResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.HyperVSite.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + case global::System.Net.HttpStatusCode.Created: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onCreated(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.HyperVSite.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -6896,44 +7526,43 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, - /// but you will get validation events back. + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. /// - /// Azure Subscription Id in which migrate project was created. - /// Name of the Azure Resource Group that migrate project is part of. - /// Name of the Azure Migrate project. - /// The goal input which needs to be refreshed. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site name. + /// Body with site details. /// 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 MigrateProjectsRefreshMigrateProjectSummary_Validate(string subscriptionId, string resourceGroupName, string migrateProjectName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IRefreshSummaryInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task HyperVSitesCreateOrUpdate_Validate(string subscriptionId, string resourceGroupName, string siteName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVSite body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(migrateProjectName),migrateProjectName); + await eventListener.AssertNotNull(nameof(siteName),siteName); await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// Registers a tool with the migrate project. - /// Azure Subscription Id in which migrate project was created. - /// Name of the Azure Resource Group that migrate project is part of. - /// Name of the Azure Migrate project. - /// Standard request header. Used by service to respond to client in appropriate language. - /// Input containing the name of the tool to be registered. + /// Method to delete a site. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site name. /// a delegate that is called when the remote service returns 200 (OK). + /// 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.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task MigrateProjectsRegisterTool(string subscriptionId, string resourceGroupName, string migrateProjectName, string acceptLanguage, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IRegisterToolInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task HyperVSitesDeleteSite(string subscriptionId, string resourceGroupName, string siteName, global::System.Func onOk, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2018-09-01-preview"; + var apiVersion = @"2020-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -6943,9 +7572,8 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.Migrate/migrateProjects/" - + global::System.Uri.EscapeDataString(migrateProjectName) - + "/registerTool" + + "/providers/Microsoft.OffAzure/HyperVSites/" + + global::System.Uri.EscapeDataString(siteName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -6954,62 +7582,50 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - // add headers parameters - if (null != acceptLanguage) - { - request.Headers.Add("Accept-Language",acceptLanguage); - } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.MigrateProjectsRegisterTool_Call(request,onOk,eventListener,sender); + await this.HyperVSitesDeleteSite_Call(request,onOk,onNoContent,eventListener,sender); } } - /// Registers a tool with the migrate project. + /// Method to delete a site. /// - /// Standard request header. Used by service to respond to client in appropriate language. - /// Input containing the name of the tool to be registered. /// a delegate that is called when the remote service returns 200 (OK). + /// 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.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task MigrateProjectsRegisterToolViaIdentity(global::System.String viaIdentity, string acceptLanguage, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IRegisterToolInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task HyperVSitesDeleteSiteViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2018-09-01-preview"; + var apiVersion = @"2020-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.Migrate/migrateProjects/(?[^/]+)/registerTool$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/HyperVSites/(?[^/]+)$", 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.Migrate/migrateProjects/{migrateProjectName}/registerTool'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/HyperVSites/{siteName}'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var migrateProjectName = _match.Groups["migrateProjectName"].Value; + var siteName = _match.Groups["siteName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.Migrate/migrateProjects/" - + migrateProjectName - + "/registerTool" + + "/providers/Microsoft.OffAzure/HyperVSites/" + + siteName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -7018,34 +7634,25 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - // add headers parameters - if (null != acceptLanguage) - { - request.Headers.Add("Accept-Language",acceptLanguage); - } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.MigrateProjectsRegisterTool_Call(request,onOk,eventListener,sender); + await this.HyperVSitesDeleteSite_Call(request,onOk,onNoContent,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). + /// 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.Migrate.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 MigrateProjectsRegisterTool_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task HyperVSitesDeleteSite_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -7063,7 +7670,13 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.RegistrationResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response); + break; + } + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); break; } default: @@ -7083,48 +7696,39 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will - /// get validation events back. + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. /// - /// Azure Subscription Id in which migrate project was created. - /// Name of the Azure Resource Group that migrate project is part of. - /// Name of the Azure Migrate project. - /// Standard request header. Used by service to respond to client in appropriate language. - /// Input containing the name of the tool to be registered. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site 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 MigrateProjectsRegisterTool_Validate(string subscriptionId, string resourceGroupName, string migrateProjectName, string acceptLanguage, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IRegisterToolInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task HyperVSitesDeleteSite_Validate(string subscriptionId, string resourceGroupName, string siteName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(migrateProjectName),migrateProjectName); - await eventListener.AssertNotNull(nameof(acceptLanguage),acceptLanguage); - await eventListener.AssertNotNull(nameof(body), body); - await eventListener.AssertObjectIsValid(nameof(body), body); + await eventListener.AssertNotNull(nameof(siteName),siteName); } } - /// 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. - /// Azure Subscription Id in which migrate project was created. - /// Fabric unique name. - /// Protection container name. - /// Migration item name. - /// The migration recovery point name. + /// Method to get a site. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task HyperVSitesGet(string subscriptionId, string resourceGroupName, string siteName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2020-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -7134,16 +7738,8 @@ public partial class Migrate + 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) + + "/providers/Microsoft.OffAzure/HyperVSites/" + + global::System.Uri.EscapeDataString(siteName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -7157,11 +7753,53 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.MigrationRecoveryPointsGet_Call(request,onOk,eventListener,sender); + await this.HyperVSitesGet_Call(request,onOk,eventListener,sender); } } - /// Gets a recovery point for a migration item. + /// Method to get site health summary. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site 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.Migrate.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task HyperVSitesGet1(string subscriptionId, string resourceGroupName, string siteName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-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.OffAzure/HyperVSites/" + + global::System.Uri.EscapeDataString(siteName) + + "/healthSummary" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.HyperVSitesGet1_Call(request,onOk,eventListener,sender); + } + } + + /// Method to get site health summary. /// /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. @@ -7169,44 +7807,33 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task HyperVSitesGet1ViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2020-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); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/HyperVSites/(?[^/]+)/healthSummary$", 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}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/HyperVSites/{siteName}/healthSummary'"); } // 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; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var siteName = _match.Groups["siteName"].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 + + "/providers/Microsoft.OffAzure/HyperVSites/" + + siteName + + "/healthSummary" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -7215,16 +7842,16 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.MigrationRecoveryPointsGet_Call(request,onOk,eventListener,sender); + await this.HyperVSitesGet1_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -7232,7 +7859,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task HyperVSitesGet1_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -7250,7 +7877,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.MigrationRecoveryPoint.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.SiteHealthSummaryCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -7270,50 +7897,39 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get - /// validation events back. + /// 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. - /// Azure Subscription Id in which migrate project was created. - /// Fabric unique name. - /// Protection container name. - /// Migration item name. - /// The migration recovery point name. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site 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.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task HyperVSitesGet1_Validate(string subscriptionId, string resourceGroupName, string siteName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(siteName),siteName); } } - /// 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. - /// Azure Subscription Id in which migrate project was created. - /// Fabric unique name. - /// Protection container name. - /// Migration item name. + /// Method to get site usage. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task HyperVSitesGet2(string subscriptionId, string resourceGroupName, string siteName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2020-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -7323,15 +7939,9 @@ public partial class Migrate + 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" + + "/providers/Microsoft.OffAzure/HyperVSites/" + + global::System.Uri.EscapeDataString(siteName) + + "/summary" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -7340,16 +7950,16 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.MigrationRecoveryPointsListByReplicationMigrationItems_Call(request,onOk,eventListener,sender); + await this.HyperVSitesGet2_Call(request,onOk,eventListener,sender); } } - /// Gets the recovery points for a migration item. + /// Method to get site usage. /// /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. @@ -7357,42 +7967,33 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task HyperVSitesGet2ViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2020-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); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/HyperVSites/(?[^/]+)/summary$", 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'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/HyperVSites/{siteName}/summary'"); } // 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 resourceGroupName = _match.Groups["resourceGroupName"].Value; + var siteName = _match.Groups["siteName"].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" + + "/providers/Microsoft.OffAzure/HyperVSites/" + + siteName + + "/summary" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -7401,18 +8002,16 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.MigrationRecoveryPointsListByReplicationMigrationItems_Call(request,onOk,eventListener,sender); + await this.HyperVSitesGet2_Call(request,onOk,eventListener,sender); } } - /// - /// Actual wire call for method. - /// + /// 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. @@ -7420,7 +8019,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task HyperVSitesGet2_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -7438,7 +8037,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.MigrationRecoveryPointCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.HyperVSiteUsage.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -7458,81 +8057,62 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the - /// actual call, but you will get validation events back. + /// 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. - /// Azure Subscription Id in which migrate project was created. - /// Fabric unique name. - /// Protection container name. - /// Migration item name. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site 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.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task HyperVSitesGet2_Validate(string subscriptionId, string resourceGroupName, string siteName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(siteName),siteName); } } - /// Get list of operations supported in the API. + /// Method to get a site. + /// /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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(global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task HyperVSitesGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2020-01-01"; // Constant Parameters using( NoSynchronizationContext ) { - // construct URL - var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( - "/providers/Microsoft.OffAzure/operations" - + "?" - + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) - ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - // generate request object - var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + // verify that Identity format is an exact match for uri - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } - // make the call - await this.OperationsList_Call(request,onOk,eventListener,sender); - } - } + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/HyperVSites/(?[^/]+)$", 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.OffAzure/HyperVSites/{siteName}'"); + } - /// Get a list of REST API supported by Microsoft.Migrate 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.Migrate.Runtime.ISendAsync pipeline to use to make the request. - /// - /// A that will be complete when handling of the response is completed. - /// - public async global::System.Threading.Tasks.Task OperationsList1(global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) - { - // Constant Parameters - using( NoSynchronizationContext ) - { + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var siteName = _match.Groups["siteName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( - "/providers/Microsoft.Migrate/operations" - + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.OffAzure/HyperVSites/" + + siteName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -7544,11 +8124,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.OperationsList1_Call(request,onOk,eventListener,sender); + await this.HyperVSitesGet_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -7556,7 +8136,7 @@ public partial class Migrate /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task OperationsList1_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task HyperVSitesGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -7574,7 +8154,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.OperationResultListAutoGenerated.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.HyperVSite.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -7594,33 +8174,39 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation + /// Validation method for method. Call this like the actual call, but you will get validation /// events back. /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site 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 OperationsList1_Validate(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task HyperVSitesGet_Validate(string subscriptionId, string resourceGroupName, string siteName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { - + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(siteName),siteName); } } - /// Operation to return the list of available operations. - /// The name of the resource group where the recovery services vault is present. - /// Azure Subscription Id in which migrate project was created. - /// a delegate that is called when the remote service returns 200 (OK). + /// Method to refresh a site. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site name. + /// a delegate that is called when the remote service returns 202 (Accepted). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task OperationsList2(string resourceGroupName, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task HyperVSitesRefresh(string subscriptionId, string resourceGroupName, string siteName, global::System.Func onAccepted, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2020-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -7630,7 +8216,9 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.RecoveryServices/operations" + + "/providers/Microsoft.OffAzure/HyperVSites/" + + global::System.Uri.EscapeDataString(siteName) + + "/refresh" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -7639,47 +8227,50 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.OperationsList2_Call(request,onOk,eventListener,sender); + await this.HyperVSitesRefresh_Call(request,onAccepted,eventListener,sender); } } - /// Operation to return the list of available operations. + /// Method to refresh a site. /// - /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 202 (Accepted). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task OperationsList2ViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task HyperVSitesRefreshViaIdentity(global::System.String viaIdentity, global::System.Func onAccepted, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2020-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); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/HyperVSites/(?[^/]+)/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/operations'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/HyperVSites/{siteName}/refresh'"); } // replace URI parameters with values from identity - var resourceGroupName = _match.Groups["resourceGroupName"].Value; var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var siteName = _match.Groups["siteName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.RecoveryServices/operations" + + "/providers/Microsoft.OffAzure/HyperVSites/" + + siteName + + "/refresh" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -7688,24 +8279,24 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.OperationsList2_Call(request,onOk,eventListener,sender); + await this.HyperVSitesRefresh_Call(request,onAccepted,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 202 (Accepted). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 OperationsList2_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task HyperVSitesRefresh_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onAccepted, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -7720,10 +8311,10 @@ public partial class Migrate switch ( _response.StatusCode ) { - case global::System.Net.HttpStatusCode.OK: + case global::System.Net.HttpStatusCode.Accepted: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.OperationsDiscoveryCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onAccepted(_response); break; } default: @@ -7743,33 +8334,84 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation + /// 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. - /// Azure Subscription Id in which migrate project was created. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site 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 OperationsList2_Validate(string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task HyperVSitesRefresh_Validate(string subscriptionId, string resourceGroupName, string siteName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { - await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(siteName),siteName); } } - /// Get list of operations supported in the API. + /// Method to patch an existing site. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site name. + /// Body with site details. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task HyperVSitesUpdate(string subscriptionId, string resourceGroupName, string siteName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVSite body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-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.OffAzure/HyperVSites/" + + global::System.Uri.EscapeDataString(siteName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.HyperVSitesUpdate_Call(request,onOk,onCreated,eventListener,sender); + } + } + + /// Method to patch an existing site. /// + /// Body with site details. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task HyperVSitesUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVSite body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2020-01-01"; // Constant Parameters @@ -7777,16 +8419,24 @@ public partial class Migrate { // verify that Identity format is an exact match for uri - var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.OffAzure/operations$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/HyperVSites/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { - throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.OffAzure/operations'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/HyperVSites/{siteName}'"); } // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var siteName = _match.Groups["siteName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( - "/providers/Microsoft.OffAzure/operations" + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.OffAzure/HyperVSites/" + + siteName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -7795,24 +8445,29 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.OperationsList_Call(request,onOk,eventListener,sender); + await this.HyperVSitesUpdate_Call(request,onOk,onCreated,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task HyperVSitesUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -7830,7 +8485,13 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.OperationResultList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.HyperVSite.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + case global::System.Net.HttpStatusCode.Created: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onCreated(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.HyperVSite.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -7850,38 +8511,43 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation + /// Validation method for method. Call this like the actual call, but you will get validation /// events back. /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site name. + /// Body with site details. /// 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(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task HyperVSitesUpdate_Validate(string subscriptionId, string resourceGroupName, string siteName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVSite body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { - + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(siteName),siteName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// 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. - /// Azure Subscription Id in which migrate project was created. - /// The fabric name. - /// The protection container name. - /// The replication protected item name. - /// The recovery point name. + /// Method to get job. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site name. + /// Job ARM 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task JobsGet(string subscriptionId, string resourceGroupName, string siteName, string jobName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2020-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -7891,16 +8557,10 @@ public partial class Migrate + 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) + + "/providers/Microsoft.OffAzure/VMwareSites/" + + global::System.Uri.EscapeDataString(siteName) + + "/jobs/" + + global::System.Uri.EscapeDataString(jobName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -7914,11 +8574,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.RecoveryPointsGet_Call(request,onOk,eventListener,sender); + await this.JobsGet_Call(request,onOk,eventListener,sender); } } - /// Get the details of specified recovery point. + /// Method to get job. /// /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. @@ -7926,44 +8586,35 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task JobsGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2020-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); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/VMwareSites/(?[^/]+)/jobs/(?[^/]+)$", 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}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/VMwareSites/{siteName}/jobs/{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 fabricName = _match.Groups["fabricName"].Value; - var protectionContainerName = _match.Groups["protectionContainerName"].Value; - var replicatedProtectedItemName = _match.Groups["replicatedProtectedItemName"].Value; - var recoveryPointName = _match.Groups["recoveryPointName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var siteName = _match.Groups["siteName"].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 - + "/replicationFabrics/" - + fabricName - + "/replicationProtectionContainers/" - + protectionContainerName - + "/replicationProtectedItems/" - + replicatedProtectedItemName - + "/recoveryPoints/" - + recoveryPointName + + "/providers/Microsoft.OffAzure/VMwareSites/" + + siteName + + "/jobs/" + + jobName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -7977,11 +8628,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.RecoveryPointsGet_Call(request,onOk,eventListener,sender); + await this.JobsGet_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -7989,7 +8640,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task JobsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -8007,7 +8658,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.RecoveryPoint.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.VMwareJob.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -8027,50 +8678,41 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation - /// events back. + /// 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. - /// Azure Subscription Id in which migrate project was created. - /// The fabric name. - /// The protection container name. - /// The replication protected item name. - /// The recovery point name. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site name. + /// Job 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 RecoveryPointsGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, string recoveryPointName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task JobsGet_Validate(string subscriptionId, string resourceGroupName, string siteName, string jobName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(siteName),siteName); + await eventListener.AssertNotNull(nameof(jobName),jobName); } } - /// 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. - /// Azure Subscription Id in which migrate project was created. - /// The fabric name. - /// The protection container name. - /// The replication protected item name. + /// Method to get all jobs in a site. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task JobsList(string subscriptionId, string resourceGroupName, string siteName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2020-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -8080,15 +8722,9 @@ public partial class Migrate + 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" + + "/providers/Microsoft.OffAzure/VMwareSites/" + + global::System.Uri.EscapeDataString(siteName) + + "/jobs" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -8102,11 +8738,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.RecoveryPointsListByReplicationProtectedItems_Call(request,onOk,eventListener,sender); + await this.JobsList_Call(request,onOk,eventListener,sender); } } - /// Lists the available recovery points for a replication protected item. + /// Method to get all jobs in a site. /// /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. @@ -8114,42 +8750,33 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task JobsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2020-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); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/VMwareSites/(?[^/]+)/jobs$", 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'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/VMwareSites/{siteName}/jobs'"); } // 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 resourceGroupName = _match.Groups["resourceGroupName"].Value; + var siteName = _match.Groups["siteName"].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" + + "/providers/Microsoft.OffAzure/VMwareSites/" + + siteName + + "/jobs" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -8163,13 +8790,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.RecoveryPointsListByReplicationProtectedItems_Call(request,onOk,eventListener,sender); + await this.JobsList_Call(request,onOk,eventListener,sender); } } - /// - /// Actual wire call for method. - /// + /// 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. @@ -8177,7 +8802,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task JobsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -8195,7 +8820,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.RecoveryPointCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.VMwareJobCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -8215,47 +8840,40 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, - /// but you will get validation events back. + /// 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. - /// Azure Subscription Id in which migrate project was created. - /// The fabric name. - /// The protection container name. - /// The replication protected item name. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site 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.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task JobsList_Validate(string subscriptionId, string resourceGroupName, string siteName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(siteName),siteName); } } - /// 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. - /// Azure Subscription Id in which migrate project was created. - /// The name of the email notification(alert) configuration. - /// The input to configure the email notification(alert). + /// Method to get machine. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site name. + /// Machine ARM 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IConfigureAlertRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task MachinesGet(string subscriptionId, string resourceGroupName, string siteName, string machineName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2020-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -8265,10 +8883,10 @@ public partial class Migrate + 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) + + "/providers/Microsoft.OffAzure/VMwareSites/" + + global::System.Uri.EscapeDataString(siteName) + + "/machines/" + + global::System.Uri.EscapeDataString(machineName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -8277,57 +8895,96 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationAlertSettingsCreate_Call(request,onOk,eventListener,sender); + await this.MachinesGet_Call(request,onOk,eventListener,sender); } } - /// Create or update an email notification(alert) configuration. - /// - /// The input to configure the email notification(alert). + /// Gets a machine in the migrate project. + /// Azure Subscription Id in which migrate project was created. + /// Name of the Azure Resource Group that migrate project is part of. + /// Name of the Azure Migrate project. + /// Unique name of a machine in Azure migration hub. /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IConfigureAlertRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task MachinesGetMachine(string subscriptionId, string resourceGroupName, string migrateProjectName, string machineName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2018-09-01-preview"; // 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}'"); - } - + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Migrate/migrateProjects/" + + global::System.Uri.EscapeDataString(migrateProjectName) + + "/machines/" + + global::System.Uri.EscapeDataString(machineName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.MachinesGetMachine_Call(request,onOk,eventListener,sender); + } + } + + /// Gets a machine in the migrate project. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task MachinesGetMachineViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-09-01-preview"; + // 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.Migrate/migrateProjects/(?[^/]+)/machines/(?[^/]+)$", 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.Migrate/migrateProjects/{migrateProjectName}/machines/{machineName}'"); + } + // 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; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var migrateProjectName = _match.Groups["migrateProjectName"].Value; + var machineName = _match.Groups["machineName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.RecoveryServices/vaults/" - + resourceName - + "/replicationAlertSettings/" - + alertSettingName + + "/providers/Microsoft.Migrate/migrateProjects/" + + migrateProjectName + + "/machines/" + + machineName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -8336,20 +8993,16 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationAlertSettingsCreate_Call(request,onOk,eventListener,sender); + await this.MachinesGetMachine_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -8357,7 +9010,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task MachinesGetMachine_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -8375,7 +9028,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.Alert.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.Machine.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -8395,76 +9048,29 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will - /// get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// The name of the email notification(alert) configuration. - /// The input to configure the email notification(alert). + /// Name of the Azure Resource Group that migrate project is part of. + /// Name of the Azure Migrate project. + /// Unique name of a machine in Azure migration hub. /// 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.Migrate.Models.Api202301.IConfigureAlertRequest body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task MachinesGetMachine_Validate(string subscriptionId, string resourceGroupName, string migrateProjectName, string machineName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. - /// Azure Subscription Id in which migrate project was created. - /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - // generate request object - var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } - // make the call - await this.ReplicationAlertSettingsGet_Call(request,onOk,eventListener,sender); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(migrateProjectName),migrateProjectName); + await eventListener.AssertNotNull(nameof(machineName),machineName); } } - /// Gets the details of the specified email notification(alert) configuration. + /// Method to get machine. /// /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. @@ -8472,35 +9078,35 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task MachinesGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2020-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); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/VMwareSites/(?[^/]+)/machines/(?[^/]+)$", 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}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/VMwareSites/{siteName}/machines/{machineName}'"); } // 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; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var siteName = _match.Groups["siteName"].Value; + var machineName = _match.Groups["machineName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.RecoveryServices/vaults/" - + resourceName - + "/replicationAlertSettings/" - + alertSettingName + + "/providers/Microsoft.OffAzure/VMwareSites/" + + siteName + + "/machines/" + + machineName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -8514,11 +9120,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationAlertSettingsGet_Call(request,onOk,eventListener,sender); + await this.MachinesGet_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -8526,7 +9132,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task MachinesGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -8544,7 +9150,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.Alert.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.VMwareMachine.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -8564,41 +9170,98 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will - /// get validation events back. + /// 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. - /// Azure Subscription Id in which migrate project was created. - /// The name of the email notification configuration. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site name. + /// Machine 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 ReplicationAlertSettingsGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string alertSettingName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task MachinesGet_Validate(string subscriptionId, string resourceGroupName, string siteName, string machineName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(siteName),siteName); + await eventListener.AssertNotNull(nameof(machineName),machineName); } } - /// 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. + /// Method to get machine. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site name. + /// + /// + /// Optional parameter for continuation token. + /// Total count of machines in the given site. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task MachinesList(string subscriptionId, string resourceGroupName, string siteName, string Filter, int? Top, string continuationToken, int? totalRecordCount, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-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.OffAzure/VMwareSites/" + + global::System.Uri.EscapeDataString(siteName) + + "/machines" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter)) + + "&" + + (null == Top ? global::System.String.Empty : "$top=" + global::System.Uri.EscapeDataString(Top.ToString())) + + "&" + + (string.IsNullOrEmpty(continuationToken) ? global::System.String.Empty : "continuationToken=" + global::System.Uri.EscapeDataString(continuationToken)) + + "&" + + (null == totalRecordCount ? global::System.String.Empty : "totalRecordCount=" + global::System.Uri.EscapeDataString(totalRecordCount.ToString())) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.MachinesList_Call(request,onOk,eventListener,sender); + } + } + + /// Gets a list of machines in the migrate project. /// Azure Subscription Id in which migrate project was created. + /// Name of the Azure Resource Group that migrate project is part of. + /// Name of the Azure Migrate project. + /// The continuation token. + /// The number of items to be returned in a single page. This value is honored only if it is less than + /// the 100. /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task MachinesList1(string subscriptionId, string resourceGroupName, string migrateProjectName, string continuationToken, int? pageSize, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2018-09-01-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -8608,11 +9271,15 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.RecoveryServices/vaults/" - + global::System.Uri.EscapeDataString(resourceName) - + "/replicationAlertSettings" + + "/providers/Microsoft.Migrate/migrateProjects/" + + global::System.Uri.EscapeDataString(migrateProjectName) + + "/machines" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(continuationToken) ? global::System.String.Empty : "continuationToken=" + global::System.Uri.EscapeDataString(continuationToken)) + + "&" + + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -8624,47 +9291,54 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationAlertSettingsList_Call(request,onOk,eventListener,sender); + await this.MachinesList1_Call(request,onOk,eventListener,sender); } } - /// Gets the list of email notification(alert) configurations for the vault. + /// Gets a list of machines in the migrate project. /// + /// The continuation token. + /// The number of items to be returned in a single page. This value is honored only if it is less than + /// the 100. /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task MachinesList1ViaIdentity(global::System.String viaIdentity, string continuationToken, int? pageSize, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2018-09-01-preview"; // 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); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Migrate/migrateProjects/(?[^/]+)/machines$", 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'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/migrateProjects/{migrateProjectName}/machines'"); } // 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 resourceGroupName = _match.Groups["resourceGroupName"].Value; + var migrateProjectName = _match.Groups["migrateProjectName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.RecoveryServices/vaults/" - + resourceName - + "/replicationAlertSettings" + + "/providers/Microsoft.Migrate/migrateProjects/" + + migrateProjectName + + "/machines" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + "&" + + (string.IsNullOrEmpty(continuationToken) ? global::System.String.Empty : "continuationToken=" + global::System.Uri.EscapeDataString(continuationToken)) + + "&" + + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -8676,11 +9350,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationAlertSettingsList_Call(request,onOk,eventListener,sender); + await this.MachinesList1_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -8688,7 +9362,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task MachinesList1_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -8706,7 +9380,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.AlertCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.MachineCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -8726,111 +9400,79 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will - /// get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. + /// Name of the Azure Resource Group that migrate project is part of. + /// Name of the Azure Migrate project. + /// The continuation token. + /// The number of items to be returned in a single page. This value is honored only if it is less than + /// the 100. /// 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.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task MachinesList1_Validate(string subscriptionId, string resourceGroupName, string migrateProjectName, string continuationToken, int? pageSize, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(migrateProjectName),migrateProjectName); + await eventListener.AssertNotNull(nameof(continuationToken),continuationToken); } } - /// 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. - /// Azure Subscription Id in which migrate project was created. - /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - // generate request object - var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Method to get machine. /// - /// OData filter options. + /// + /// + /// Optional parameter for continuation token. + /// Total count of machines in the given site. /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task MachinesListViaIdentity(global::System.String viaIdentity, string Filter, int? Top, string continuationToken, int? totalRecordCount, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2020-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); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/VMwareSites/(?[^/]+)/machines$", 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'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/VMwareSites/{siteName}/machines'"); } // 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 resourceGroupName = _match.Groups["resourceGroupName"].Value; + var siteName = _match.Groups["siteName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.RecoveryServices/vaults/" - + resourceName - + "/replicationAppliances" + + "/providers/Microsoft.OffAzure/VMwareSites/" + + siteName + + "/machines" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + "&" + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter)) + + "&" + + (null == Top ? global::System.String.Empty : "$top=" + global::System.Uri.EscapeDataString(Top.ToString())) + + "&" + + (string.IsNullOrEmpty(continuationToken) ? global::System.String.Empty : "continuationToken=" + global::System.Uri.EscapeDataString(continuationToken)) + + "&" + + (null == totalRecordCount ? global::System.String.Empty : "totalRecordCount=" + global::System.Uri.EscapeDataString(totalRecordCount.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -8842,11 +9484,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationAppliancesList_Call(request,onOk,eventListener,sender); + await this.MachinesList_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -8854,7 +9496,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task MachinesList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -8872,7 +9514,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ApplianceCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.VMwareMachineCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -8892,43 +9534,46 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get - /// validation events back. + /// 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. - /// Azure Subscription Id in which migrate project was created. - /// OData filter options. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site name. + /// + /// + /// Optional parameter for continuation token. + /// Total count of machines in the given site. /// 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.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task MachinesList_Validate(string subscriptionId, string resourceGroupName, string siteName, string Filter, int? Top, string continuationToken, int? totalRecordCount, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(siteName),siteName); await eventListener.AssertNotNull(nameof(Filter),Filter); + await eventListener.AssertNotNull(nameof(continuationToken),continuationToken); } } - /// - /// 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. - /// Azure Subscription Id in which migrate project was created. - /// Virtual Machine name. - /// a delegate that is called when the remote service returns 200 (OK). + /// Method to start a machine. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site name. + /// Machine ARM name. + /// a delegate that is called when the remote service returns 202 (Accepted). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task MachinesStartMachine(string subscriptionId, string resourceGroupName, string siteName, string machineName, global::System.Func onAccepted, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2020-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -8938,9 +9583,11 @@ public partial class Migrate + 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" + + "/providers/Microsoft.OffAzure/VMwareSites/" + + global::System.Uri.EscapeDataString(siteName) + + "/machines/" + + global::System.Uri.EscapeDataString(machineName) + + "/start" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -8949,52 +9596,53 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationEligibilityResultsGet_Call(request,onOk,eventListener,sender); + await this.MachinesStartMachine_Call(request,onAccepted,eventListener,sender); } } - /// - /// Validates whether a given VM can be protected or not in which case returns list of errors. - /// + /// Method to start a machine. /// - /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 202 (Accepted). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task MachinesStartMachineViaIdentity(global::System.String viaIdentity, global::System.Func onAccepted, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2020-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); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/VMwareSites/(?[^/]+)/machines/(?[^/]+)/start$", 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'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/VMwareSites/{siteName}/machines/{machineName}/start'"); } // 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; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var siteName = _match.Groups["siteName"].Value; + var machineName = _match.Groups["machineName"].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" + + "/providers/Microsoft.OffAzure/VMwareSites/" + + siteName + + "/machines/" + + machineName + + "/start" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -9003,24 +9651,24 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationEligibilityResultsGet_Call(request,onOk,eventListener,sender); + await this.MachinesStartMachine_Call(request,onAccepted,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 202 (Accepted). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task MachinesStartMachine_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onAccepted, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -9035,10 +9683,10 @@ public partial class Migrate switch ( _response.StatusCode ) { - case global::System.Net.HttpStatusCode.OK: + case global::System.Net.HttpStatusCode.Accepted: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ReplicationEligibilityResults.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onAccepted(_response); break; } default: @@ -9058,41 +9706,42 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you - /// will get validation events back. + /// 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. - /// Azure Subscription Id in which migrate project was created. - /// Virtual Machine name. - /// an instance that will receive events. - /// - /// A that will be complete when handling of the response is completed. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site name. + /// Machine 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 ReplicationEligibilityResultsGet_Validate(string resourceGroupName, string subscriptionId, string virtualMachineName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task MachinesStartMachine_Validate(string subscriptionId, string resourceGroupName, string siteName, string machineName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { - await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); - await eventListener.AssertNotNull(nameof(virtualMachineName),virtualMachineName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(siteName),siteName); + await eventListener.AssertNotNull(nameof(machineName),machineName); } } - /// - /// 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. - /// Azure Subscription Id in which migrate project was created. - /// Virtual Machine name. - /// a delegate that is called when the remote service returns 200 (OK). + /// Method to stop a machine. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site name. + /// Machine ARM name. + /// a delegate that is called when the remote service returns 202 (Accepted). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task MachinesStopMachine(string subscriptionId, string resourceGroupName, string siteName, string machineName, global::System.Func onAccepted, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2020-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -9102,9 +9751,11 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.Compute/virtualMachines/" - + global::System.Uri.EscapeDataString(virtualMachineName) - + "/providers/Microsoft.RecoveryServices/replicationEligibilityResults" + + "/providers/Microsoft.OffAzure/VMwareSites/" + + global::System.Uri.EscapeDataString(siteName) + + "/machines/" + + global::System.Uri.EscapeDataString(machineName) + + "/stop" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -9113,52 +9764,53 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationEligibilityResultsList_Call(request,onOk,eventListener,sender); + await this.MachinesStopMachine_Call(request,onAccepted,eventListener,sender); } } - /// - /// Validates whether a given VM can be protected or not in which case returns list of errors. - /// + /// Method to stop a machine. /// - /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 202 (Accepted). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task MachinesStopMachineViaIdentity(global::System.String viaIdentity, global::System.Func onAccepted, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2020-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); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/VMwareSites/(?[^/]+)/machines/(?[^/]+)/stop$", 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'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/VMwareSites/{siteName}/machines/{machineName}/stop'"); } // 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; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var siteName = _match.Groups["siteName"].Value; + var machineName = _match.Groups["machineName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.Compute/virtualMachines/" - + virtualMachineName - + "/providers/Microsoft.RecoveryServices/replicationEligibilityResults" + + "/providers/Microsoft.OffAzure/VMwareSites/" + + siteName + + "/machines/" + + machineName + + "/stop" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -9167,24 +9819,24 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationEligibilityResultsList_Call(request,onOk,eventListener,sender); + await this.MachinesStopMachine_Call(request,onAccepted,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 202 (Accepted). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task MachinesStopMachine_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onAccepted, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -9199,10 +9851,10 @@ public partial class Migrate switch ( _response.StatusCode ) { - case global::System.Net.HttpStatusCode.OK: + case global::System.Net.HttpStatusCode.Accepted: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ReplicationEligibilityResultsCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onAccepted(_response); break; } default: @@ -9222,40 +9874,42 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you - /// will get validation events back. + /// 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. - /// Azure Subscription Id in which migrate project was created. - /// Virtual Machine name. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site name. + /// Machine 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 ReplicationEligibilityResultsList_Validate(string resourceGroupName, string subscriptionId, string virtualMachineName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task MachinesStopMachine_Validate(string subscriptionId, string resourceGroupName, string siteName, string machineName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { - await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); - await eventListener.AssertNotNull(nameof(virtualMachineName),virtualMachineName); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(siteName),siteName); + await eventListener.AssertNotNull(nameof(machineName),machineName); } } - /// 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. + /// Delete the migrate project. Deleting non-existent project is a no-operation. /// Azure Subscription Id in which migrate project was created. - /// The name of the Azure Site Recovery event. + /// Name of the Azure Resource Group that migrate project is part of. + /// Name of the Azure Migrate project. + /// Standard request header. Used by service to respond to client in appropriate language. /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task MigrateProjectsDeleteMigrateProject(string subscriptionId, string resourceGroupName, string migrateProjectName, string acceptLanguage, global::System.Func onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2018-09-01-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -9265,10 +9919,8 @@ public partial class Migrate + 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) + + "/providers/Microsoft.Migrate/migrateProjects/" + + global::System.Uri.EscapeDataString(migrateProjectName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -9277,52 +9929,56 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + // add headers parameters + if (null != acceptLanguage) + { + request.Headers.Add("Accept-Language",acceptLanguage); + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationEventsGet_Call(request,onOk,eventListener,sender); + await this.MigrateProjectsDeleteMigrateProject_Call(request,onOk,eventListener,sender); } } - /// The operation to get the details of an Azure Site recovery event. + /// Delete the migrate project. Deleting non-existent project is a no-operation. /// + /// Standard request header. Used by service to respond to client in appropriate language. /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task MigrateProjectsDeleteMigrateProjectViaIdentity(global::System.String viaIdentity, string acceptLanguage, global::System.Func onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2018-09-01-preview"; // 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); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Migrate/migrateProjects/(?[^/]+)$", 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}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/migrateProjects/{migrateProjectName}'"); } // 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; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var migrateProjectName = _match.Groups["migrateProjectName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.RecoveryServices/vaults/" - + resourceName - + "/replicationEvents/" - + eventName + + "/providers/Microsoft.Migrate/migrateProjects/" + + migrateProjectName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -9331,16 +9987,22 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + // add headers parameters + if (null != acceptLanguage) + { + request.Headers.Add("Accept-Language",acceptLanguage); + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationEventsGet_Call(request,onOk,eventListener,sender); + await this.MigrateProjectsDeleteMigrateProject_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -9348,7 +10010,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task MigrateProjectsDeleteMigrateProject_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -9366,7 +10028,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.Event.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response); break; } default: @@ -9386,42 +10048,41 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation - /// events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// The name of the Azure Site Recovery event. + /// Name of the Azure Resource Group that migrate project is part of. + /// Name of the Azure Migrate project. + /// Standard request header. Used by service to respond to client in appropriate language. /// 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.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task MigrateProjectsDeleteMigrateProject_Validate(string subscriptionId, string resourceGroupName, string migrateProjectName, string acceptLanguage, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(migrateProjectName),migrateProjectName); + await eventListener.AssertNotNull(nameof(acceptLanguage),acceptLanguage); } } - /// 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. + /// Method to get a migrate project. /// Azure Subscription Id in which migrate project was created. - /// OData filter options. + /// Name of the Azure Resource Group that migrate project is part of. + /// Name of the Azure Migrate project. /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task MigrateProjectsGetMigrateProject(string subscriptionId, string resourceGroupName, string migrateProjectName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2018-09-01-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -9431,13 +10092,10 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.RecoveryServices/vaults/" - + global::System.Uri.EscapeDataString(resourceName) - + "/replicationEvents" + + "/providers/Microsoft.Migrate/migrateProjects/" + + global::System.Uri.EscapeDataString(migrateProjectName) + "?" + "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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -9449,50 +10107,46 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationEventsList_Call(request,onOk,eventListener,sender); + await this.MigrateProjectsGetMigrateProject_Call(request,onOk,eventListener,sender); } } - /// Gets the list of Azure Site Recovery events for the vault. + /// Method to get a migrate project. /// - /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task MigrateProjectsGetMigrateProjectViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2018-09-01-preview"; // 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); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Migrate/migrateProjects/(?[^/]+)$", 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'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/migrateProjects/{migrateProjectName}'"); } // 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 resourceGroupName = _match.Groups["resourceGroupName"].Value; + var migrateProjectName = _match.Groups["migrateProjectName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.RecoveryServices/vaults/" - + resourceName - + "/replicationEvents" + + "/providers/Microsoft.Migrate/migrateProjects/" + + migrateProjectName + "?" + "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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -9504,11 +10158,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationEventsList_Call(request,onOk,eventListener,sender); + await this.MigrateProjectsGetMigrateProject_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -9516,7 +10170,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task MigrateProjectsGetMigrateProject_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -9534,7 +10188,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.EventCollectionAutoGenerated.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.MigrateProject.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -9554,42 +10208,43 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation - /// events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// OData filter options. + /// Name of the Azure Resource Group that migrate project is part of. + /// Name of the Azure Migrate project. /// 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.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task MigrateProjectsGetMigrateProject_Validate(string subscriptionId, string resourceGroupName, string migrateProjectName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(migrateProjectName),migrateProjectName); } } - /// 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. + /// + /// Update a migrate project with specified name. Supports partial updates, for example only tags can be provided. + /// /// Azure Subscription Id in which migrate project was created. - /// Fabric name. + /// Name of the Azure Resource Group that migrate project is part of. + /// Name of the Azure Migrate project. + /// Standard request header. Used by service to respond to client in appropriate language. + /// Body with migrate project details. /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task MigrateProjectsPatchMigrateProject(string subscriptionId, string resourceGroupName, string migrateProjectName, string acceptLanguage, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IMigrateProject body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2018-09-01-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -9599,11 +10254,8 @@ public partial class Migrate + 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" + + "/providers/Microsoft.Migrate/migrateProjects/" + + global::System.Uri.EscapeDataString(migrateProjectName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -9612,53 +10264,63 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + // add headers parameters + if (null != acceptLanguage) + { + request.Headers.Add("Accept-Language",acceptLanguage); + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationFabricsCheckConsistency_Call(request,onOk,eventListener,sender); + await this.MigrateProjectsPatchMigrateProject_Call(request,onOk,eventListener,sender); } } - /// The operation to perform a consistency check on the fabric. + /// + /// Update a migrate project with specified name. Supports partial updates, for example only tags can be provided. + /// /// + /// Standard request header. Used by service to respond to client in appropriate language. + /// Body with migrate project details. /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task MigrateProjectsPatchMigrateProjectViaIdentity(global::System.String viaIdentity, string acceptLanguage, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IMigrateProject body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2018-09-01-preview"; // 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); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Migrate/migrateProjects/(?[^/]+)$", 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'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/migrateProjects/{migrateProjectName}'"); } // 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 resourceGroupName = _match.Groups["resourceGroupName"].Value; + var migrateProjectName = _match.Groups["migrateProjectName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.RecoveryServices/vaults/" - + resourceName - + "/replicationFabrics/" - + fabricName - + "/checkConsistency" + + "/providers/Microsoft.Migrate/migrateProjects/" + + migrateProjectName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -9667,16 +10329,26 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + // add headers parameters + if (null != acceptLanguage) + { + request.Headers.Add("Accept-Language",acceptLanguage); + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationFabricsCheckConsistency_Call(request,onOk,eventListener,sender); + await this.MigrateProjectsPatchMigrateProject_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -9684,7 +10356,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task MigrateProjectsPatchMigrateProject_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -9695,106 +10367,6 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - break; - } - } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -9802,7 +10374,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.Fabric.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.MigrateProject.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -9822,43 +10394,47 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. + /// Name of the Azure Resource Group that migrate project is part of. + /// Name of the Azure Migrate project. + /// Standard request header. Used by service to respond to client in appropriate language. + /// Body with migrate project details. /// 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.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task MigrateProjectsPatchMigrateProject_Validate(string subscriptionId, string resourceGroupName, string migrateProjectName, string acceptLanguage, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IMigrateProject body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(migrateProjectName),migrateProjectName); + await eventListener.AssertNotNull(nameof(acceptLanguage),acceptLanguage); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// 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. + /// Method to create or update a migrate project. /// Azure Subscription Id in which migrate project was created. - /// Name of the ASR fabric. - /// Fabric creation input. + /// Name of the Azure Resource Group that migrate project is part of. + /// Name of the Azure Migrate project. + /// Standard request header. Used by service to respond to client in appropriate language. + /// Body with migrate project details. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IFabricCreationInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task MigrateProjectsPutMigrateProject(string subscriptionId, string resourceGroupName, string migrateProjectName, string acceptLanguage, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IMigrateProject body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2018-09-01-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -9868,10 +10444,8 @@ public partial class Migrate + 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) + + "/providers/Microsoft.Migrate/migrateProjects/" + + global::System.Uri.EscapeDataString(migrateProjectName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -9883,54 +10457,59 @@ public partial class Migrate var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + // add headers parameters + if (null != acceptLanguage) + { + request.Headers.Add("Accept-Language",acceptLanguage); + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationFabricsCreate_Call(request,onOk,eventListener,sender); + await this.MigrateProjectsPutMigrateProject_Call(request,onOk,onCreated,eventListener,sender); } } - /// The operation to create an Azure Site Recovery fabric (for e.g. Hyper-V site). + /// Method to create or update a migrate project. /// - /// Fabric creation input. + /// Standard request header. Used by service to respond to client in appropriate language. + /// Body with migrate project details. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IFabricCreationInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task MigrateProjectsPutMigrateProjectViaIdentity(global::System.String viaIdentity, string acceptLanguage, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IMigrateProject body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2018-09-01-preview"; // 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); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Migrate/migrateProjects/(?[^/]+)$", 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}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/migrateProjects/{migrateProjectName}'"); } // 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 resourceGroupName = _match.Groups["resourceGroupName"].Value; + var migrateProjectName = _match.Groups["migrateProjectName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.RecoveryServices/vaults/" - + resourceName - + "/replicationFabrics/" - + fabricName + + "/providers/Microsoft.Migrate/migrateProjects/" + + migrateProjectName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -9942,25 +10521,32 @@ public partial class Migrate var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // add headers parameters + if (null != acceptLanguage) + { + request.Headers.Add("Accept-Language",acceptLanguage); + } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationFabricsCreate_Call(request,onOk,eventListener,sender); + await this.MigrateProjectsPutMigrateProject_Call(request,onOk,onCreated,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task MigrateProjectsPutMigrateProject_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -9971,105 +10557,6 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - break; - } - } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -10077,7 +10564,13 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.Fabric.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.MigrateProject.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + case global::System.Net.HttpStatusCode.Created: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onCreated(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.MigrateProject.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -10097,45 +10590,45 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get - /// validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Name of the ASR fabric. - /// Fabric creation input. + /// Name of the Azure Resource Group that migrate project is part of. + /// Name of the Azure Migrate project. + /// Standard request header. Used by service to respond to client in appropriate language. + /// Body with migrate project details. /// 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.Migrate.Models.Api202301.IFabricCreationInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task MigrateProjectsPutMigrateProject_Validate(string subscriptionId, string resourceGroupName, string migrateProjectName, string acceptLanguage, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IMigrateProject body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(migrateProjectName),migrateProjectName); + await eventListener.AssertNotNull(nameof(acceptLanguage),acceptLanguage); 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. + /// Refresh the summary of the migrate project. /// Azure Subscription Id in which migrate project was created. - /// ASR fabric to delete. - /// a delegate that is called when the remote service returns 204 (NoContent). + /// Name of the Azure Resource Group that migrate project is part of. + /// Name of the Azure Migrate project. + /// The goal input which needs to be refreshed. + /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task MigrateProjectsRefreshMigrateProjectSummary(string subscriptionId, string resourceGroupName, string migrateProjectName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IRefreshSummaryInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2018-09-01-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -10145,11 +10638,9 @@ public partial class Migrate + 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" + + "/providers/Microsoft.Migrate/migrateProjects/" + + global::System.Uri.EscapeDataString(migrateProjectName) + + "/refreshSummary" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -10162,49 +10653,51 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationFabricsDelete_Call(request,onNoContent,eventListener,sender); + await this.MigrateProjectsRefreshMigrateProjectSummary_Call(request,onOk,eventListener,sender); } } - /// The operation to delete or remove an Azure Site Recovery fabric. + /// Refresh the summary of the migrate project. /// - /// a delegate that is called when the remote service returns 204 (NoContent). + /// The goal input which needs to be refreshed. + /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task MigrateProjectsRefreshMigrateProjectSummaryViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IRefreshSummaryInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2018-09-01-preview"; // 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); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Migrate/migrateProjects/(?[^/]+)/refreshSummary$", 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'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/migrateProjects/{migrateProjectName}/refreshSummary'"); } // 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 resourceGroupName = _match.Groups["resourceGroupName"].Value; + var migrateProjectName = _match.Groups["migrateProjectName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.RecoveryServices/vaults/" - + resourceName - + "/replicationFabrics/" - + fabricName - + "/remove" + + "/providers/Microsoft.Migrate/migrateProjects/" + + migrateProjectName + + "/refreshSummary" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -10217,20 +10710,26 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationFabricsDelete_Call(request,onNoContent,eventListener,sender); + await this.MigrateProjectsRefreshMigrateProjectSummary_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// + /// Actual wire call for method. + /// /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task MigrateProjectsRefreshMigrateProjectSummary_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -10241,114 +10740,14 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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: + case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onNoContent(_response); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.RefreshSummaryResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -10368,43 +10767,44 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get - /// validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// ASR fabric to delete. + /// Name of the Azure Resource Group that migrate project is part of. + /// Name of the Azure Migrate project. + /// The goal input which needs to be refreshed. /// 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.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task MigrateProjectsRefreshMigrateProjectSummary_Validate(string subscriptionId, string resourceGroupName, string migrateProjectName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IRefreshSummaryInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(migrateProjectName),migrateProjectName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// 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. + /// Registers a tool with the migrate project. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. - /// OData filter options. + /// Name of the Azure Resource Group that migrate project is part of. + /// Name of the Azure Migrate project. + /// Standard request header. Used by service to respond to client in appropriate language. + /// Input containing the name of the tool to be registered. /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task MigrateProjectsRegisterTool(string subscriptionId, string resourceGroupName, string migrateProjectName, string acceptLanguage, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IRegisterToolInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2018-09-01-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -10414,87 +10814,101 @@ public partial class Migrate + 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) + + "/providers/Microsoft.Migrate/migrateProjects/" + + global::System.Uri.EscapeDataString(migrateProjectName) + + "/registerTool" + "?" + "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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + // add headers parameters + if (null != acceptLanguage) + { + request.Headers.Add("Accept-Language",acceptLanguage); + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationFabricsGet_Call(request,onOk,eventListener,sender); + await this.MigrateProjectsRegisterTool_Call(request,onOk,eventListener,sender); } } - /// Gets the details of an Azure Site Recovery fabric. + /// Registers a tool with the migrate project. /// - /// OData filter options. + /// Standard request header. Used by service to respond to client in appropriate language. + /// Input containing the name of the tool to be registered. /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task MigrateProjectsRegisterToolViaIdentity(global::System.String viaIdentity, string acceptLanguage, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IRegisterToolInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2018-09-01-preview"; // 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); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Migrate/migrateProjects/(?[^/]+)/registerTool$", 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}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/migrateProjects/{migrateProjectName}/registerTool'"); } // 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 resourceGroupName = _match.Groups["resourceGroupName"].Value; + var migrateProjectName = _match.Groups["migrateProjectName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.RecoveryServices/vaults/" - + resourceName - + "/replicationFabrics/" - + fabricName + + "/providers/Microsoft.Migrate/migrateProjects/" + + migrateProjectName + + "/registerTool" + "?" + "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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + // add headers parameters + if (null != acceptLanguage) + { + request.Headers.Add("Accept-Language",acceptLanguage); + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationFabricsGet_Call(request,onOk,eventListener,sender); + await this.MigrateProjectsRegisterTool_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -10502,7 +10916,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task MigrateProjectsRegisterTool_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -10520,7 +10934,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.Fabric.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.RegistrationResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -10540,41 +10954,46 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation - /// events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. - /// OData filter options. + /// Name of the Azure Resource Group that migrate project is part of. + /// Name of the Azure Migrate project. + /// Standard request header. Used by service to respond to client in appropriate language. + /// Input containing the name of the tool to be registered. /// 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.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task MigrateProjectsRegisterTool_Validate(string subscriptionId, string resourceGroupName, string migrateProjectName, string acceptLanguage, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IRegisterToolInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(migrateProjectName),migrateProjectName); + await eventListener.AssertNotNull(nameof(acceptLanguage),acceptLanguage); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// Gets a list of the Azure Site Recovery fabrics in the vault. + /// 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. /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -10588,7 +11007,14 @@ public partial class Migrate + global::System.Uri.EscapeDataString(resourceGroupName) + "/providers/Microsoft.RecoveryServices/vaults/" + global::System.Uri.EscapeDataString(resourceName) - + "/replicationFabrics" + + "/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"); @@ -10602,11 +11028,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationFabricsList_Call(request,onOk,eventListener,sender); + await this.MigrationRecoveryPointsGet_Call(request,onOk,eventListener,sender); } } - /// Gets a list of the Azure Site Recovery fabrics in the vault. + /// 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. @@ -10614,7 +11040,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -10622,16 +11048,20 @@ public partial class Migrate { // 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); + 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'"); + 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/" @@ -10640,7 +11070,14 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationFabrics" + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationMigrationItems/" + + migrationItemName + + "/migrationRecoveryPoints/" + + migrationRecoveryPointName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -10654,11 +11091,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationFabricsList_Call(request,onOk,eventListener,sender); + await this.MigrationRecoveryPointsGet_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -10666,7 +11103,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -10684,7 +11121,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.FabricCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.MigrationRecoveryPoint.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -10704,38 +11141,48 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation - /// events back. + /// 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. /// Azure Subscription Id in which migrate project was created. + /// 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 ReplicationFabricsList_Validate(string resourceName, string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + 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.Migrate.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); } } - /// The operation to migrate an Azure Site Recovery fabric to AAD. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// 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.Migrate.Runtime.ISendAsync pipeline to use to make the request. - /// + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -10751,7 +11198,11 @@ public partial class Migrate + global::System.Uri.EscapeDataString(resourceName) + "/replicationFabrics/" + global::System.Uri.EscapeDataString(fabricName) - + "/migratetoaad" + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationMigrationItems/" + + global::System.Uri.EscapeDataString(migrationItemName) + + "/migrationRecoveryPoints" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -10760,24 +11211,24 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationFabricsMigrateToAad_Call(request,onNoContent,eventListener,sender); + await this.MigrationRecoveryPointsListByReplicationMigrationItems_Call(request,onOk,eventListener,sender); } } - /// The operation to migrate an Azure Site Recovery fabric to AAD. + /// Gets the recovery points for a migration item. /// - /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -10785,10 +11236,10 @@ public partial class Migrate { // 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); + 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}/migratetoaad'"); + 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 @@ -10796,6 +11247,8 @@ public partial class Migrate 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/" @@ -10806,7 +11259,11 @@ public partial class Migrate + resourceName + "/replicationFabrics/" + fabricName - + "/migratetoaad" + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationMigrationItems/" + + migrationItemName + + "/migrationRecoveryPoints" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -10815,24 +11272,26 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationFabricsMigrateToAad_Call(request,onNoContent,eventListener,sender); + await this.MigrationRecoveryPointsListByReplicationMigrationItems_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// + /// Actual wire call for method. + /// /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -10843,114 +11302,14 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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: + case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onNoContent(_response); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.MigrationRecoveryPointCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -10970,18 +11329,20 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will - /// get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// ASR fabric to migrate. + /// 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 ReplicationFabricsMigrateToAad_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + 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.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -10989,36 +11350,27 @@ public partial class Migrate 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); } } - /// 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. - /// Azure Subscription Id in which migrate project was created. - /// ASR fabric to purge. - /// a delegate that is called when the remote service returns 204 (NoContent). + /// Get list of operations supported in the API. + /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task OperationsList(global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2020-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) + "/providers/Microsoft.OffAzure/operations" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -11027,78 +11379,55 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationFabricsPurge_Call(request,onNoContent,eventListener,sender); + await this.OperationsList_Call(request,onOk,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). + /// Get a list of REST API supported by Microsoft.Migrate 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task OperationsList1(global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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) + "/providers/Microsoft.Migrate/operations" + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationFabricsPurge_Call(request,onNoContent,eventListener,sender); + await this.OperationsList1_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task OperationsList1_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -11109,114 +11438,14 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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: + case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onNoContent(_response); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.OperationResultListAutoGenerated.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -11236,43 +11465,31 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get - /// validation events back. + /// 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. - /// Azure Subscription Id in which migrate project was created. - /// 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.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task OperationsList1_Validate(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Operation to return the list of available operations. /// The name of the resource group where the recovery services vault is present. /// Azure Subscription Id in which migrate project was created. - /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IFailoverProcessServerRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task OperationsList2(string resourceGroupName, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -11284,11 +11501,7 @@ public partial class Migrate + 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" + + "/providers/Microsoft.RecoveryServices/operations" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -11297,31 +11510,24 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationFabricsReassociateGateway_Call(request,onOk,eventListener,sender); + await this.OperationsList2_Call(request,onOk,eventListener,sender); } } - /// - /// The operation to move replications from a process server to another process server. - /// + /// Operation to return the list of available operations. /// - /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IFailoverProcessServerRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task OperationsList2ViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -11329,28 +11535,22 @@ public partial class Migrate { // 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); + 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/vaults/{resourceName}/replicationFabrics/{fabricName}/reassociateGateway'"); + 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 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" + + "/providers/Microsoft.RecoveryServices/operations" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -11359,22 +11559,16 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationFabricsReassociateGateway_Call(request,onOk,eventListener,sender); + await this.OperationsList2_Call(request,onOk,eventListener,sender); } } - /// - /// Actual wire call for method. - /// + /// 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. @@ -11382,7 +11576,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task OperationsList2_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -11393,106 +11587,6 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - break; - } - } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -11500,7 +11594,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.Fabric.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.OperationsDiscoveryCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -11520,60 +11614,42 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but - /// you will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// 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.Migrate.Models.Api202301.IFailoverProcessServerRequest body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task OperationsList2_Validate(string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. - /// Azure Subscription Id in which migrate project was created. - /// fabric name to renew certs for. - /// Renew certificate input. + /// Gets the operations. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IRenewCertificateInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task OperationsList3(global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2021-02-16-preview"; // 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" + "/providers/Microsoft.DataReplication/operations" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -11582,58 +11658,43 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationFabricsRenewCertificate_Call(request,onOk,eventListener,sender); + await this.OperationsList3_Call(request,onOk,onDefault,eventListener,sender); } } - /// Renews the connection certificate for the ASR replication fabric. + /// Gets the operations. /// - /// Renew certificate input. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IRenewCertificateInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task OperationsList3ViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2021-02-16-preview"; // 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); + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.DataReplication/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/vaults/{resourceName}/replicationFabrics/{fabricName}/renewCertificate'"); + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.DataReplication/operations'"); } // 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" + "/providers/Microsoft.DataReplication/operations" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -11642,28 +11703,26 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationFabricsRenewCertificate_Call(request,onOk,eventListener,sender); + await this.OperationsList3_Call(request,onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task OperationsList3_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -11674,106 +11733,112 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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 ); + var _contentType = _response.Content.Headers.ContentType?.MediaType; - // 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"); + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.OperationListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; } - if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { - location = _response.GetFirstHeader(@"Location"); + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; } - 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.Migrate.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; + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } - // check for cancellation - if( eventListener.Token.IsCancellationRequested ) { return; } + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// 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 OperationsList3_Validate(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { - // drop the old response - _response?.Dispose(); + } + } - // make the polling call - _response = await sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + /// Get list of operations supported in the API. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri - // 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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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; - } + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.OffAzure/operations$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.OffAzure/operations'"); + } - switch( state?.ToString()?.ToLower() ) - { - case "failed": - error = true; - break; - case "succeeded": - case "canceled": - // we're done polling. - break; + // replace URI parameters with values from identity + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/providers/Microsoft.OffAzure/operations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - 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.Migrate.Runtime.UndeclaredResponseException(_response); - } - } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - // 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.Migrate.Runtime.Method.Get); + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - // drop the old response - _response?.Dispose(); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.OperationsList_Call(request,onOk,eventListener,sender); + } + } - // make the final call - _response = await sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - break; - } - } + /// 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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -11781,7 +11846,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.Fabric.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.OperationResultList.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -11801,45 +11866,38 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you - /// will get validation events back. + /// 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. - /// Azure Subscription Id in which migrate project was created. - /// 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.Migrate.Models.Api202301.IRenewCertificateInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task OperationsList_Validate(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Creates the policy. /// Azure Subscription Id in which migrate project was created. - /// Job identifier. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The policy name. + /// Policy model. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PolicyCreate(string subscriptionId, string resourceGroupName, string vaultName, string policyName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2021-02-16-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -11849,11 +11907,10 @@ public partial class Migrate + 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" + + "/providers/Microsoft.DataReplication/replicationVaults/" + + global::System.Uri.EscapeDataString(vaultName) + + "/replicationPolicies/" + + global::System.Uri.EscapeDataString(policyName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -11862,53 +11919,59 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationJobsCancel_Call(request,onOk,eventListener,sender); + await this.PolicyCreate_Call(request,onOk,onDefault,eventListener,sender); } } - /// The operation to cancel an Azure Site Recovery job. + /// Creates the policy. /// + /// Policy model. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PolicyCreateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2021-02-16-preview"; // 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); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataReplication/replicationVaults/(?[^/]+)/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}/replicationJobs/{jobName}/cancel'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/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 jobName = _match.Groups["jobName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var vaultName = _match.Groups["vaultName"].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 - + "/replicationJobs/" - + jobName - + "/cancel" + + "/providers/Microsoft.DataReplication/replicationVaults/" + + vaultName + + "/replicationPolicies/" + + policyName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -11917,24 +11980,30 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationJobsCancel_Call(request,onOk,eventListener,sender); + await this.PolicyCreate_Call(request,onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task PolicyCreate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -11947,7 +12016,7 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 + // declared final-state-via: location var _finalUri = _response.GetFirstHeader(@"Location"); var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); var location = _response.GetFirstHeader(@"Location"); @@ -12031,19 +12100,16 @@ public partial class Migrate 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.Migrate.Runtime.Method.Get); + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get); - // drop the old response - _response?.Dispose(); + // drop the old response + _response?.Dispose(); - // make the final call - _response = await sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - break; - } + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; } var _contentType = _response.Content.Headers.ContentType?.MediaType; @@ -12052,12 +12118,14 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.Job.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PolicyModel.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { - throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; } } } @@ -12072,44 +12140,51 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Job identifier. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The policy name. + /// Policy model. /// 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.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task PolicyCreate_Validate(string subscriptionId, string resourceGroupName, string vaultName, string policyName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(vaultName),vaultName); + await eventListener.AssertRegEx(nameof(vaultName),vaultName,@"^[a-zA-Z0-9]*$"); + await eventListener.AssertNotNull(nameof(policyName),policyName); + await eventListener.AssertRegEx(nameof(policyName),policyName,@"^[a-zA-Z0-9]*$"); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// - /// 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. + /// Removes the policy. /// Azure Subscription Id in which migrate project was created. - /// job query filter. - /// a delegate that is called when the remote service returns 200 (OK). + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The policy name. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IJobQueryParameter body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PolicyDelete(string subscriptionId, string resourceGroupName, string vaultName, string policyName, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2021-02-16-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -12119,9 +12194,10 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.RecoveryServices/vaults/" - + global::System.Uri.EscapeDataString(resourceName) - + "/replicationJobs/export" + + "/providers/Microsoft.DataReplication/replicationVaults/" + + global::System.Uri.EscapeDataString(vaultName) + + "/replicationPolicies/" + + global::System.Uri.EscapeDataString(policyName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -12130,57 +12206,54 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationJobsExport_Call(request,onOk,eventListener,sender); + await this.PolicyDelete_Call(request,onNoContent,onDefault,eventListener,sender); } } - /// - /// The operation to export the details of the Azure Site Recovery jobs of the vault. - /// + /// Removes the policy. /// - /// job query filter. - /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IJobQueryParameter body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PolicyDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2021-02-16-preview"; // 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); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataReplication/replicationVaults/(?[^/]+)/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}/replicationJobs/export'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/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 resourceGroupName = _match.Groups["resourceGroupName"].Value; + var vaultName = _match.Groups["vaultName"].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 - + "/replicationJobs/export" + + "/providers/Microsoft.DataReplication/replicationVaults/" + + vaultName + + "/replicationPolicies/" + + policyName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -12189,28 +12262,26 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationJobsExport_Call(request,onOk,eventListener,sender); + await this.PolicyDelete_Call(request,onNoContent,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task PolicyDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -12223,7 +12294,7 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 + // declared final-state-via: location var _finalUri = _response.GetFirstHeader(@"Location"); var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); var location = _response.GetFirstHeader(@"Location"); @@ -12307,33 +12378,32 @@ public partial class Migrate 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.Migrate.Runtime.Method.Get); + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get); - // drop the old response - _response?.Dispose(); + // drop the old response + _response?.Dispose(); - // make the final call - _response = await sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - break; - } + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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: + case global::System.Net.HttpStatusCode.NoContent: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.Job.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onNoContent(_response); break; } default: { - throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; } } } @@ -12348,43 +12418,48 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation + /// 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. /// Azure Subscription Id in which migrate project was created. - /// job query filter. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The 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 ReplicationJobsExport_Validate(string resourceName, string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IJobQueryParameter body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task PolicyDelete_Validate(string subscriptionId, string resourceGroupName, string vaultName, string policyName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(vaultName),vaultName); + await eventListener.AssertRegEx(nameof(vaultName),vaultName,@"^[a-zA-Z0-9]*$"); + await eventListener.AssertNotNull(nameof(policyName),policyName); + await eventListener.AssertRegEx(nameof(policyName),policyName,@"^[a-zA-Z0-9]*$"); } } - /// 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. + /// Gets the details of the policy. /// Azure Subscription Id in which migrate project was created. - /// Job identifier. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The policy name. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PolicyGet(string subscriptionId, string resourceGroupName, string vaultName, string policyName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2021-02-16-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -12394,10 +12469,10 @@ public partial class Migrate + 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) + + "/providers/Microsoft.DataReplication/replicationVaults/" + + global::System.Uri.EscapeDataString(vaultName) + + "/replicationPolicies/" + + global::System.Uri.EscapeDataString(policyName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -12411,47 +12486,49 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationJobsGet_Call(request,onOk,eventListener,sender); + await this.PolicyGet_Call(request,onOk,onDefault,eventListener,sender); } } - /// Get the details of an Azure Site Recovery job. + /// Gets the details of the policy. /// /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PolicyGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2021-02-16-preview"; // 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); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataReplication/replicationVaults/(?[^/]+)/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}/replicationJobs/{jobName}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/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 jobName = _match.Groups["jobName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var vaultName = _match.Groups["vaultName"].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 - + "/replicationJobs/" - + jobName + + "/providers/Microsoft.DataReplication/replicationVaults/" + + vaultName + + "/replicationPolicies/" + + policyName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -12465,19 +12542,21 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationJobsGet_Call(request,onOk,eventListener,sender); + await this.PolicyGet_Call(request,onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task PolicyGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -12495,12 +12574,14 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.Job.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PolicyModel.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { - throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; } } } @@ -12515,42 +12596,47 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation - /// events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Job identifier. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The 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 ReplicationJobsGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string jobName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task PolicyGet_Validate(string subscriptionId, string resourceGroupName, string vaultName, string policyName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(vaultName),vaultName); + await eventListener.AssertRegEx(nameof(vaultName),vaultName,@"^[a-zA-Z0-9]*$"); + await eventListener.AssertNotNull(nameof(policyName),policyName); + await eventListener.AssertRegEx(nameof(policyName),policyName,@"^[a-zA-Z0-9]*$"); } } - /// 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. + /// Gets the list of policies in the given vault. /// Azure Subscription Id in which migrate project was created. - /// OData filter options. + /// The name of the resource group. The name is case insensitive. + /// The vault name. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PolicyList(string subscriptionId, string resourceGroupName, string vaultName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2021-02-16-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -12560,13 +12646,11 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.RecoveryServices/vaults/" - + global::System.Uri.EscapeDataString(resourceName) - + "/replicationJobs" + + "/providers/Microsoft.DataReplication/replicationVaults/" + + global::System.Uri.EscapeDataString(vaultName) + + "/replicationPolicies" + "?" + "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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -12578,50 +12662,49 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationJobsList_Call(request,onOk,eventListener,sender); + await this.PolicyList_Call(request,onOk,onDefault,eventListener,sender); } } - /// Gets the list of Azure Site Recovery Jobs for the vault. + /// Gets the list of policies in the given vault. /// - /// OData filter options. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PolicyListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2021-02-16-preview"; // 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); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataReplication/replicationVaults/(?[^/]+)/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}/replicationJobs'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/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; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var vaultName = _match.Groups["vaultName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.RecoveryServices/vaults/" - + resourceName - + "/replicationJobs" + + "/providers/Microsoft.DataReplication/replicationVaults/" + + vaultName + + "/replicationPolicies" + "?" + "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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -12633,19 +12716,21 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationJobsList_Call(request,onOk,eventListener,sender); + await this.PolicyList_Call(request,onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task PolicyList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -12663,12 +12748,14 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.JobCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PolicyModelCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { - throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; } } } @@ -12683,42 +12770,46 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation - /// events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// OData filter options. + /// The name of the resource group. The name is case insensitive. + /// The vault 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 ReplicationJobsList_Validate(string resourceName, string resourceGroupName, string subscriptionId, string Filter, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task PolicyList_Validate(string subscriptionId, string resourceGroupName, string vaultName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(vaultName),vaultName); + await eventListener.AssertRegEx(nameof(vaultName),vaultName,@"^[a-zA-Z0-9]*$"); } } - /// 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. + /// Tracks the results of an asynchronous operation on the policy. /// Azure Subscription Id in which migrate project was created. - /// Job identifier. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The policy name. + /// The ID of an ongoing async operation. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PolicyOperationStatusGet(string subscriptionId, string resourceGroupName, string vaultName, string policyName, string operationId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2021-02-16-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -12728,11 +12819,12 @@ public partial class Migrate + 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" + + "/providers/Microsoft.DataReplication/replicationVaults/" + + global::System.Uri.EscapeDataString(vaultName) + + "/replicationPolicies/" + + global::System.Uri.EscapeDataString(policyName) + + "/operations/" + + global::System.Uri.EscapeDataString(operationId) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -12741,53 +12833,244 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationJobsRestart_Call(request,onOk,eventListener,sender); + await this.PolicyOperationStatusGet_Call(request,onOk,onDefault,eventListener,sender); } } - /// The operation to restart an Azure Site Recovery job. + /// Tracks the results of an asynchronous operation on the policy. /// /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task PolicyOperationStatusGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2021-02-16-preview"; // 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); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataReplication/replicationVaults/(?[^/]+)/replicationPolicies/(?[^/]+)/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/vaults/{resourceName}/replicationJobs/{jobName}/restart'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}/operations/{operationId}'"); } // replace URI parameters with values from identity - var resourceName = _match.Groups["resourceName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var vaultName = _match.Groups["vaultName"].Value; + var policyName = _match.Groups["policyName"].Value; + var operationId = _match.Groups["operationId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.DataReplication/replicationVaults/" + + vaultName + + "/replicationPolicies/" + + policyName + + "/operations/" + + operationId + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.PolicyOperationStatusGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 PolicyOperationStatusGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.OperationStatusAutoGenerated.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// + /// Azure Subscription Id in which migrate project was created. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The policy name. + /// The ID of an ongoing async 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 PolicyOperationStatusGet_Validate(string subscriptionId, string resourceGroupName, string vaultName, string policyName, string operationId, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(vaultName),vaultName); + await eventListener.AssertRegEx(nameof(vaultName),vaultName,@"^[a-zA-Z0-9]*$"); + await eventListener.AssertNotNull(nameof(policyName),policyName); + await eventListener.AssertRegEx(nameof(policyName),policyName,@"^[a-zA-Z0-9]*$"); + await eventListener.AssertNotNull(nameof(operationId),operationId); + await eventListener.AssertMinimumLength(nameof(operationId),operationId,1); + } + } + + /// Creates the protected item. + /// Azure Subscription Id in which migrate project was created. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The protected item name. + /// Protected item model. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ProtectedItemCreate(string subscriptionId, string resourceGroupName, string vaultName, string protectedItemName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + { + var apiVersion = @"2021-02-16-preview"; + // 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.DataReplication/replicationVaults/" + + global::System.Uri.EscapeDataString(vaultName) + + "/protectedItems/" + + global::System.Uri.EscapeDataString(protectedItemName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ProtectedItemCreate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Creates the protected item. + /// + /// Protected item model. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ProtectedItemCreateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + { + var apiVersion = @"2021-02-16-preview"; + // 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.DataReplication/replicationVaults/(?[^/]+)/protectedItems/(?[^/]+)$", 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.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}'"); + } + + // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; - var jobName = _match.Groups["jobName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var vaultName = _match.Groups["vaultName"].Value; + var protectedItemName = _match.Groups["protectedItemName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.RecoveryServices/vaults/" - + resourceName - + "/replicationJobs/" - + jobName - + "/restart" + + "/providers/Microsoft.DataReplication/replicationVaults/" + + vaultName + + "/protectedItems/" + + protectedItemName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -12796,24 +13079,30 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationJobsRestart_Call(request,onOk,eventListener,sender); + await this.ProtectedItemCreate_Call(request,onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task ProtectedItemCreate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -12826,7 +13115,7 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 + // declared final-state-via: location var _finalUri = _response.GetFirstHeader(@"Location"); var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); var location = _response.GetFirstHeader(@"Location"); @@ -12910,19 +13199,16 @@ public partial class Migrate 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.Migrate.Runtime.Method.Get); + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get); - // drop the old response - _response?.Dispose(); + // drop the old response + _response?.Dispose(); - // make the final call - _response = await sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - break; - } + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; } var _contentType = _response.Content.Headers.ContentType?.MediaType; @@ -12931,12 +13217,14 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.Job.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModel.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { - throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; } } } @@ -12951,43 +13239,52 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Job identifier. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The protected item name. + /// Protected item model. /// 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.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ProtectedItemCreate_Validate(string subscriptionId, string resourceGroupName, string vaultName, string protectedItemName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(vaultName),vaultName); + await eventListener.AssertRegEx(nameof(vaultName),vaultName,@"^[a-zA-Z0-9]*$"); + await eventListener.AssertNotNull(nameof(protectedItemName),protectedItemName); + await eventListener.AssertRegEx(nameof(protectedItemName),protectedItemName,@"^[a-zA-Z0-9]*$"); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// 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. + /// Removes the protected item. /// Azure Subscription Id in which migrate project was created. - /// Job identifier. - /// Resume rob comments. - /// a delegate that is called when the remote service returns 200 (OK). + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The protected item name. + /// A flag indicating whether to do force delete or not. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IResumeJobParams body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ProtectedItemDelete(string subscriptionId, string resourceGroupName, string vaultName, string protectedItemName, bool? forceDelete, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2021-02-16-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -12997,12 +13294,13 @@ public partial class Migrate + 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" + + "/providers/Microsoft.DataReplication/replicationVaults/" + + global::System.Uri.EscapeDataString(vaultName) + + "/protectedItems/" + + global::System.Uri.EscapeDataString(protectedItemName) + "?" + + (null == forceDelete ? global::System.String.Empty : "forceDelete=" + global::System.Uri.EscapeDataString(forceDelete.ToString())) + + "&" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -13010,59 +13308,58 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationJobsResume_Call(request,onOk,eventListener,sender); + await this.ProtectedItemDelete_Call(request,onNoContent,onDefault,eventListener,sender); } } - /// The operation to resume an Azure Site Recovery job. + /// Removes the protected item. /// - /// Resume rob comments. - /// a delegate that is called when the remote service returns 200 (OK). + /// A flag indicating whether to do force delete or not. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IResumeJobParams body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ProtectedItemDeleteViaIdentity(global::System.String viaIdentity, bool? forceDelete, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2021-02-16-preview"; // 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); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataReplication/replicationVaults/(?[^/]+)/protectedItems/(?[^/]+)$", 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'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}'"); } // 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; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var vaultName = _match.Groups["vaultName"].Value; + var protectedItemName = _match.Groups["protectedItemName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.RecoveryServices/vaults/" - + resourceName - + "/replicationJobs/" - + jobName - + "/resume" + + "/providers/Microsoft.DataReplication/replicationVaults/" + + vaultName + + "/protectedItems/" + + protectedItemName + "?" + + (null == forceDelete ? global::System.String.Empty : "forceDelete=" + global::System.Uri.EscapeDataString(forceDelete.ToString())) + + "&" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -13070,28 +13367,26 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationJobsResume_Call(request,onOk,eventListener,sender); + await this.ProtectedItemDelete_Call(request,onNoContent,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task ProtectedItemDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -13104,7 +13399,7 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 + // declared final-state-via: location var _finalUri = _response.GetFirstHeader(@"Location"); var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); var location = _response.GetFirstHeader(@"Location"); @@ -13188,33 +13483,32 @@ public partial class Migrate 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.Migrate.Runtime.Method.Get); + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get); - // drop the old response - _response?.Dispose(); + // drop the old response + _response?.Dispose(); - // make the final call - _response = await sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - break; - } + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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: + case global::System.Net.HttpStatusCode.NoContent: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.Job.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onNoContent(_response); break; } default: { - throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; } } } @@ -13229,46 +13523,49 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Job identifier. - /// Resume rob comments. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The protected item name. + /// A flag indicating whether to do force delete or not. /// 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.Migrate.Models.Api202301.IResumeJobParams body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ProtectedItemDelete_Validate(string subscriptionId, string resourceGroupName, string vaultName, string protectedItemName, bool? forceDelete, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(vaultName),vaultName); + await eventListener.AssertRegEx(nameof(vaultName),vaultName,@"^[a-zA-Z0-9]*$"); + await eventListener.AssertNotNull(nameof(protectedItemName),protectedItemName); + await eventListener.AssertRegEx(nameof(protectedItemName),protectedItemName,@"^[a-zA-Z0-9]*$"); } } - /// 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. + /// Gets the details of the protected item. /// Azure Subscription Id in which migrate project was created. - /// Server Id. - /// Logical network name. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The protected item name. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ProtectedItemGet(string subscriptionId, string resourceGroupName, string vaultName, string protectedItemName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2021-02-16-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -13278,12 +13575,10 @@ public partial class Migrate + 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) + + "/providers/Microsoft.DataReplication/replicationVaults/" + + global::System.Uri.EscapeDataString(vaultName) + + "/protectedItems/" + + global::System.Uri.EscapeDataString(protectedItemName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -13297,50 +13592,49 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationLogicalNetworksGet_Call(request,onOk,eventListener,sender); + await this.ProtectedItemGet_Call(request,onOk,onDefault,eventListener,sender); } } - /// Gets the details of a logical network. + /// Gets the details of the protected item. /// /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ProtectedItemGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2021-02-16-preview"; // 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); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataReplication/replicationVaults/(?[^/]+)/protectedItems/(?[^/]+)$", 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}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}'"); } // 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; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var vaultName = _match.Groups["vaultName"].Value; + var protectedItemName = _match.Groups["protectedItemName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.RecoveryServices/vaults/" - + resourceName - + "/replicationFabrics/" - + fabricName - + "/replicationLogicalNetworks/" - + logicalNetworkName + + "/providers/Microsoft.DataReplication/replicationVaults/" + + vaultName + + "/protectedItems/" + + protectedItemName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -13354,19 +13648,21 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationLogicalNetworksGet_Call(request,onOk,eventListener,sender); + await this.ProtectedItemGet_Call(request,onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task ProtectedItemGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -13384,12 +13680,14 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.LogicalNetwork.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModel.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { - throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; } } } @@ -13404,44 +13702,47 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will - /// get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Server Id. - /// Logical network name. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The 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 ReplicationLogicalNetworksGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string logicalNetworkName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ProtectedItemGet_Validate(string subscriptionId, string resourceGroupName, string vaultName, string protectedItemName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(vaultName),vaultName); + await eventListener.AssertRegEx(nameof(vaultName),vaultName,@"^[a-zA-Z0-9]*$"); + await eventListener.AssertNotNull(nameof(protectedItemName),protectedItemName); + await eventListener.AssertRegEx(nameof(protectedItemName),protectedItemName,@"^[a-zA-Z0-9]*$"); } } - /// 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. + /// Gets the list of protected items in the given vault. /// Azure Subscription Id in which migrate project was created. - /// Server Id. + /// The name of the resource group. The name is case insensitive. + /// The vault name. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ProtectedItemList(string subscriptionId, string resourceGroupName, string vaultName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2021-02-16-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -13451,11 +13752,9 @@ public partial class Migrate + 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" + + "/providers/Microsoft.DataReplication/replicationVaults/" + + global::System.Uri.EscapeDataString(vaultName) + + "/protectedItems" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -13469,48 +13768,47 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationLogicalNetworksListByReplicationFabrics_Call(request,onOk,eventListener,sender); + await this.ProtectedItemList_Call(request,onOk,onDefault,eventListener,sender); } } - /// Lists all the logical networks of the Azure Site Recovery fabric. + /// Gets the list of protected items in the given vault. /// /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ProtectedItemListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2021-02-16-preview"; // 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); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataReplication/replicationVaults/(?[^/]+)/protectedItems$", 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'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems'"); } // 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 resourceGroupName = _match.Groups["resourceGroupName"].Value; + var vaultName = _match.Groups["vaultName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.RecoveryServices/vaults/" - + resourceName - + "/replicationFabrics/" - + fabricName - + "/replicationLogicalNetworks" + + "/providers/Microsoft.DataReplication/replicationVaults/" + + vaultName + + "/protectedItems" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -13524,21 +13822,21 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationLogicalNetworksListByReplicationFabrics_Call(request,onOk,eventListener,sender); + await this.ProtectedItemList_Call(request,onOk,onDefault,eventListener,sender); } } - /// - /// Actual wire call for method. - /// + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task ProtectedItemList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -13556,12 +13854,14 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.LogicalNetworkCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { - throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; } } } @@ -13576,45 +13876,46 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual - /// call, but you will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Server Id. + /// The name of the resource group. The name is case insensitive. + /// The vault 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 ReplicationLogicalNetworksListByReplicationFabrics_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ProtectedItemList_Validate(string subscriptionId, string resourceGroupName, string vaultName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(vaultName),vaultName); + await eventListener.AssertRegEx(nameof(vaultName),vaultName,@"^[a-zA-Z0-9]*$"); } } - /// 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. + /// Tracks the results of an asynchronous operation on the protected item. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. - /// Protection container name. - /// Migration item name. - /// Enable migration input. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The protected item name. + /// The ID of an ongoing async operation. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IEnableMigrationInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ProtectedItemOperationStatusGet(string subscriptionId, string resourceGroupName, string vaultName, string protectedItemName, string operationId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2021-02-16-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -13624,14 +13925,12 @@ public partial class Migrate + 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) + + "/providers/Microsoft.DataReplication/replicationVaults/" + + global::System.Uri.EscapeDataString(vaultName) + + "/protectedItems/" + + global::System.Uri.EscapeDataString(protectedItemName) + + "/operations/" + + global::System.Uri.EscapeDataString(operationId) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -13640,63 +13939,57 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationMigrationItemsCreate_Call(request,onOk,eventListener,sender); + await this.ProtectedItemOperationStatusGet_Call(request,onOk,onDefault,eventListener,sender); } } - /// The operation to create an ASR migration item (enable migration). + /// Tracks the results of an asynchronous operation on the protected item. /// - /// Enable migration input. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IEnableMigrationInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ProtectedItemOperationStatusGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2021-02-16-preview"; // 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); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataReplication/replicationVaults/(?[^/]+)/protectedItems/(?[^/]+)/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/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/operations/{operationId}'"); } // 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 resourceGroupName = _match.Groups["resourceGroupName"].Value; + var vaultName = _match.Groups["vaultName"].Value; + var protectedItemName = _match.Groups["protectedItemName"].Value; + var operationId = _match.Groups["operationId"].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 + + "/providers/Microsoft.DataReplication/replicationVaults/" + + vaultName + + "/protectedItems/" + + protectedItemName + + "/operations/" + + operationId + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -13705,28 +13998,26 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationMigrationItemsCreate_Call(request,onOk,eventListener,sender); + await this.ProtectedItemOperationStatusGet_Call(request,onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task ProtectedItemOperationStatusGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -13737,118 +14028,21 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - break; - } - } - var _contentType = _response.Content.Headers.ContentType?.MediaType; + var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.MigrationItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.OperationStatusAutoGenerated.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { - throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; } } } @@ -13863,52 +14057,52 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. - /// Protection container name. - /// Migration item name. - /// Enable migration input. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The protected item name. + /// The ID of an ongoing async 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 ReplicationMigrationItemsCreate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string migrationItemName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IEnableMigrationInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ProtectedItemOperationStatusGet_Validate(string subscriptionId, string resourceGroupName, string vaultName, string protectedItemName, string operationId, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(vaultName),vaultName); + await eventListener.AssertRegEx(nameof(vaultName),vaultName,@"^[a-zA-Z0-9]*$"); + await eventListener.AssertNotNull(nameof(protectedItemName),protectedItemName); + await eventListener.AssertRegEx(nameof(protectedItemName),protectedItemName,@"^[a-zA-Z0-9]*$"); + await eventListener.AssertNotNull(nameof(operationId),operationId); + await eventListener.AssertMinimumLength(nameof(operationId),operationId,1); } } - /// 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. + /// Performs the planned failover on the protected item. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. - /// Protection container name. - /// Migration item name. - /// The delete option. - /// a delegate that is called when the remote service returns 204 (NoContent). + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The protected item name. + /// Planned failover model. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ProtectedItemPlannedFailover(string subscriptionId, string resourceGroupName, string vaultName, string protectedItemName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModel body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2021-02-16-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -13918,105 +14112,105 @@ public partial class Migrate + 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) + + "/providers/Microsoft.DataReplication/replicationVaults/" + + global::System.Uri.EscapeDataString(vaultName) + + "/protectedItems/" + + global::System.Uri.EscapeDataString(protectedItemName) + + "/plannedFailover" + "?" + "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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationMigrationItemsDelete_Call(request,onNoContent,eventListener,sender); + await this.ProtectedItemPlannedFailover_Call(request,onOk,onDefault,eventListener,sender); } } - /// The operation to delete an ASR migration item. + /// Performs the planned failover on the protected item. /// - /// The delete option. - /// a delegate that is called when the remote service returns 204 (NoContent). + /// Planned failover model. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ProtectedItemPlannedFailoverViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModel body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2021-02-16-preview"; // 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); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataReplication/replicationVaults/(?[^/]+)/protectedItems/(?[^/]+)/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}/replicationMigrationItems/{migrationItemName}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/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 migrationItemName = _match.Groups["migrationItemName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var vaultName = _match.Groups["vaultName"].Value; + var protectedItemName = _match.Groups["protectedItemName"].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 + + "/providers/Microsoft.DataReplication/replicationVaults/" + + vaultName + + "/protectedItems/" + + protectedItemName + + "/plannedFailover" + "?" + "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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationMigrationItemsDelete_Call(request,onNoContent,eventListener,sender); + await this.ProtectedItemPlannedFailover_Call(request,onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task ProtectedItemPlannedFailover_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -14029,7 +14223,7 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 + // declared final-state-via: location var _finalUri = _response.GetFirstHeader(@"Location"); var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); var location = _response.GetFirstHeader(@"Location"); @@ -14113,33 +14307,32 @@ public partial class Migrate 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.Migrate.Runtime.Method.Get); + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get); - // drop the old response - _response?.Dispose(); + // drop the old response + _response?.Dispose(); - // make the final call - _response = await sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - break; - } + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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: + case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onNoContent(_response); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PlannedFailoverModel.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { - throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; } } } @@ -14154,48 +14347,50 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. - /// Protection container name. - /// Migration item name. - /// The delete option. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The protected item name. + /// Planned failover model. /// 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.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ProtectedItemPlannedFailover_Validate(string subscriptionId, string resourceGroupName, string vaultName, string protectedItemName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModel body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(vaultName),vaultName); + await eventListener.AssertRegEx(nameof(vaultName),vaultName,@"^[a-zA-Z0-9]*$"); + await eventListener.AssertNotNull(nameof(protectedItemName),protectedItemName); + await eventListener.AssertRegEx(nameof(protectedItemName),protectedItemName,@"^[a-zA-Z0-9]*$"); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// Gets the details of a migration item. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric unique name. - /// Protection container name. - /// Migration item name. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -14213,8 +14408,10 @@ public partial class Migrate + global::System.Uri.EscapeDataString(fabricName) + "/replicationProtectionContainers/" + global::System.Uri.EscapeDataString(protectionContainerName) - + "/replicationMigrationItems/" - + global::System.Uri.EscapeDataString(migrationItemName) + + "/replicationProtectedItems/" + + global::System.Uri.EscapeDataString(replicatedProtectedItemName) + + "/recoveryPoints/" + + global::System.Uri.EscapeDataString(recoveryPointName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -14228,19 +14425,206 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationMigrationItemsGet_Call(request,onOk,eventListener,sender); + await this.RecoveryPointsGet_Call(request,onOk,eventListener,sender); } } - /// Gets the details of a migration item. + /// Gets the details of the recovery point of a protected item. + /// Azure Subscription Id in which migrate project was created. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The protected item name. + /// The recovery point name. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task RecoveryPointsGet1(string subscriptionId, string resourceGroupName, string vaultName, string protectedItemName, string recoveryPointName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + { + var apiVersion = @"2021-02-16-preview"; + // 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.DataReplication/replicationVaults/" + + global::System.Uri.EscapeDataString(vaultName) + + "/protectedItems/" + + global::System.Uri.EscapeDataString(protectedItemName) + + "/recoveryPoints/" + + global::System.Uri.EscapeDataString(recoveryPointName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.RecoveryPointsGet1_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Gets the details of the recovery point of a protected item. /// /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task RecoveryPointsGet1ViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + { + var apiVersion = @"2021-02-16-preview"; + // 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.DataReplication/replicationVaults/(?[^/]+)/protectedItems/(?[^/]+)/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.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var vaultName = _match.Groups["vaultName"].Value; + var protectedItemName = _match.Groups["protectedItemName"].Value; + var recoveryPointName = _match.Groups["recoveryPointName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.DataReplication/replicationVaults/" + + vaultName + + "/protectedItems/" + + protectedItemName + + "/recoveryPoints/" + + recoveryPointName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.RecoveryPointsGet1_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 RecoveryPointsGet1_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.RecoveryPointModel.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// + /// Azure Subscription Id in which migrate project was created. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The 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 RecoveryPointsGet1_Validate(string subscriptionId, string resourceGroupName, string vaultName, string protectedItemName, string recoveryPointName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(vaultName),vaultName); + await eventListener.AssertRegEx(nameof(vaultName),vaultName,@"^[a-zA-Z0-9]*$"); + await eventListener.AssertNotNull(nameof(protectedItemName),protectedItemName); + await eventListener.AssertRegEx(nameof(protectedItemName),protectedItemName,@"^[a-zA-Z0-9]*$"); + await eventListener.AssertNotNull(nameof(recoveryPointName),recoveryPointName); + await eventListener.AssertRegEx(nameof(recoveryPointName),recoveryPointName,@"^[a-zA-Z0-9]*$"); + } + } + + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -14248,10 +14632,10 @@ public partial class Migrate { // 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); + 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}/replicationMigrationItems/{migrationItemName}'"); + 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 @@ -14260,7 +14644,8 @@ public partial class Migrate 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 replicatedProtectedItemName = _match.Groups["replicatedProtectedItemName"].Value; + var recoveryPointName = _match.Groups["recoveryPointName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -14273,8 +14658,10 @@ public partial class Migrate + fabricName + "/replicationProtectionContainers/" + protectionContainerName - + "/replicationMigrationItems/" - + migrationItemName + + "/replicationProtectedItems/" + + replicatedProtectedItemName + + "/recoveryPoints/" + + recoveryPointName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -14288,11 +14675,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationMigrationItemsGet_Call(request,onOk,eventListener,sender); + await this.RecoveryPointsGet_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -14300,7 +14687,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -14318,7 +14705,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.MigrationItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.RecoveryPoint.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -14338,20 +14725,21 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will - /// get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric unique name. - /// Protection container name. - /// Migration item name. + /// 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 ReplicationMigrationItemsGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string migrationItemName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + 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.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -14360,26 +14748,27 @@ public partial class Migrate 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(replicatedProtectedItemName),replicatedProtectedItemName); + await eventListener.AssertNotNull(nameof(recoveryPointName),recoveryPointName); } } - /// 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. + /// Gets the list of recovery points of the given protected item. /// Azure Subscription Id in which migrate project was created. - /// The pagination token. - /// The page size. - /// OData filter options. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The protected item name. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task RecoveryPointsList(string subscriptionId, string resourceGroupName, string vaultName, string protectedItemName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2021-02-16-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -14389,17 +14778,13 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.RecoveryServices/vaults/" - + global::System.Uri.EscapeDataString(resourceName) - + "/replicationMigrationItems" + + "/providers/Microsoft.DataReplication/replicationVaults/" + + global::System.Uri.EscapeDataString(vaultName) + + "/protectedItems/" + + global::System.Uri.EscapeDataString(protectedItemName) + + "/recoveryPoints" + "?" + "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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -14411,26 +14796,24 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationMigrationItemsList_Call(request,onOk,eventListener,sender); + await this.RecoveryPointsList_Call(request,onOk,onDefault,eventListener,sender); } } - /// Gets the list of ASR migration items in the protection container. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. - /// Protection container name. - /// The pagination token. - /// The page size. - /// OData filter options. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -14448,15 +14831,11 @@ public partial class Migrate + global::System.Uri.EscapeDataString(fabricName) + "/replicationProtectionContainers/" + global::System.Uri.EscapeDataString(protectionContainerName) - + "/replicationMigrationItems" + + "/replicationProtectedItems/" + + global::System.Uri.EscapeDataString(replicatedProtectedItemName) + + "/recoveryPoints" + "?" + "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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -14468,22 +14847,19 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationMigrationItemsListByReplicationProtectionContainers_Call(request,onOk,eventListener,sender); + await this.RecoveryPointsListByReplicationProtectedItems_Call(request,onOk,eventListener,sender); } } - /// Gets the list of ASR migration items in the protection container. + /// Lists the available recovery points for a replication protected item. /// - /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -14491,10 +14867,10 @@ public partial class Migrate { // 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); + 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}/replicationMigrationItems'"); + 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 @@ -14503,6 +14879,7 @@ public partial class Migrate 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/" @@ -14515,15 +14892,11 @@ public partial class Migrate + fabricName + "/replicationProtectionContainers/" + protectionContainerName - + "/replicationMigrationItems" + + "/replicationProtectedItems/" + + replicatedProtectedItemName + + "/recoveryPoints" + "?" + "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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -14535,12 +14908,12 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationMigrationItemsListByReplicationProtectionContainers_Call(request,onOk,eventListener,sender); + await this.RecoveryPointsListByReplicationProtectedItems_Call(request,onOk,eventListener,sender); } } /// - /// Actual wire call for method. + /// Actual wire call for method. /// /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). @@ -14549,7 +14922,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -14567,7 +14940,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.MigrationItemCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.RecoveryPointCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -14587,22 +14960,20 @@ public partial class Migrate } /// - /// Validation method for method. Call this - /// like the actual call, but you will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. - /// Protection container name. - /// The pagination token. - /// The page size. - /// OData filter options. + /// 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 ReplicationMigrationItemsListByReplicationProtectionContainers_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string skipToken, string takeToken, string Filter, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + 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.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -14611,58 +14982,52 @@ public partial class Migrate 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); + await eventListener.AssertNotNull(nameof(replicatedProtectedItemName),replicatedProtectedItemName); } } - /// Gets the list of migration items in the vault. + /// Gets the list of recovery points of the given protected item. /// - /// The pagination token. - /// The page size. - /// OData filter options. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task RecoveryPointsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2021-02-16-preview"; // 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); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataReplication/replicationVaults/(?[^/]+)/protectedItems/(?[^/]+)/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}/replicationMigrationItems'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/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 resourceGroupName = _match.Groups["resourceGroupName"].Value; + var vaultName = _match.Groups["vaultName"].Value; + var protectedItemName = _match.Groups["protectedItemName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.RecoveryServices/vaults/" - + resourceName - + "/replicationMigrationItems" + + "/providers/Microsoft.DataReplication/replicationVaults/" + + vaultName + + "/protectedItems/" + + protectedItemName + + "/recoveryPoints" + "?" + "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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -14674,19 +15039,21 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationMigrationItemsList_Call(request,onOk,eventListener,sender); + await this.RecoveryPointsList_Call(request,onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task RecoveryPointsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -14704,12 +15071,14 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.MigrationItemCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.RecoveryPointModelCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { - throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; } } } @@ -14724,47 +15093,45 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will - /// get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// The pagination token. - /// The page size. - /// OData filter options. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The 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 ReplicationMigrationItemsList_Validate(string resourceName, string resourceGroupName, string subscriptionId, string skipToken, string takeToken, string Filter, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task RecoveryPointsList_Validate(string subscriptionId, string resourceGroupName, string vaultName, string protectedItemName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(vaultName),vaultName); + await eventListener.AssertRegEx(nameof(vaultName),vaultName,@"^[a-zA-Z0-9]*$"); + await eventListener.AssertNotNull(nameof(protectedItemName),protectedItemName); + await eventListener.AssertRegEx(nameof(protectedItemName),protectedItemName,@"^[a-zA-Z0-9]*$"); } } - /// The operation to initiate migration of the item. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. - /// Protection container name. - /// Migration item name. - /// Migrate input. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IMigrateInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationAlertSettingsCreate(string resourceName, string resourceGroupName, string subscriptionId, string alertSettingName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IConfigureAlertRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -14778,13 +15145,8 @@ public partial class Migrate + 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" + + "/replicationAlertSettings/" + + global::System.Uri.EscapeDataString(alertSettingName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -14793,7 +15155,7 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -14802,20 +15164,20 @@ public partial class Migrate request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationMigrationItemsMigrate_Call(request,onOk,eventListener,sender); + await this.ReplicationAlertSettingsCreate_Call(request,onOk,eventListener,sender); } } - /// The operation to initiate migration of the item. + /// Create or update an email notification(alert) configuration. /// - /// Migrate input. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IMigrateInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationAlertSettingsCreateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IConfigureAlertRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -14823,19 +15185,17 @@ public partial class Migrate { // 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); + 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}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrate'"); + 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 fabricName = _match.Groups["fabricName"].Value; - var protectionContainerName = _match.Groups["protectionContainerName"].Value; - var migrationItemName = _match.Groups["migrationItemName"].Value; + var alertSettingName = _match.Groups["alertSettingName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -14844,13 +15204,8 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationFabrics/" - + fabricName - + "/replicationProtectionContainers/" - + protectionContainerName - + "/replicationMigrationItems/" - + migrationItemName - + "/migrate" + + "/replicationAlertSettings/" + + alertSettingName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -14859,7 +15214,7 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -14868,11 +15223,11 @@ public partial class Migrate request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationMigrationItemsMigrate_Call(request,onOk,eventListener,sender); + await this.ReplicationAlertSettingsCreate_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -14880,7 +15235,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -14891,106 +15246,6 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - break; - } - } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -14998,7 +15253,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.MigrationItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.Alert.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -15018,50 +15273,43 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you - /// will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. - /// Protection container name. - /// Migration item name. - /// Migrate input. + /// 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 ReplicationMigrationItemsMigrate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string migrationItemName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrateInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationAlertSettingsCreate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string alertSettingName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IConfigureAlertRequest body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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(alertSettingName),alertSettingName); await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// The operation to initiate pause replication of the item. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. - /// Protection container name. - /// Migration item name. - /// Pause replication input. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IPauseReplicationInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -15075,13 +15323,8 @@ public partial class Migrate + 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" + + "/replicationAlertSettings/" + + global::System.Uri.EscapeDataString(alertSettingName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -15090,29 +15333,24 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationMigrationItemsPauseReplication_Call(request,onOk,eventListener,sender); + await this.ReplicationAlertSettingsGet_Call(request,onOk,eventListener,sender); } } - /// The operation to initiate pause replication of the item. + /// Gets the details of the specified email notification(alert) configuration. /// - /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IPauseReplicationInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -15120,19 +15358,17 @@ public partial class Migrate { // 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); + 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}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/pauseReplication'"); + 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 fabricName = _match.Groups["fabricName"].Value; - var protectionContainerName = _match.Groups["protectionContainerName"].Value; - var migrationItemName = _match.Groups["migrationItemName"].Value; + var alertSettingName = _match.Groups["alertSettingName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -15141,13 +15377,8 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationFabrics/" - + fabricName - + "/replicationProtectionContainers/" - + protectionContainerName - + "/replicationMigrationItems/" - + migrationItemName - + "/pauseReplication" + + "/replicationAlertSettings/" + + alertSettingName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -15156,22 +15387,16 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationMigrationItemsPauseReplication_Call(request,onOk,eventListener,sender); + await this.ReplicationAlertSettingsGet_Call(request,onOk,eventListener,sender); } } - /// - /// Actual wire call for method. - /// + /// 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. @@ -15179,7 +15404,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -15190,106 +15415,6 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - break; - } - } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -15297,7 +15422,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.MigrationItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.Alert.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -15317,50 +15442,39 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, - /// but you will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. - /// Protection container name. - /// Migration item name. - /// Pause replication input. + /// 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 ReplicationMigrationItemsPauseReplication_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string migrationItemName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IPauseReplicationInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationAlertSettingsGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string alertSettingName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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); + await eventListener.AssertNotNull(nameof(alertSettingName),alertSettingName); } } - /// The operation to initiate resume replication of the item. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IResumeReplicationInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -15374,13 +15488,7 @@ public partial class Migrate + 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" + + "/replicationAlertSettings" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -15389,29 +15497,24 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationMigrationItemsResumeReplication_Call(request,onOk,eventListener,sender); + await this.ReplicationAlertSettingsList_Call(request,onOk,eventListener,sender); } } - /// The operation to initiate resume replication of the item. + /// Gets the list of email notification(alert) configurations for the vault. /// - /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IResumeReplicationInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -15419,19 +15522,16 @@ public partial class Migrate { // 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); + 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}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/resumeReplication'"); + 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; - 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/" @@ -15440,13 +15540,7 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationFabrics/" - + fabricName - + "/replicationProtectionContainers/" - + protectionContainerName - + "/replicationMigrationItems/" - + migrationItemName - + "/resumeReplication" + + "/replicationAlertSettings" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -15455,22 +15549,16 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationMigrationItemsResumeReplication_Call(request,onOk,eventListener,sender); + await this.ReplicationAlertSettingsList_Call(request,onOk,eventListener,sender); } } - /// - /// Actual wire call for method. - /// + /// 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. @@ -15478,7 +15566,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -15489,49 +15577,9708 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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 ); + var _contentType = _response.Content.Headers.ContentType?.MediaType; - // 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"); + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.AlertCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; } - if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { - location = _response.GetFirstHeader(@"Location"); + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); } - 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.Migrate.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.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } - // if we got back an OK, take a peek inside and see if it's done - if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) - { + /// + /// 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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ApplianceCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ReplicationEligibilityResults.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ReplicationEligibilityResultsCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.Event.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.EventCollectionAutoGenerated.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.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); + } + } + + /// Creates the replication extension in the given vault. + /// Azure Subscription Id in which migrate project was created. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The replication extension name. + /// Replication extension model. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationExtensionCreate(string subscriptionId, string resourceGroupName, string vaultName, string replicationExtensionName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + { + var apiVersion = @"2021-02-16-preview"; + // 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.DataReplication/replicationVaults/" + + global::System.Uri.EscapeDataString(vaultName) + + "/replicationExtensions/" + + global::System.Uri.EscapeDataString(replicationExtensionName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationExtensionCreate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Creates the replication extension in the given vault. + /// + /// Replication extension model. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationExtensionCreateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + { + var apiVersion = @"2021-02-16-preview"; + // 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.DataReplication/replicationVaults/(?[^/]+)/replicationExtensions/(?[^/]+)$", 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.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var vaultName = _match.Groups["vaultName"].Value; + var replicationExtensionName = _match.Groups["replicationExtensionName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.DataReplication/replicationVaults/" + + vaultName + + "/replicationExtensions/" + + replicationExtensionName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationExtensionCreate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 ReplicationExtensionCreate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ReplicationExtensionModel.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// + /// Azure Subscription Id in which migrate project was created. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The replication extension name. + /// Replication extension model. + /// 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 ReplicationExtensionCreate_Validate(string subscriptionId, string resourceGroupName, string vaultName, string replicationExtensionName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(vaultName),vaultName); + await eventListener.AssertRegEx(nameof(vaultName),vaultName,@"^[a-zA-Z0-9]*$"); + await eventListener.AssertNotNull(nameof(replicationExtensionName),replicationExtensionName); + await eventListener.AssertRegEx(nameof(replicationExtensionName),replicationExtensionName,@"^[a-zA-Z0-9]*$"); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Deletes the replication extension in the given vault. + /// Azure Subscription Id in which migrate project was created. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The replication extension name. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationExtensionDelete(string subscriptionId, string resourceGroupName, string vaultName, string replicationExtensionName, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + { + var apiVersion = @"2021-02-16-preview"; + // 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.DataReplication/replicationVaults/" + + global::System.Uri.EscapeDataString(vaultName) + + "/replicationExtensions/" + + global::System.Uri.EscapeDataString(replicationExtensionName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationExtensionDelete_Call(request,onNoContent,onDefault,eventListener,sender); + } + } + + /// Deletes the replication extension in the given vault. + /// + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationExtensionDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + { + var apiVersion = @"2021-02-16-preview"; + // 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.DataReplication/replicationVaults/(?[^/]+)/replicationExtensions/(?[^/]+)$", 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.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var vaultName = _match.Groups["vaultName"].Value; + var replicationExtensionName = _match.Groups["replicationExtensionName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.DataReplication/replicationVaults/" + + vaultName + + "/replicationExtensions/" + + replicationExtensionName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationExtensionDelete_Call(request,onNoContent,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 ReplicationExtensionDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// + /// Azure Subscription Id in which migrate project was created. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The replication extension 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 ReplicationExtensionDelete_Validate(string subscriptionId, string resourceGroupName, string vaultName, string replicationExtensionName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(vaultName),vaultName); + await eventListener.AssertRegEx(nameof(vaultName),vaultName,@"^[a-zA-Z0-9]*$"); + await eventListener.AssertNotNull(nameof(replicationExtensionName),replicationExtensionName); + await eventListener.AssertRegEx(nameof(replicationExtensionName),replicationExtensionName,@"^[a-zA-Z0-9]*$"); + } + } + + /// Gets the details of the replication extension. + /// Azure Subscription Id in which migrate project was created. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The replication extension name. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationExtensionGet(string subscriptionId, string resourceGroupName, string vaultName, string replicationExtensionName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + { + var apiVersion = @"2021-02-16-preview"; + // 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.DataReplication/replicationVaults/" + + global::System.Uri.EscapeDataString(vaultName) + + "/replicationExtensions/" + + global::System.Uri.EscapeDataString(replicationExtensionName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationExtensionGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Gets the details of the replication extension. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationExtensionGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + { + var apiVersion = @"2021-02-16-preview"; + // 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.DataReplication/replicationVaults/(?[^/]+)/replicationExtensions/(?[^/]+)$", 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.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var vaultName = _match.Groups["vaultName"].Value; + var replicationExtensionName = _match.Groups["replicationExtensionName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.DataReplication/replicationVaults/" + + vaultName + + "/replicationExtensions/" + + replicationExtensionName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationExtensionGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 ReplicationExtensionGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ReplicationExtensionModel.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// + /// Azure Subscription Id in which migrate project was created. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The replication extension 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 ReplicationExtensionGet_Validate(string subscriptionId, string resourceGroupName, string vaultName, string replicationExtensionName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(vaultName),vaultName); + await eventListener.AssertRegEx(nameof(vaultName),vaultName,@"^[a-zA-Z0-9]*$"); + await eventListener.AssertNotNull(nameof(replicationExtensionName),replicationExtensionName); + await eventListener.AssertRegEx(nameof(replicationExtensionName),replicationExtensionName,@"^[a-zA-Z0-9]*$"); + } + } + + /// Gets the list of replication extensions in the given vault. + /// Azure Subscription Id in which migrate project was created. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationExtensionList(string subscriptionId, string resourceGroupName, string vaultName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + { + var apiVersion = @"2021-02-16-preview"; + // 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.DataReplication/replicationVaults/" + + global::System.Uri.EscapeDataString(vaultName) + + "/replicationExtensions" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationExtensionList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Gets the list of replication extensions in the given vault. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationExtensionListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + { + var apiVersion = @"2021-02-16-preview"; + // 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.DataReplication/replicationVaults/(?[^/]+)/replicationExtensions$", 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.DataReplication/replicationVaults/{vaultName}/replicationExtensions'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var vaultName = _match.Groups["vaultName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.DataReplication/replicationVaults/" + + vaultName + + "/replicationExtensions" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationExtensionList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 ReplicationExtensionList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ReplicationExtensionModelCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// + /// Azure Subscription Id in which migrate project was created. + /// The name of the resource group. The name is case insensitive. + /// The vault 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 ReplicationExtensionList_Validate(string subscriptionId, string resourceGroupName, string vaultName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(vaultName),vaultName); + await eventListener.AssertRegEx(nameof(vaultName),vaultName,@"^[a-zA-Z0-9]*$"); + } + } + + /// Tracks the results of an asynchronous operation on the replication extension. + /// Azure Subscription Id in which migrate project was created. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The replication extension name. + /// The ID of an ongoing async operation. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationExtensionOperationStatusGet(string subscriptionId, string resourceGroupName, string vaultName, string replicationExtensionName, string operationId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + { + var apiVersion = @"2021-02-16-preview"; + // 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.DataReplication/replicationVaults/" + + global::System.Uri.EscapeDataString(vaultName) + + "/replicationExtensions/" + + global::System.Uri.EscapeDataString(replicationExtensionName) + + "/operations/" + + global::System.Uri.EscapeDataString(operationId) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationExtensionOperationStatusGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Tracks the results of an asynchronous operation on the replication extension. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task ReplicationExtensionOperationStatusGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + { + var apiVersion = @"2021-02-16-preview"; + // 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.DataReplication/replicationVaults/(?[^/]+)/replicationExtensions/(?[^/]+)/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.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}/operations/{operationId}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var vaultName = _match.Groups["vaultName"].Value; + var replicationExtensionName = _match.Groups["replicationExtensionName"].Value; + var operationId = _match.Groups["operationId"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.DataReplication/replicationVaults/" + + vaultName + + "/replicationExtensions/" + + replicationExtensionName + + "/operations/" + + operationId + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationExtensionOperationStatusGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 ReplicationExtensionOperationStatusGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.OperationStatusAutoGenerated.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// + /// Azure Subscription Id in which migrate project was created. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The replication extension name. + /// The ID of an ongoing async 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 ReplicationExtensionOperationStatusGet_Validate(string subscriptionId, string resourceGroupName, string vaultName, string replicationExtensionName, string operationId, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(vaultName),vaultName); + await eventListener.AssertRegEx(nameof(vaultName),vaultName,@"^[a-zA-Z0-9]*$"); + await eventListener.AssertNotNull(nameof(replicationExtensionName),replicationExtensionName); + await eventListener.AssertRegEx(nameof(replicationExtensionName),replicationExtensionName,@"^[a-zA-Z0-9]*$"); + await eventListener.AssertNotNull(nameof(operationId),operationId); + await eventListener.AssertMinimumLength(nameof(operationId),operationId,1); + } + } + + /// 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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.Fabric.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IFabricCreationInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IFabricCreationInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.Fabric.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Models.Api202301.IFabricCreationInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.Fabric.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.FabricCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IFailoverProcessServerRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IFailoverProcessServerRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.Fabric.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Models.Api202301.IFailoverProcessServerRequest body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IRenewCertificateInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IRenewCertificateInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.Fabric.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Models.Api202301.IRenewCertificateInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.Job.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IJobQueryParameter body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IJobQueryParameter body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.Job.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Models.Api202301.IJobQueryParameter body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.Job.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.JobCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.Job.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IResumeJobParams body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IResumeJobParams body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.Job.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Models.Api202301.IResumeJobParams body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.LogicalNetwork.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.LogicalNetworkCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IEnableMigrationInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IEnableMigrationInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.MigrationItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Models.Api202301.IEnableMigrationInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.MigrationItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.MigrationItemCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.MigrationItemCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IMigrateInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IMigrateInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.MigrationItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Models.Api202301.IMigrateInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IPauseReplicationInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IPauseReplicationInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.MigrationItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Models.Api202301.IPauseReplicationInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IResumeReplicationInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IResumeReplicationInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.MigrationItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Models.Api202301.IResumeReplicationInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IResyncInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IResyncInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.MigrationItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Models.Api202301.IResyncInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.ITestMigrateInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.ITestMigrateCleanupInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.ITestMigrateCleanupInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.MigrationItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Models.Api202301.ITestMigrateCleanupInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.ITestMigrateInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.MigrationItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Models.Api202301.ITestMigrateInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IUpdateMigrationItemInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IUpdateMigrationItemInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.MigrationItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Models.Api202301.IUpdateMigrationItemInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.ICreateNetworkMappingInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.ICreateNetworkMappingInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.NetworkMapping.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Models.Api202301.ICreateNetworkMappingInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) @@ -15544,51 +25291,577 @@ public partial class Migrate break; } - switch( state?.ToString()?.ToLower() ) - { - case "failed": - error = true; - break; - case "succeeded": - case "canceled": - // we're done polling. - 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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.NetworkMapping.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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"); - 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.Migrate.Runtime.UndeclaredResponseException(_response); - } - } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - // 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.Migrate.Runtime.Method.Get); + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - // drop the old response - _response?.Dispose(); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationNetworkMappingsListByReplicationNetworks_Call(request,onOk,eventListener,sender); + } + } - // make the final call - _response = await sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.NetworkMappingCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + } } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -15596,7 +25869,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.MigrationItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.NetworkMappingCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -15616,50 +25889,41 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, - /// but you will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// 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.Migrate.Models.Api202301.IResumeReplicationInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationNetworkMappingsList_Validate(string resourceName, string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. - /// Protection container name. - /// Migration item name. - /// Resync input. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IResyncInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationNetworkMappingsUpdate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string networkName, string networkMappingName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IUpdateNetworkMappingInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -15675,11 +25939,10 @@ public partial class Migrate + global::System.Uri.EscapeDataString(resourceName) + "/replicationFabrics/" + global::System.Uri.EscapeDataString(fabricName) - + "/replicationProtectionContainers/" - + global::System.Uri.EscapeDataString(protectionContainerName) - + "/replicationMigrationItems/" - + global::System.Uri.EscapeDataString(migrationItemName) - + "/resync" + + "/replicationNetworks/" + + global::System.Uri.EscapeDataString(networkName) + + "/replicationNetworkMappings/" + + global::System.Uri.EscapeDataString(networkMappingName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -15688,7 +25951,7 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -15697,20 +25960,20 @@ public partial class Migrate request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationMigrationItemsResync_Call(request,onOk,eventListener,sender); + await this.ReplicationNetworkMappingsUpdate_Call(request,onOk,eventListener,sender); } } - /// The operation to resynchronize replication of an ASR migration item. + /// The operation to update an ASR network mapping. /// - /// Resync input. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IResyncInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationNetworkMappingsUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IUpdateNetworkMappingInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -15718,10 +25981,10 @@ public partial class Migrate { // 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); + 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}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/resync'"); + 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 @@ -15729,8 +25992,8 @@ public partial class Migrate 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 networkName = _match.Groups["networkName"].Value; + var networkMappingName = _match.Groups["networkMappingName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -15741,11 +26004,10 @@ public partial class Migrate + resourceName + "/replicationFabrics/" + fabricName - + "/replicationProtectionContainers/" - + protectionContainerName - + "/replicationMigrationItems/" - + migrationItemName - + "/resync" + + "/replicationNetworks/" + + networkName + + "/replicationNetworkMappings/" + + networkMappingName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -15754,7 +26016,7 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -15763,11 +26025,11 @@ public partial class Migrate request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationMigrationItemsResync_Call(request,onOk,eventListener,sender); + await this.ReplicationNetworkMappingsUpdate_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -15775,7 +26037,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -15789,7 +26051,6 @@ public partial class Migrate // 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 ) @@ -15872,20 +26133,199 @@ public partial class Migrate continue; } // we are done polling, do a request on final target? - if (!string.IsNullOrWhiteSpace(_finalUri)) + if (!string.IsNullOrWhiteSpace(_originalUri)) { // create a new request with the final uri - request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get); + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.NetworkMapping.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Models.Api202301.IUpdateNetworkMappingInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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"); - // drop the old response - _response?.Dispose(); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - // make the final call - _response = await sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - break; - } - } + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -15893,7 +26333,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.MigrationItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.Network.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -15913,21 +26353,19 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will - /// get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. - /// Protection container name. - /// Migration item name. - /// Resync input. + /// 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 ReplicationMigrationItemsResync_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string migrationItemName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IResyncInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationNetworksGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string networkName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -15935,28 +26373,21 @@ public partial class Migrate 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); + await eventListener.AssertNotNull(nameof(networkName),networkName); } } - /// The operation to initiate test migration of the item. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.ITestMigrateInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -15970,13 +26401,7 @@ public partial class Migrate + 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" + + "/replicationNetworks" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -15985,34 +26410,27 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationMigrationItemsTestMigrate_Call(request,onOk,eventListener,sender); + await this.ReplicationNetworksList_Call(request,onOk,eventListener,sender); } } - /// The operation to initiate test migrate cleanup. + /// 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. /// Azure Subscription Id in which migrate project was created. /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.ITestMigrateCleanupInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -16028,11 +26446,7 @@ public partial class Migrate + global::System.Uri.EscapeDataString(resourceName) + "/replicationFabrics/" + global::System.Uri.EscapeDataString(fabricName) - + "/replicationProtectionContainers/" - + global::System.Uri.EscapeDataString(protectionContainerName) - + "/replicationMigrationItems/" - + global::System.Uri.EscapeDataString(migrationItemName) - + "/testMigrateCleanup" + + "/replicationNetworks" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -16041,29 +26455,24 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationMigrationItemsTestMigrateCleanup_Call(request,onOk,eventListener,sender); + await this.ReplicationNetworksListByReplicationFabrics_Call(request,onOk,eventListener,sender); } } - /// The operation to initiate test migrate cleanup. + /// Lists the networks available for a fabric. /// - /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.ITestMigrateCleanupInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -16071,10 +26480,10 @@ public partial class Migrate { // 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); + 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}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/testMigrateCleanup'"); + 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 @@ -16082,8 +26491,6 @@ public partial class Migrate 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/" @@ -16094,11 +26501,7 @@ public partial class Migrate + resourceName + "/replicationFabrics/" + fabricName - + "/replicationProtectionContainers/" - + protectionContainerName - + "/replicationMigrationItems/" - + migrationItemName - + "/testMigrateCleanup" + + "/replicationNetworks" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -16107,21 +26510,17 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationMigrationItemsTestMigrateCleanup_Call(request,onOk,eventListener,sender); + await this.ReplicationNetworksListByReplicationFabrics_Call(request,onOk,eventListener,sender); } } /// - /// Actual wire call for method. + /// Actual wire call for method. /// /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). @@ -16130,7 +26529,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -16141,106 +26540,6 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - break; - } - } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -16248,7 +26547,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.MigrationItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.NetworkCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -16268,21 +26567,18 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, + /// 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. /// Azure Subscription Id in which migrate project was created. /// 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.Migrate.Models.Api202301.ITestMigrateCleanupInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationNetworksListByReplicationFabrics_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -16290,23 +26586,18 @@ public partial class Migrate 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. + /// Lists the networks available in a vault. /// - /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.ITestMigrateInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -16314,19 +26605,16 @@ public partial class Migrate { // 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); + 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}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/testMigrate'"); + 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; - 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/" @@ -16335,13 +26623,7 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationFabrics/" - + fabricName - + "/replicationProtectionContainers/" - + protectionContainerName - + "/replicationMigrationItems/" - + migrationItemName - + "/testMigrate" + + "/replicationNetworks" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -16350,22 +26632,16 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationMigrationItemsTestMigrate_Call(request,onOk,eventListener,sender); + await this.ReplicationNetworksList_Call(request,onOk,eventListener,sender); } } - /// - /// Actual wire call for method. - /// + /// 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. @@ -16373,7 +26649,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -16384,106 +26660,6 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - break; - } - } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -16491,7 +26667,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.MigrationItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.NetworkCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -16511,50 +26687,39 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but - /// you will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// 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.Migrate.Models.Api202301.ITestMigrateInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationNetworksList_Validate(string resourceName, string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. - /// Protection container name. - /// Migration item name. - /// Update migration item input. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IUpdateMigrationItemInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationPoliciesCreate(string resourceName, string resourceGroupName, string subscriptionId, string policyName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ICreatePolicyInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -16568,12 +26733,8 @@ public partial class Migrate + 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) + + "/replicationPolicies/" + + global::System.Uri.EscapeDataString(policyName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -16582,7 +26743,7 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -16591,20 +26752,20 @@ public partial class Migrate request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationMigrationItemsUpdate_Call(request,onOk,eventListener,sender); + await this.ReplicationPoliciesCreate_Call(request,onOk,eventListener,sender); } } - /// The operation to update the recovery settings of an ASR migration item. + /// The operation to create a replication policy. /// - /// Update migration item input. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IUpdateMigrationItemInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationPoliciesCreateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ICreatePolicyInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -16612,19 +26773,17 @@ public partial class Migrate { // 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); + 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}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}'"); + 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 fabricName = _match.Groups["fabricName"].Value; - var protectionContainerName = _match.Groups["protectionContainerName"].Value; - var migrationItemName = _match.Groups["migrationItemName"].Value; + var policyName = _match.Groups["policyName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -16633,12 +26792,8 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationFabrics/" - + fabricName - + "/replicationProtectionContainers/" - + protectionContainerName - + "/replicationMigrationItems/" - + migrationItemName + + "/replicationPolicies/" + + policyName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -16647,7 +26802,7 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -16656,11 +26811,11 @@ public partial class Migrate request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationMigrationItemsUpdate_Call(request,onOk,eventListener,sender); + await this.ReplicationPoliciesCreate_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -16668,7 +26823,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -16785,7 +26940,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.MigrationItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.Policy.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -16805,50 +26960,43 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will - /// get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. - /// Protection container name. - /// Migration item name. - /// Update migration item input. + /// 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 ReplicationMigrationItemsUpdate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string migrationItemName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IUpdateMigrationItemInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationPoliciesCreate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string policyName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ICreatePolicyInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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(policyName),policyName); await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// The operation to create an ASR network mapping. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// 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). + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.ICreateNetworkMappingInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationPoliciesDelete(string resourceName, string resourceGroupName, string subscriptionId, string policyName, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -16862,12 +27010,8 @@ public partial class Migrate + 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) + + "/replicationPolicies/" + + global::System.Uri.EscapeDataString(policyName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -16876,29 +27020,24 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationNetworkMappingsCreate_Call(request,onOk,eventListener,sender); + await this.ReplicationPoliciesDelete_Call(request,onNoContent,eventListener,sender); } } - /// The operation to create an ASR network mapping. + /// The operation to delete a replication policy. /// - /// Create network mapping input. - /// a delegate that is called when the remote service returns 200 (OK). + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.ICreateNetworkMappingInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationPoliciesDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -16906,19 +27045,17 @@ public partial class Migrate { // 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); + 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}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}'"); + 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 fabricName = _match.Groups["fabricName"].Value; - var networkName = _match.Groups["networkName"].Value; - var networkMappingName = _match.Groups["networkMappingName"].Value; + var policyName = _match.Groups["policyName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -16927,12 +27064,8 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationFabrics/" - + fabricName - + "/replicationNetworks/" - + networkName - + "/replicationNetworkMappings/" - + networkMappingName + + "/replicationPolicies/" + + policyName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -16941,28 +27074,24 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationNetworkMappingsCreate_Call(request,onOk,eventListener,sender); + await this.ReplicationPoliciesDelete_Call(request,onNoContent,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 200 (OK). + /// 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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task ReplicationPoliciesDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -16976,6 +27105,7 @@ public partial class Migrate // 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 ) @@ -17058,10 +27188,10 @@ public partial class Migrate continue; } // we are done polling, do a request on final target? - if (!string.IsNullOrWhiteSpace(_originalUri)) + if (!string.IsNullOrWhiteSpace(_finalUri)) { // create a new request with the final uri - request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get); + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get); // drop the old response _response?.Dispose(); @@ -17076,10 +27206,10 @@ public partial class Migrate switch ( _response.StatusCode ) { - case global::System.Net.HttpStatusCode.OK: + case global::System.Net.HttpStatusCode.NoContent: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.NetworkMapping.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onNoContent(_response); break; } default: @@ -17099,49 +27229,40 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you - /// will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Primary fabric name. - /// Primary network name. - /// Network mapping name. - /// Create network mapping input. + /// 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 ReplicationNetworkMappingsCreate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string networkName, string networkMappingName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ICreateNetworkMappingInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationPoliciesDelete_Validate(string resourceName, string resourceGroupName, string subscriptionId, string policyName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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); + await eventListener.AssertNotNull(nameof(policyName),policyName); } } - /// The operation to delete a network mapping. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Primary fabric name. - /// Primary network name. - /// ARM Resource Name for network mapping. - /// a delegate that is called when the remote service returns 204 (NoContent). + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -17155,12 +27276,8 @@ public partial class Migrate + 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) + + "/replicationPolicies/" + + global::System.Uri.EscapeDataString(policyName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -17169,24 +27286,24 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationNetworkMappingsDelete_Call(request,onNoContent,eventListener,sender); + await this.ReplicationPoliciesGet_Call(request,onOk,eventListener,sender); } } - /// The operation to delete a network mapping. + /// Gets the details of a replication policy. /// - /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -17194,19 +27311,17 @@ public partial class Migrate { // 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); + 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}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}'"); + 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 fabricName = _match.Groups["fabricName"].Value; - var networkName = _match.Groups["networkName"].Value; - var networkMappingName = _match.Groups["networkMappingName"].Value; + var policyName = _match.Groups["policyName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -17215,12 +27330,8 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationFabrics/" - + fabricName - + "/replicationNetworks/" - + networkName - + "/replicationNetworkMappings/" - + networkMappingName + + "/replicationPolicies/" + + policyName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -17229,24 +27340,24 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationNetworkMappingsDelete_Call(request,onNoContent,eventListener,sender); + await this.ReplicationPoliciesGet_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -17257,114 +27368,176 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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 ); + var _contentType = _response.Content.Headers.ContentType?.MediaType; - // 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"); + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.Policy.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; } - if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { - location = _response.GetFirstHeader(@"Location"); + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); } - 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.Migrate.Runtime.Method.Get); + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } - // 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; + /// + /// 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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.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); + } + } - // check for cancellation - if( eventListener.Token.IsCancellationRequested ) { return; } + /// 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. + /// Azure Subscription Id in which migrate project was created. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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"); - // drop the old response - _response?.Dispose(); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - // make the polling call - _response = await sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); 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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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; - } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationPoliciesList_Call(request,onOk,eventListener,sender); + } + } - switch( state?.ToString()?.ToLower() ) - { - case "failed": - error = true; - break; - case "succeeded": - case "canceled": - // we're done polling. - break; + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + { + var apiVersion = @"2023-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri - 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.Migrate.Runtime.UndeclaredResponseException(_response); - } - } + 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'"); + } - // 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.Migrate.Runtime.Method.Get); + // 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"); - // drop the old response - _response?.Dispose(); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - // make the final call - _response = await sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - break; - } - } + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { - case global::System.Net.HttpStatusCode.NoContent: + case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onNoContent(_response); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.PolicyCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -17384,46 +27557,39 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you - /// will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// 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.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationPoliciesList_Validate(string resourceName, string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 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. /// Azure Subscription Id in which migrate project was created. - /// Primary fabric name. - /// Primary network name. - /// Network mapping name. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationPoliciesUpdate(string resourceName, string resourceGroupName, string subscriptionId, string policyName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IUpdatePolicyInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -17437,12 +27603,8 @@ public partial class Migrate + 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) + + "/replicationPolicies/" + + global::System.Uri.EscapeDataString(policyName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -17451,24 +27613,29 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationNetworkMappingsGet_Call(request,onOk,eventListener,sender); + await this.ReplicationPoliciesUpdate_Call(request,onOk,eventListener,sender); } } - /// Gets the details of an ASR network mapping. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationPoliciesUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IUpdatePolicyInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -17476,19 +27643,17 @@ public partial class Migrate { // 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); + 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}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}'"); + 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 fabricName = _match.Groups["fabricName"].Value; - var networkName = _match.Groups["networkName"].Value; - var networkMappingName = _match.Groups["networkMappingName"].Value; + var policyName = _match.Groups["policyName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -17497,48 +27662,147 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationFabrics/" - + fabricName - + "/replicationNetworks/" - + networkName - + "/replicationNetworkMappings/" - + networkMappingName + + "/replicationPolicies/" + + policyName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - // generate request object - var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.Method.Get); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } - // make the call - await this.ReplicationNetworkMappingsGet_Call(request,onOk,eventListener,sender); - } - } + // drop the old response + _response?.Dispose(); - /// 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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } - _response = await sendTask; - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -17546,7 +27810,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.NetworkMapping.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.Policy.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -17566,87 +27830,45 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will - /// get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Primary fabric name. - /// Primary network name. - /// Network mapping name. + /// 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 ReplicationNetworkMappingsGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string networkName, string networkMappingName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationPoliciesUpdate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string policyName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IUpdatePolicyInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. - /// Azure Subscription Id in which migrate project was created. - /// a delegate that is called when the remote service returns 200 (OK). - /// an instance that will receive events. - /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - // generate request object - var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } - // make the call - await this.ReplicationNetworkMappingsList_Call(request,onOk,eventListener,sender); + await eventListener.AssertNotNull(nameof(policyName),policyName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// Lists all ASR network mappings for the specified network. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Primary fabric name. - /// Primary network name. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -17662,9 +27884,10 @@ public partial class Migrate + global::System.Uri.EscapeDataString(resourceName) + "/replicationFabrics/" + global::System.Uri.EscapeDataString(fabricName) - + "/replicationNetworks/" - + global::System.Uri.EscapeDataString(networkName) - + "/replicationNetworkMappings" + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationProtectableItems/" + + global::System.Uri.EscapeDataString(protectableItemName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -17678,11 +27901,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationNetworkMappingsListByReplicationNetworks_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectableItemsGet_Call(request,onOk,eventListener,sender); } } - /// Lists all ASR network mappings for the specified network. + /// 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. @@ -17690,7 +27913,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -17698,10 +27921,10 @@ public partial class Migrate { // 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); + 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}/replicationNetworks/{networkName}/replicationNetworkMappings'"); + 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 @@ -17709,7 +27932,8 @@ public partial class Migrate 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 protectionContainerName = _match.Groups["protectionContainerName"].Value; + var protectableItemName = _match.Groups["protectableItemName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -17720,9 +27944,10 @@ public partial class Migrate + resourceName + "/replicationFabrics/" + fabricName - + "/replicationNetworks/" - + networkName - + "/replicationNetworkMappings" + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationProtectableItems/" + + protectableItemName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -17736,13 +27961,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationNetworkMappingsListByReplicationNetworks_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectableItemsGet_Call(request,onOk,eventListener,sender); } } - /// - /// Actual wire call for method. - /// + /// 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. @@ -17750,7 +27973,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -17768,7 +27991,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.NetworkMappingCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ProtectableItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -17788,19 +28011,20 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual - /// call, but you will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Primary fabric name. - /// Primary network name. + /// 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 ReplicationNetworkMappingsListByReplicationNetworks_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string networkName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + 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.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -17808,19 +28032,80 @@ public partial class Migrate 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(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(protectableItemName),protectableItemName); } } - /// Lists all ASR network mappings in the vault. + /// 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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -17828,16 +28113,18 @@ public partial class Migrate { // 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); + 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}/replicationNetworkMappings'"); + 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/" @@ -17846,9 +28133,19 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationNetworkMappings" + + "/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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -17860,11 +28157,13 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationNetworkMappingsList_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectableItemsListByReplicationProtectionContainers_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// + /// 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. @@ -17872,7 +28171,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -17890,7 +28189,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.NetworkMappingCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ProtectableItemCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -17910,41 +28209,51 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will - /// get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. + /// 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 ReplicationNetworkMappingsList_Validate(string resourceName, string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + 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.Migrate.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); } } - /// The operation to update an ASR network mapping. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Primary fabric name. - /// Primary network name. - /// Network mapping name. - /// Update network mapping input. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IUpdateNetworkMappingInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsAddDisks(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IAddDisksInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -17960,10 +28269,11 @@ public partial class Migrate + global::System.Uri.EscapeDataString(resourceName) + "/replicationFabrics/" + global::System.Uri.EscapeDataString(fabricName) - + "/replicationNetworks/" - + global::System.Uri.EscapeDataString(networkName) - + "/replicationNetworkMappings/" - + global::System.Uri.EscapeDataString(networkMappingName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationProtectedItems/" + + global::System.Uri.EscapeDataString(replicatedProtectedItemName) + + "/addDisks" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -17972,7 +28282,7 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -17981,20 +28291,20 @@ public partial class Migrate request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationNetworkMappingsUpdate_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectedItemsAddDisks_Call(request,onOk,eventListener,sender); } } - /// The operation to update an ASR network mapping. + /// Operation to add disks(s) to the replication protected item. /// - /// Update network mapping input. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IUpdateNetworkMappingInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsAddDisksViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IAddDisksInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -18002,10 +28312,10 @@ public partial class Migrate { // 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); + 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}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}'"); + 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 @@ -18013,8 +28323,8 @@ public partial class Migrate 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; + var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var replicatedProtectedItemName = _match.Groups["replicatedProtectedItemName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -18025,10 +28335,11 @@ public partial class Migrate + resourceName + "/replicationFabrics/" + fabricName - + "/replicationNetworks/" - + networkName - + "/replicationNetworkMappings/" - + networkMappingName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationProtectedItems/" + + replicatedProtectedItemName + + "/addDisks" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -18037,7 +28348,7 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -18046,11 +28357,11 @@ public partial class Migrate request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationNetworkMappingsUpdate_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectedItemsAddDisks_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -18058,7 +28369,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -18072,6 +28383,7 @@ public partial class Migrate // 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 ) @@ -18154,10 +28466,10 @@ public partial class Migrate continue; } // we are done polling, do a request on final target? - if (!string.IsNullOrWhiteSpace(_originalUri)) + if (!string.IsNullOrWhiteSpace(_finalUri)) { // create a new request with the final uri - request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get); + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get); // drop the old response _response?.Dispose(); @@ -18175,7 +28487,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.NetworkMapping.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ReplicationProtectedItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -18195,21 +28507,21 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Primary fabric name. - /// Primary network name. - /// Network mapping name. - /// Update network mapping input. + /// 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 ReplicationNetworkMappingsUpdate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string networkName, string networkMappingName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IUpdateNetworkMappingInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + 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.Migrate.Models.Api202301.IAddDisksInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -18217,26 +28529,30 @@ public partial class Migrate 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(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(replicatedProtectedItemName),replicatedProtectedItemName); await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// Gets the details of a network. + /// + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Server Id. - /// Primary network name. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsApplyRecoveryPoint(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IApplyRecoveryPointInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -18252,8 +28568,11 @@ public partial class Migrate + global::System.Uri.EscapeDataString(resourceName) + "/replicationFabrics/" + global::System.Uri.EscapeDataString(fabricName) - + "/replicationNetworks/" - + global::System.Uri.EscapeDataString(networkName) + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationProtectedItems/" + + global::System.Uri.EscapeDataString(replicatedProtectedItemName) + + "/applyRecoveryPoint" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -18262,24 +28581,31 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationNetworksGet_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectedItemsApplyRecoveryPoint_Call(request,onOk,eventListener,sender); } } - /// Gets the details of a network. + /// + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsApplyRecoveryPointViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IApplyRecoveryPointInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -18287,10 +28613,10 @@ public partial class Migrate { // 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); + 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}/replicationNetworks/{networkName}'"); + 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 @@ -18298,7 +28624,8 @@ public partial class Migrate 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 protectionContainerName = _match.Groups["protectionContainerName"].Value; + var replicatedProtectedItemName = _match.Groups["replicatedProtectedItemName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -18309,8 +28636,11 @@ public partial class Migrate + resourceName + "/replicationFabrics/" + fabricName - + "/replicationNetworks/" - + networkName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationProtectedItems/" + + replicatedProtectedItemName + + "/applyRecoveryPoint" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -18319,16 +28649,22 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationNetworksGet_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectedItemsApplyRecoveryPoint_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// + /// 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. @@ -18336,7 +28672,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -18347,6 +28683,106 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -18354,7 +28790,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.Network.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ReplicationProtectedItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -18374,19 +28810,21 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation - /// events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Server Id. - /// Primary network name. + /// 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 ReplicationNetworksGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string networkName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + 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.Migrate.Models.Api202301.IApplyRecoveryPointInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -18394,64 +28832,28 @@ public partial class Migrate 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. - /// Azure Subscription Id in which migrate project was created. - /// a delegate that is called when the remote service returns 200 (OK). - /// an instance that will receive events. - /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - // generate request object - var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } - // make the call - await this.ReplicationNetworksList_Call(request,onOk,eventListener,sender); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(replicatedProtectedItemName),replicatedProtectedItemName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// Lists the networks available for a fabric. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsCreate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IEnableProtectionInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -18467,7 +28869,10 @@ public partial class Migrate + global::System.Uri.EscapeDataString(resourceName) + "/replicationFabrics/" + global::System.Uri.EscapeDataString(fabricName) - + "/replicationNetworks" + + "/replicationProtectionContainers/" + + global::System.Uri.EscapeDataString(protectionContainerName) + + "/replicationProtectedItems/" + + global::System.Uri.EscapeDataString(replicatedProtectedItemName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -18476,24 +28881,29 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationNetworksListByReplicationFabrics_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectedItemsCreate_Call(request,onOk,eventListener,sender); } } - /// Lists the networks available for a fabric. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsCreateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IEnableProtectionInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -18501,10 +28911,10 @@ public partial class Migrate { // 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); + 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}/replicationNetworks'"); + 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 @@ -18512,6 +28922,8 @@ public partial class Migrate 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/" @@ -18522,7 +28934,10 @@ public partial class Migrate + resourceName + "/replicationFabrics/" + fabricName - + "/replicationNetworks" + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationProtectedItems/" + + replicatedProtectedItemName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -18531,18 +28946,20 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationNetworksListByReplicationFabrics_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectedItemsCreate_Call(request,onOk,eventListener,sender); } } - /// - /// Actual wire call for method. - /// + /// 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. @@ -18550,7 +28967,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -18561,6 +28978,105 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -18568,7 +29084,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.NetworkCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ReplicationProtectedItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -18588,18 +29104,21 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, - /// but you will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. + /// 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 ReplicationNetworksListByReplicationFabrics_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + 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.Migrate.Models.Api202301.IEnableProtectionInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -18607,18 +29126,83 @@ public partial class Migrate 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); } } - /// Lists the networks available in a vault. + /// + /// 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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IDisableProtectionInput body, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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. + /// /// - /// a delegate that is called when the remote service returns 200 (OK). + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsDeleteViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IDisableProtectionInput body, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -18626,16 +29210,19 @@ public partial class Migrate { // 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); + 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}/replicationNetworks'"); + 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/" @@ -18644,7 +29231,13 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationNetworks" + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationProtectedItems/" + + replicatedProtectedItemName + + "/remove" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -18653,24 +29246,28 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationNetworksList_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectedItemsDelete_Call(request,onNoContent,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 200 (OK). + /// 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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -18681,14 +29278,114 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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: + case global::System.Net.HttpStatusCode.NoContent: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.NetworkCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onNoContent(_response); break; } default: @@ -18708,39 +29405,49 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get - /// validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. + /// 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 ReplicationNetworksList_Validate(string resourceName, string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + 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.Migrate.Models.Api202301.IDisableProtectionInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 replication policy. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Replication policy name. - /// Create policy input. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.ICreatePolicyInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -18754,8 +29461,13 @@ public partial class Migrate + global::System.Uri.EscapeDataString(resourceGroupName) + "/providers/Microsoft.RecoveryServices/vaults/" + global::System.Uri.EscapeDataString(resourceName) - + "/replicationPolicies/" - + global::System.Uri.EscapeDataString(policyName) + + "/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"); @@ -18764,29 +29476,24 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationPoliciesCreate_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectedItemsFailoverCancel_Call(request,onOk,eventListener,sender); } } - /// The operation to create a replication policy. + /// Operation to cancel the failover of the replication protected item. /// - /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.ICreatePolicyInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -18794,17 +29501,19 @@ public partial class Migrate { // 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); + 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}/replicationPolicies/{policyName}'"); + 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 policyName = _match.Groups["policyName"].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/" @@ -18813,8 +29522,13 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationPolicies/" - + policyName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationProtectedItems/" + + replicatedProtectedItemName + + "/failoverCancel" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -18823,20 +29537,18 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationPoliciesCreate_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectedItemsFailoverCancel_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// + /// 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. @@ -18844,7 +29556,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -18858,6 +29570,7 @@ public partial class Migrate // 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 ) @@ -18940,10 +29653,10 @@ public partial class Migrate continue; } // we are done polling, do a request on final target? - if (!string.IsNullOrWhiteSpace(_originalUri)) + if (!string.IsNullOrWhiteSpace(_finalUri)) { // create a new request with the final uri - request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get); + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get); // drop the old response _response?.Dispose(); @@ -18961,7 +29674,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.Policy.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ReplicationProtectedItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -18981,43 +29694,46 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get - /// validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Replication policy name. - /// Create policy input. + /// 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 ReplicationPoliciesCreate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string policyName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ICreatePolicyInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + 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.Migrate.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); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(replicatedProtectedItemName),replicatedProtectedItemName); } } - /// The operation to delete a replication policy. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Replication policy name. - /// a delegate that is called when the remote service returns 204 (NoContent). + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -19031,8 +29747,13 @@ public partial class Migrate + global::System.Uri.EscapeDataString(resourceGroupName) + "/providers/Microsoft.RecoveryServices/vaults/" + global::System.Uri.EscapeDataString(resourceName) - + "/replicationPolicies/" - + global::System.Uri.EscapeDataString(policyName) + + "/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"); @@ -19041,24 +29762,24 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationPoliciesDelete_Call(request,onNoContent,eventListener,sender); + await this.ReplicationProtectedItemsFailoverCommit_Call(request,onOk,eventListener,sender); } } - /// The operation to delete a replication policy. + /// Operation to commit the failover of the replication protected item. /// - /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -19066,17 +29787,19 @@ public partial class Migrate { // 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); + 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}/replicationPolicies/{policyName}'"); + 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 policyName = _match.Groups["policyName"].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/" @@ -19085,8 +29808,13 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationPolicies/" - + policyName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationProtectedItems/" + + replicatedProtectedItemName + + "/failoverCommit" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -19095,24 +29823,26 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationPoliciesDelete_Call(request,onNoContent,eventListener,sender); + await this.ReplicationProtectedItemsFailoverCommit_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// + /// Actual wire call for method. + /// /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -19227,10 +29957,10 @@ public partial class Migrate switch ( _response.StatusCode ) { - case global::System.Net.HttpStatusCode.NoContent: + case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onNoContent(_response); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ReplicationProtectedItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -19250,40 +29980,46 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get - /// validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Replication policy name. + /// 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 ReplicationPoliciesDelete_Validate(string resourceName, string resourceGroupName, string subscriptionId, string policyName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + 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.Migrate.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(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(replicatedProtectedItemName),replicatedProtectedItemName); } } - /// Gets the details of a replication policy. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Replication policy name. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -19297,8 +30033,12 @@ public partial class Migrate + global::System.Uri.EscapeDataString(resourceGroupName) + "/providers/Microsoft.RecoveryServices/vaults/" + global::System.Uri.EscapeDataString(resourceName) - + "/replicationPolicies/" - + global::System.Uri.EscapeDataString(policyName) + + "/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"); @@ -19312,11 +30052,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationPoliciesGet_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectedItemsGet_Call(request,onOk,eventListener,sender); } } - /// Gets the details of a replication policy. + /// 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. @@ -19324,7 +30064,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -19332,17 +30072,19 @@ public partial class Migrate { // 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); + 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}/replicationPolicies/{policyName}'"); + 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 policyName = _match.Groups["policyName"].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/" @@ -19351,8 +30093,12 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationPolicies/" - + policyName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationProtectedItems/" + + replicatedProtectedItemName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -19366,11 +30112,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationPoliciesGet_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectedItemsGet_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -19378,7 +30124,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -19396,7 +30142,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.Policy.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ReplicationProtectedItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -19416,39 +30162,45 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation - /// events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Replication policy name. + /// 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 ReplicationPoliciesGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string policyName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + 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.Migrate.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(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(replicatedProtectedItemName),replicatedProtectedItemName); } } - /// Lists the replication policies for a vault. + /// 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. /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -19462,9 +30214,13 @@ public partial class Migrate + global::System.Uri.EscapeDataString(resourceGroupName) + "/providers/Microsoft.RecoveryServices/vaults/" + global::System.Uri.EscapeDataString(resourceName) - + "/replicationPolicies" + + "/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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -19476,11 +30232,59 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationPoliciesList_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectedItemsList_Call(request,onOk,eventListener,sender); } } - /// Lists the replication policies for a vault. + /// 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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. @@ -19488,7 +30292,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -19496,16 +30300,18 @@ public partial class Migrate { // 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); + 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}/replicationPolicies'"); + 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/" @@ -19514,7 +30320,11 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationPolicies" + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationProtectedItems" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -19528,11 +30338,13 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationPoliciesList_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectedItemsListByReplicationProtectionContainers_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// + /// 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. @@ -19540,7 +30352,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -19558,7 +30370,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.PolicyCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ReplicationProtectedItemCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -19578,85 +30390,41 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get - /// validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. + /// 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 ReplicationPoliciesList_Validate(string resourceName, string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsListByReplicationProtectionContainers_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 update a replication policy. - /// The name of the recovery services vault. - /// The name of the resource group where the recovery services vault is present. - /// Azure Subscription Id in which migrate project was created. - /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IUpdatePolicyInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - // generate request object - var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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. + /// Gets the list of ASR replication protected items in the vault. /// - /// Update Policy Input. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IUpdatePolicyInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -19664,17 +30432,16 @@ public partial class Migrate { // 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); + 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}/replicationPolicies/{policyName}'"); + 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; - var policyName = _match.Groups["policyName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -19683,30 +30450,29 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationPolicies/" - + policyName + + "/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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationPoliciesUpdate_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectedItemsList_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -19714,7 +30480,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -19725,105 +30491,6 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - break; - } - } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -19831,7 +30498,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.Policy.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ReplicationProtectedItemCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -19851,45 +30518,45 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get - /// validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Policy Id. - /// Update Policy Input. + /// 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 ReplicationPoliciesUpdate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string policyName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IUpdatePolicyInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsList_Validate(string resourceName, string resourceGroupName, string subscriptionId, string skipToken, string Filter, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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); + await eventListener.AssertNotNull(nameof(skipToken),skipToken); + await eventListener.AssertNotNull(nameof(Filter),Filter); } } - /// The operation to get the details of a protectable item. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. + /// Unique fabric name. /// Protection container name. - /// Protectable item 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsPlannedFailover(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IPlannedFailoverInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -19907,8 +30574,9 @@ public partial class Migrate + global::System.Uri.EscapeDataString(fabricName) + "/replicationProtectionContainers/" + global::System.Uri.EscapeDataString(protectionContainerName) - + "/replicationProtectableItems/" - + global::System.Uri.EscapeDataString(protectableItemName) + + "/replicationProtectedItems/" + + global::System.Uri.EscapeDataString(replicatedProtectedItemName) + + "/plannedFailover" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -19917,24 +30585,29 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectableItemsGet_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectedItemsPlannedFailover_Call(request,onOk,eventListener,sender); } } - /// The operation to get the details of a protectable item. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsPlannedFailoverViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IPlannedFailoverInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -19942,10 +30615,10 @@ public partial class Migrate { // 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); + 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}/replicationProtectableItems/{protectableItemName}'"); + 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 @@ -19954,7 +30627,7 @@ public partial class Migrate var subscriptionId = _match.Groups["subscriptionId"].Value; var fabricName = _match.Groups["fabricName"].Value; var protectionContainerName = _match.Groups["protectionContainerName"].Value; - var protectableItemName = _match.Groups["protectableItemName"].Value; + var replicatedProtectedItemName = _match.Groups["replicatedProtectedItemName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -19967,8 +30640,9 @@ public partial class Migrate + fabricName + "/replicationProtectionContainers/" + protectionContainerName - + "/replicationProtectableItems/" - + protectableItemName + + "/replicationProtectedItems/" + + replicatedProtectedItemName + + "/plannedFailover" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -19977,16 +30651,22 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectableItemsGet_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectedItemsPlannedFailover_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// + /// 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. @@ -19994,7 +30674,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -20005,6 +30685,106 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -20012,7 +30792,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ProtectableItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ReplicationProtectedItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -20032,20 +30812,21 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will - /// get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. + /// Unique fabric name. /// Protection container name. - /// Protectable item 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 ReplicationProtectableItemsGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string protectableItemName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + 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.Migrate.Models.Api202301.IPlannedFailoverInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -20054,26 +30835,29 @@ public partial class Migrate await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(fabricName),fabricName); await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); - await eventListener.AssertNotNull(nameof(protectableItemName),protectableItemName); + await eventListener.AssertNotNull(nameof(replicatedProtectedItemName),replicatedProtectedItemName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// Lists the protectable items in a protection container. + /// + /// 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. /// Azure Subscription Id in which migrate project was created. /// 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). + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -20091,42 +30875,37 @@ public partial class Migrate + global::System.Uri.EscapeDataString(fabricName) + "/replicationProtectionContainers/" + global::System.Uri.EscapeDataString(protectionContainerName) - + "/replicationProtectableItems" + + "/replicationProtectedItems/" + + global::System.Uri.EscapeDataString(replicatedProtectedItemName) + "?" + "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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectableItemsListByReplicationProtectionContainers_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectedItemsPurge_Call(request,onNoContent,eventListener,sender); } } - /// Lists the protectable items in a protection container. + /// + /// 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. + /// /// - /// OData filter options. - /// take OData query parameter. - /// skipToken OData query parameter. - /// a delegate that is called when the remote service returns 200 (OK). + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsPurgeViaIdentity(global::System.String viaIdentity, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -20134,10 +30913,10 @@ public partial class Migrate { // 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); + 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}/replicationProtectableItems'"); + 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 @@ -20146,6 +30925,7 @@ public partial class Migrate 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/" @@ -20158,41 +30938,34 @@ public partial class Migrate + fabricName + "/replicationProtectionContainers/" + protectionContainerName - + "/replicationProtectableItems" + + "/replicationProtectedItems/" + + replicatedProtectedItemName + "?" + "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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectableItemsListByReplicationProtectionContainers_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectedItemsPurge_Call(request,onNoContent,eventListener,sender); } } - /// - /// Actual wire call for method. - /// + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 200 (OK). + /// 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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task ReplicationProtectedItemsPurge_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -20203,14 +30976,114 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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: + case global::System.Net.HttpStatusCode.NoContent: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ProtectableItemCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onNoContent(_response); break; } default: @@ -20230,22 +31103,20 @@ public partial class Migrate } /// - /// Validation method for method. Call this - /// like the actual call, but you will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. /// Fabric name. /// Protection container name. - /// OData filter options. - /// take OData query parameter. - /// skipToken OData query parameter. + /// 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 ReplicationProtectableItemsListByReplicationProtectionContainers_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string Filter, string Take, string SkipToken, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + 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.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -20254,27 +31125,25 @@ public partial class Migrate 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); + await eventListener.AssertNotNull(nameof(replicatedProtectedItemName),replicatedProtectedItemName); } } - /// Operation to add disks(s) to the replication protected item. + /// 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. /// Azure Subscription Id in which migrate project was created. /// Unique fabric name. /// Protection container name. /// Replication protected item name. - /// Add disks input. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IAddDisksInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsRemoveDisks(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IRemoveDisksInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -20294,7 +31163,7 @@ public partial class Migrate + global::System.Uri.EscapeDataString(protectionContainerName) + "/replicationProtectedItems/" + global::System.Uri.EscapeDataString(replicatedProtectedItemName) - + "/addDisks" + + "/removeDisks" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -20312,20 +31181,20 @@ public partial class Migrate request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectedItemsAddDisks_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectedItemsRemoveDisks_Call(request,onOk,eventListener,sender); } } - /// Operation to add disks(s) to the replication protected item. + /// Operation to remove disk(s) from the replication protected item. /// - /// Add disks input. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IAddDisksInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsRemoveDisksViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IRemoveDisksInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -20333,10 +31202,10 @@ public partial class Migrate { // 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); + 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}/addDisks'"); + 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 @@ -20360,7 +31229,7 @@ public partial class Migrate + protectionContainerName + "/replicationProtectedItems/" + replicatedProtectedItemName - + "/addDisks" + + "/removeDisks" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -20378,11 +31247,13 @@ public partial class Migrate request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectedItemsAddDisks_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectedItemsRemoveDisks_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// + /// 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. @@ -20390,7 +31261,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -20528,8 +31399,8 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you - /// will get validation events back. + /// 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. @@ -20537,12 +31408,12 @@ public partial class Migrate /// Unique fabric name. /// Protection container name. /// Replication protected item name. - /// Add disks input. + /// 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 ReplicationProtectedItemsAddDisks_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IAddDisksInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + 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.Migrate.Models.Api202301.IRemoveDisksInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -20558,22 +31429,21 @@ public partial class Migrate } /// - /// The operation to change the recovery point of a failed over replication protected item. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// The ARM fabric name. - /// The protection container name. - /// The replicated protected item name. - /// The ApplyRecoveryPointInput. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IApplyRecoveryPointInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -20593,7 +31463,7 @@ public partial class Migrate + global::System.Uri.EscapeDataString(protectionContainerName) + "/replicationProtectedItems/" + global::System.Uri.EscapeDataString(replicatedProtectedItemName) - + "/applyRecoveryPoint" + + "/repairReplication" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -20606,27 +31476,22 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectedItemsApplyRecoveryPoint_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectedItemsRepairReplication_Call(request,onOk,eventListener,sender); } } /// - /// The operation to change the recovery point of a failed over replication protected item. + /// The operation to start resynchronize/repair replication for a replication protected item requiring resynchronization. /// /// - /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IApplyRecoveryPointInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -20634,10 +31499,10 @@ public partial class Migrate { // 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); + 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}/applyRecoveryPoint'"); + 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 @@ -20661,7 +31526,7 @@ public partial class Migrate + protectionContainerName + "/replicationProtectedItems/" + replicatedProtectedItemName - + "/applyRecoveryPoint" + + "/repairReplication" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -20674,17 +31539,13 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectedItemsApplyRecoveryPoint_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectedItemsRepairReplication_Call(request,onOk,eventListener,sender); } } /// - /// Actual wire call for method. + /// Actual wire call for method. /// /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). @@ -20693,7 +31554,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -20831,21 +31692,20 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, + /// 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. /// Azure Subscription Id in which migrate project was created. - /// The ARM fabric name. - /// The protection container name. - /// The replicated protected item name. - /// The ApplyRecoveryPointInput. + /// 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 ReplicationProtectedItemsApplyRecoveryPoint_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IApplyRecoveryPointInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + 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.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -20855,26 +31715,26 @@ public partial class Migrate 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). + /// + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Name of the fabric. + /// Unique fabric name. /// Protection container name. - /// A name for the replication protected item. - /// Enable Protection Input. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IEnableProtectionInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsReprotect(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IReverseReplicationInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -20894,6 +31754,7 @@ public partial class Migrate + global::System.Uri.EscapeDataString(protectionContainerName) + "/replicationProtectedItems/" + global::System.Uri.EscapeDataString(replicatedProtectedItemName) + + "/reProtect" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -20902,7 +31763,7 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -20911,20 +31772,22 @@ public partial class Migrate request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectedItemsCreate_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectedItemsReprotect_Call(request,onOk,eventListener,sender); } } - /// The operation to create an ASR replication protected item (Enable replication). + /// + /// Operation to reprotect or reverse replicate a failed over replication protected item. + /// /// - /// Enable Protection Input. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IEnableProtectionInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsReprotectViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IReverseReplicationInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -20932,10 +31795,10 @@ public partial class Migrate { // 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); + 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}'"); + 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 @@ -20959,6 +31822,7 @@ public partial class Migrate + protectionContainerName + "/replicationProtectedItems/" + replicatedProtectedItemName + + "/reProtect" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -20967,7 +31831,7 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -20976,11 +31840,11 @@ public partial class Migrate request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectedItemsCreate_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectedItemsReprotect_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -20988,7 +31852,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -21002,6 +31866,7 @@ public partial class Migrate // 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 ) @@ -21084,10 +31949,10 @@ public partial class Migrate continue; } // we are done polling, do a request on final target? - if (!string.IsNullOrWhiteSpace(_originalUri)) + if (!string.IsNullOrWhiteSpace(_finalUri)) { // create a new request with the final uri - request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get); + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get); // drop the old response _response?.Dispose(); @@ -21125,21 +31990,21 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will - /// get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Name of the fabric. + /// Unique fabric name. /// Protection container name. - /// A name for the replication protected item. - /// Enable Protection Input. + /// 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 ReplicationProtectedItemsCreate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IEnableProtectionInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + 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.Migrate.Models.Api202301.IReverseReplicationInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -21154,23 +32019,21 @@ public partial class Migrate } } - /// - /// The operation to disable replication on a replication protected item. This will also remove the item. - /// + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. + /// Unique fabric name. /// Protection container name. /// Replication protected item name. - /// Disable protection input. - /// a delegate that is called when the remote service returns 204 (NoContent). + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IDisableProtectionInput body, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsResolveHealthErrors(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IResolveHealthInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -21190,7 +32053,7 @@ public partial class Migrate + global::System.Uri.EscapeDataString(protectionContainerName) + "/replicationProtectedItems/" + global::System.Uri.EscapeDataString(replicatedProtectedItemName) - + "/remove" + + "/resolveHealthErrors" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -21208,22 +32071,20 @@ public partial class Migrate request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectedItemsDelete_Call(request,onNoContent,eventListener,sender); + await this.ReplicationProtectedItemsResolveHealthErrors_Call(request,onOk,eventListener,sender); } } - /// - /// The operation to disable replication on a replication protected item. This will also remove the item. - /// + /// Operation to resolve health issues of the replication protected item. /// - /// Disable protection input. - /// a delegate that is called when the remote service returns 204 (NoContent). + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IDisableProtectionInput body, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsResolveHealthErrorsViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IResolveHealthInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -21231,10 +32092,10 @@ public partial class Migrate { // 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); + 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}/remove'"); + 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 @@ -21258,7 +32119,7 @@ public partial class Migrate + protectionContainerName + "/replicationProtectedItems/" + replicatedProtectedItemName - + "/remove" + + "/resolveHealthErrors" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -21276,19 +32137,21 @@ public partial class Migrate request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectedItemsDelete_Call(request,onNoContent,eventListener,sender); + await this.ReplicationProtectedItemsResolveHealthErrors_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// + /// Actual wire call for method. + /// /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -21403,10 +32266,10 @@ public partial class Migrate switch ( _response.StatusCode ) { - case global::System.Net.HttpStatusCode.NoContent: + case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onNoContent(_response); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ReplicationProtectedItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -21426,21 +32289,21 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will - /// get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. + /// Unique fabric name. /// Protection container name. /// Replication protected item name. - /// Disable protection input. + /// 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 ReplicationProtectedItemsDelete_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IDisableProtectionInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + 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.Migrate.Models.Api202301.IResolveHealthInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -21455,20 +32318,21 @@ public partial class Migrate } } - /// Operation to cancel the failover of the replication protected item. + /// 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. /// Azure Subscription Id in which migrate project was created. /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsSwitchProvider(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ISwitchProviderInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -21488,7 +32352,7 @@ public partial class Migrate + global::System.Uri.EscapeDataString(protectionContainerName) + "/replicationProtectedItems/" + global::System.Uri.EscapeDataString(replicatedProtectedItemName) - + "/failoverCancel" + + "/switchProvider" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -21501,20 +32365,25 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectedItemsFailoverCancel_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectedItemsSwitchProvider_Call(request,onOk,eventListener,sender); } } - /// Operation to cancel the failover of the replication protected item. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsSwitchProviderViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ISwitchProviderInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -21522,10 +32391,10 @@ public partial class Migrate { // 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); + 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}/failoverCancel'"); + 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 @@ -21549,7 +32418,7 @@ public partial class Migrate + protectionContainerName + "/replicationProtectedItems/" + replicatedProtectedItemName - + "/failoverCancel" + + "/switchProvider" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -21562,13 +32431,17 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectedItemsFailoverCancel_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectedItemsSwitchProvider_Call(request,onOk,eventListener,sender); } } /// - /// Actual wire call for method. + /// Actual wire call for method. /// /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). @@ -21577,7 +32450,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -21590,8 +32463,8 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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"); + // 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 ) @@ -21674,19 +32547,16 @@ public partial class Migrate 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.Migrate.Runtime.Method.Get); + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get); - // drop the old response - _response?.Dispose(); + // drop the old response + _response?.Dispose(); - // make the final call - _response = await sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - break; - } + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; } var _contentType = _response.Content.Headers.ContentType?.MediaType; @@ -21715,7 +32585,7 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but + /// Validation method for method. Call this like the actual call, but /// you will get validation events back. /// /// The name of the recovery services vault. @@ -21724,11 +32594,12 @@ public partial class Migrate /// 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 ReplicationProtectedItemsFailoverCancel_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + 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.Migrate.Models.Api202301.ISwitchProviderInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -21738,23 +32609,26 @@ public partial class Migrate 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 commit the failover of the replication protected item. + /// 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. /// Azure Subscription Id in which migrate project was created. /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsTestFailover(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ITestFailoverInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -21774,7 +32648,7 @@ public partial class Migrate + global::System.Uri.EscapeDataString(protectionContainerName) + "/replicationProtectedItems/" + global::System.Uri.EscapeDataString(replicatedProtectedItemName) - + "/failoverCommit" + + "/testFailover" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -21787,20 +32661,81 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectedItemsFailoverCommit_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectedItemsTestFailover_Call(request,onOk,eventListener,sender); } } - /// Operation to commit the failover of the replication protected item. + /// 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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.ITestFailoverCleanupInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsTestFailoverCleanupViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ITestFailoverCleanupInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -21808,10 +32743,10 @@ public partial class Migrate { // 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); + 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}/failoverCommit'"); + 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 @@ -21835,7 +32770,7 @@ public partial class Migrate + protectionContainerName + "/replicationProtectedItems/" + replicatedProtectedItemName - + "/failoverCommit" + + "/testFailoverCleanup" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -21848,13 +32783,17 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectedItemsFailoverCommit_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectedItemsTestFailoverCleanup_Call(request,onOk,eventListener,sender); } } /// - /// Actual wire call for method. + /// Actual wire call for method. /// /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). @@ -21863,7 +32802,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -22001,8 +32940,8 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but - /// you will get validation events back. + /// 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. @@ -22010,11 +32949,12 @@ public partial class Migrate /// 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 ReplicationProtectedItemsFailoverCommit_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + 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.Migrate.Models.Api202301.ITestFailoverCleanupInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -22024,68 +32964,21 @@ public partial class Migrate 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); } } - /// 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. - /// Azure Subscription Id in which migrate project was created. - /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - // generate request object - var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsTestFailoverViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ITestFailoverInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -22093,10 +32986,10 @@ public partial class Migrate { // 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); + 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}'"); + 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 @@ -22120,6 +33013,7 @@ public partial class Migrate + protectionContainerName + "/replicationProtectedItems/" + replicatedProtectedItemName + + "/testFailover" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -22128,16 +33022,22 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectedItemsGet_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectedItemsTestFailover_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// + /// 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. @@ -22145,7 +33045,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -22156,6 +33056,106 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -22183,93 +33183,50 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will - /// get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric unique name. + /// 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 ReplicationProtectedItemsGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. - /// Azure Subscription Id in which migrate project was created. - /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - // generate request object - var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } - // make the call - await this.ReplicationProtectedItemsList_Call(request,onOk,eventListener,sender); + /// + 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.Migrate.Models.Api202301.ITestFailoverInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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); } } - /// Gets the list of ASR replication protected items in the protection container. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsUnplannedFailover(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IUnplannedFailoverInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -22287,7 +33244,9 @@ public partial class Migrate + global::System.Uri.EscapeDataString(fabricName) + "/replicationProtectionContainers/" + global::System.Uri.EscapeDataString(protectionContainerName) - + "/replicationProtectedItems" + + "/replicationProtectedItems/" + + global::System.Uri.EscapeDataString(replicatedProtectedItemName) + + "/unplannedFailover" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -22296,24 +33255,29 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectedItemsListByReplicationProtectionContainers_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectedItemsUnplannedFailover_Call(request,onOk,eventListener,sender); } } - /// Gets the list of ASR replication protected items in the protection container. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsUnplannedFailoverViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IUnplannedFailoverInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -22321,10 +33285,10 @@ public partial class Migrate { // 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); + 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'"); + 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 @@ -22333,6 +33297,7 @@ public partial class Migrate 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/" @@ -22345,7 +33310,9 @@ public partial class Migrate + fabricName + "/replicationProtectionContainers/" + protectionContainerName - + "/replicationProtectedItems" + + "/replicationProtectedItems/" + + replicatedProtectedItemName + + "/unplannedFailover" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -22354,17 +33321,21 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectedItemsListByReplicationProtectionContainers_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectedItemsUnplannedFailover_Call(request,onOk,eventListener,sender); } } /// - /// Actual wire call for method. + /// Actual wire call for method. /// /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). @@ -22373,7 +33344,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -22384,6 +33355,106 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -22391,7 +33462,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ReplicationProtectedItemCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ReplicationProtectedItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -22411,19 +33482,21 @@ public partial class Migrate } /// - /// Validation method for method. Call this - /// like the actual call, but you will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. + /// 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 ReplicationProtectedItemsListByReplicationProtectionContainers_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + 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.Migrate.Models.Api202301.IUnplannedFailoverInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -22432,152 +33505,84 @@ public partial class Migrate 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); } } - /// 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. + /// + /// 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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsUpdate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IUpdateReplicationProtectedItemInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 + + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" - + resourceGroupName + + global::System.Uri.EscapeDataString(resourceGroupName) + "/providers/Microsoft.RecoveryServices/vaults/" - + resourceName - + "/replicationProtectedItems" + + 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) - + "&" - + (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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); 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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } - _response = await sendTask; - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ReplicationProtectedItemCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - default: - { - throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); - } - } - } - finally - { - // finally statements - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. - /// Azure Subscription Id in which migrate project was created. - /// 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.Migrate.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); + await this.ReplicationProtectedItemsUpdate_Call(request,onOk,eventListener,sender); } } - /// Operation to initiate a planned failover of the replication protected item. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Unique fabric name. + /// Fabric name. /// Protection container name. /// Replication protected item name. - /// Planned failover input. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IPlannedFailoverInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsUpdateAppliance(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -22597,7 +33602,7 @@ public partial class Migrate + global::System.Uri.EscapeDataString(protectionContainerName) + "/replicationProtectedItems/" + global::System.Uri.EscapeDataString(replicatedProtectedItemName) - + "/plannedFailover" + + "/updateAppliance" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -22615,20 +33620,20 @@ public partial class Migrate request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectedItemsPlannedFailover_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectedItemsUpdateAppliance_Call(request,onOk,eventListener,sender); } } - /// Operation to initiate a planned failover of the replication protected item. + /// The operation to update appliance of an ASR replication protected item. /// - /// Planned failover input. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IPlannedFailoverInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsUpdateApplianceViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -22636,10 +33641,10 @@ public partial class Migrate { // 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); + 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}/plannedFailover'"); + 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 @@ -22663,7 +33668,7 @@ public partial class Migrate + protectionContainerName + "/replicationProtectedItems/" + replicatedProtectedItemName - + "/plannedFailover" + + "/updateAppliance" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -22681,12 +33686,12 @@ public partial class Migrate request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectedItemsPlannedFailover_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectedItemsUpdateAppliance_Call(request,onOk,eventListener,sender); } } /// - /// Actual wire call for method. + /// Actual wire call for method. /// /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). @@ -22695,7 +33700,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -22833,21 +33838,21 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Unique fabric name. + /// Fabric name. /// Protection container name. /// Replication protected item name. - /// Planned failover input. + /// 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 ReplicationProtectedItemsPlannedFailover_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IPlannedFailoverInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + 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.Migrate.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -22863,22 +33868,23 @@ public partial class Migrate } /// - /// 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 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. - /// Protection container name. - /// Replication protected item name. - /// a delegate that is called when the remote service returns 204 (NoContent). + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsUpdateMobilityService(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IUpdateMobilityServiceRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -22898,6 +33904,7 @@ public partial class Migrate + global::System.Uri.EscapeDataString(protectionContainerName) + "/replicationProtectedItems/" + global::System.Uri.EscapeDataString(replicatedProtectedItemName) + + "/updateMobilityService" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -22906,27 +33913,32 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectedItemsPurge_Call(request,onNoContent,eventListener,sender); + await this.ReplicationProtectedItemsUpdateMobilityService_Call(request,onOk,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. + /// The operation to update(push update) the installed mobility service software on a replication protected item to the latest + /// available version. /// /// - /// a delegate that is called when the remote service returns 204 (NoContent). + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsUpdateMobilityServiceViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IUpdateMobilityServiceRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -22934,10 +33946,10 @@ public partial class Migrate { // 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); + 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}'"); + 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 @@ -22961,6 +33973,7 @@ public partial class Migrate + protectionContainerName + "/replicationProtectedItems/" + replicatedProtectedItemName + + "/updateMobilityService" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -22969,24 +33982,30 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectedItemsPurge_Call(request,onNoContent,eventListener,sender); + await this.ReplicationProtectedItemsUpdateMobilityService_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// + /// Actual wire call for method. + /// /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -22999,7 +34018,7 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 + // declared final-state-via: location var _finalUri = _response.GetFirstHeader(@"Location"); var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); var location = _response.GetFirstHeader(@"Location"); @@ -23083,28 +34102,25 @@ public partial class Migrate 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.Migrate.Runtime.Method.Get); + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get); - // drop the old response - _response?.Dispose(); + // drop the old response + _response?.Dispose(); - // make the final call - _response = await sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - break; - } + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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: + case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onNoContent(_response); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ReplicationProtectedItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -23124,20 +34140,21 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will - /// get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. - /// Protection container name. - /// Replication protected item name. + /// 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 ReplicationProtectedItemsPurge_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + 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.Migrate.Models.Api202301.IUpdateMobilityServiceRequest body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -23147,75 +34164,23 @@ public partial class Migrate 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 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. - /// Azure Subscription Id in which migrate project was created. - /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IRemoveDisksInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - // generate request object - var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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. + /// + /// The operation to update the recovery settings of an ASR replication protected item. + /// /// - /// Remove disks input. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IRemoveDisksInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationProtectedItemsUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IUpdateReplicationProtectedItemInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -23223,10 +34188,10 @@ public partial class Migrate { // 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); + 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}/removeDisks'"); + 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 @@ -23250,7 +34215,6 @@ public partial class Migrate + protectionContainerName + "/replicationProtectedItems/" + replicatedProtectedItemName - + "/removeDisks" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -23259,7 +34223,7 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -23268,13 +34232,11 @@ public partial class Migrate request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectedItemsRemoveDisks_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectedItemsUpdate_Call(request,onOk,eventListener,sender); } } - /// - /// Actual wire call for method. - /// + /// 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. @@ -23282,7 +34244,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -23296,7 +34258,6 @@ public partial class Migrate // 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 ) @@ -23379,10 +34340,10 @@ public partial class Migrate continue; } // we are done polling, do a request on final target? - if (!string.IsNullOrWhiteSpace(_finalUri)) + if (!string.IsNullOrWhiteSpace(_originalUri)) { // create a new request with the final uri - request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get); + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get); // drop the old response _response?.Dispose(); @@ -23420,21 +34381,21 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but - /// you will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Unique fabric name. + /// Fabric name. /// Protection container name. /// Replication protected item name. - /// Remove disks input. + /// 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 ReplicationProtectedItemsRemoveDisks_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IRemoveDisksInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + 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.Migrate.Models.Api202301.IUpdateReplicationProtectedItemInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -23449,22 +34410,21 @@ public partial class Migrate } } - /// - /// The operation to start resynchronize/repair replication for a replication protected item requiring resynchronization. - /// + /// 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. /// Azure Subscription Id in which migrate project was created. - /// The name of the fabric. - /// The name of the container. - /// The name of the replication protected item. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationProtectionContainerMappingsCreate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string mappingName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ICreateProtectionContainerMappingInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -23482,9 +34442,8 @@ public partial class Migrate + global::System.Uri.EscapeDataString(fabricName) + "/replicationProtectionContainers/" + global::System.Uri.EscapeDataString(protectionContainerName) - + "/replicationProtectedItems/" - + global::System.Uri.EscapeDataString(replicatedProtectedItemName) - + "/repairReplication" + + "/replicationProtectionContainerMappings/" + + global::System.Uri.EscapeDataString(mappingName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -23493,26 +34452,29 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectedItemsRepairReplication_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectionContainerMappingsCreate_Call(request,onOk,eventListener,sender); } } - /// - /// The operation to start resynchronize/repair replication for a replication protected item requiring resynchronization. - /// + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationProtectionContainerMappingsCreateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ICreateProtectionContainerMappingInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -23520,10 +34482,10 @@ public partial class Migrate { // 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); + 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}/replicationProtectedItems/{replicatedProtectedItemName}/repairReplication'"); + 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 @@ -23532,7 +34494,7 @@ public partial class Migrate 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 mappingName = _match.Groups["mappingName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -23545,9 +34507,8 @@ public partial class Migrate + fabricName + "/replicationProtectionContainers/" + protectionContainerName - + "/replicationProtectedItems/" - + replicatedProtectedItemName - + "/repairReplication" + + "/replicationProtectionContainerMappings/" + + mappingName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -23556,17 +34517,21 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectedItemsRepairReplication_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectionContainerMappingsCreate_Call(request,onOk,eventListener,sender); } } /// - /// Actual wire call for method. + /// Actual wire call for method. /// /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). @@ -23575,7 +34540,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -23589,7 +34554,6 @@ public partial class Migrate // 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 ) @@ -23672,10 +34636,10 @@ public partial class Migrate continue; } // we are done polling, do a request on final target? - if (!string.IsNullOrWhiteSpace(_finalUri)) + if (!string.IsNullOrWhiteSpace(_originalUri)) { // create a new request with the final uri - request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get); + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get); // drop the old response _response?.Dispose(); @@ -23693,7 +34657,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ReplicationProtectedItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ProtectionContainerMapping.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -23713,20 +34677,21 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, + /// 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. /// Azure Subscription Id in which migrate project was created. - /// The name of the fabric. - /// The name of the container. - /// The name of the replication protected item. + /// 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 ReplicationProtectedItemsRepairReplication_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + 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.Migrate.Models.Api202301.ICreateProtectionContainerMappingInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -23735,27 +34700,27 @@ public partial class Migrate 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(mappingName),mappingName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// - /// Operation to reprotect or reverse replicate a failed over replication protected item. - /// + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Unique fabric name. + /// Fabric name. /// Protection container name. - /// Replication protected item name. - /// Reverse replication input. - /// a delegate that is called when the remote service returns 200 (OK). + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IReverseReplicationInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationProtectionContainerMappingsDelete(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string mappingName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IRemoveProtectionContainerMappingInput body, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -23773,9 +34738,9 @@ public partial class Migrate + global::System.Uri.EscapeDataString(fabricName) + "/replicationProtectionContainers/" + global::System.Uri.EscapeDataString(protectionContainerName) - + "/replicationProtectedItems/" - + global::System.Uri.EscapeDataString(replicatedProtectedItemName) - + "/reProtect" + + "/replicationProtectionContainerMappings/" + + global::System.Uri.EscapeDataString(mappingName) + + "/remove" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -23793,22 +34758,20 @@ public partial class Migrate request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectedItemsReprotect_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectionContainerMappingsDelete_Call(request,onNoContent,eventListener,sender); } } - /// - /// Operation to reprotect or reverse replicate a failed over replication protected item. - /// + /// The operation to delete or remove a protection container mapping. /// - /// Reverse replication input. - /// a delegate that is called when the remote service returns 200 (OK). + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IReverseReplicationInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationProtectionContainerMappingsDeleteViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IRemoveProtectionContainerMappingInput body, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -23816,10 +34779,10 @@ public partial class Migrate { // 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); + 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}/replicationProtectedItems/{replicatedProtectedItemName}/reProtect'"); + 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 @@ -23828,7 +34791,7 @@ public partial class Migrate 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 mappingName = _match.Groups["mappingName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -23841,9 +34804,9 @@ public partial class Migrate + fabricName + "/replicationProtectionContainers/" + protectionContainerName - + "/replicationProtectedItems/" - + replicatedProtectedItemName - + "/reProtect" + + "/replicationProtectionContainerMappings/" + + mappingName + + "/remove" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -23861,19 +34824,21 @@ public partial class Migrate request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectedItemsReprotect_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectionContainerMappingsDelete_Call(request,onNoContent,eventListener,sender); } } - /// Actual wire call for method. + /// + /// Actual wire call for method. + /// /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 200 (OK). + /// 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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task ReplicationProtectionContainerMappingsDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -23988,10 +34953,10 @@ public partial class Migrate switch ( _response.StatusCode ) { - case global::System.Net.HttpStatusCode.OK: + case global::System.Net.HttpStatusCode.NoContent: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ReplicationProtectedItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onNoContent(_response); break; } default: @@ -24011,21 +34976,21 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you - /// will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Unique fabric name. + /// Fabric name. /// Protection container name. - /// Replication protected item name. - /// Reverse replication input. + /// 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 ReplicationProtectedItemsReprotect_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IReverseReplicationInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + 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.Migrate.Models.Api202301.IRemoveProtectionContainerMappingInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -24034,27 +34999,26 @@ public partial class Migrate 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(mappingName),mappingName); await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// Operation to resolve health issues of the replication protected item. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Unique fabric name. + /// Fabric name. /// Protection container name. - /// Replication protected item name. - /// Health issue input object. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IResolveHealthInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -24072,9 +35036,8 @@ public partial class Migrate + global::System.Uri.EscapeDataString(fabricName) + "/replicationProtectionContainers/" + global::System.Uri.EscapeDataString(protectionContainerName) - + "/replicationProtectedItems/" - + global::System.Uri.EscapeDataString(replicatedProtectedItemName) - + "/resolveHealthErrors" + + "/replicationProtectionContainerMappings/" + + global::System.Uri.EscapeDataString(mappingName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -24083,29 +35046,24 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectedItemsResolveHealthErrors_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectionContainerMappingsGet_Call(request,onOk,eventListener,sender); } } - /// Operation to resolve health issues of the replication protected item. + /// Gets the details of a protection container mapping. /// - /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IResolveHealthInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -24113,10 +35071,10 @@ public partial class Migrate { // 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); + 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}/replicationProtectedItems/{replicatedProtectedItemName}/resolveHealthErrors'"); + 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 @@ -24125,7 +35083,7 @@ public partial class Migrate 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 mappingName = _match.Groups["mappingName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -24138,9 +35096,8 @@ public partial class Migrate + fabricName + "/replicationProtectionContainers/" + protectionContainerName - + "/replicationProtectedItems/" - + replicatedProtectedItemName - + "/resolveHealthErrors" + + "/replicationProtectionContainerMappings/" + + mappingName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -24149,21 +35106,17 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectedItemsResolveHealthErrors_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectionContainerMappingsGet_Call(request,onOk,eventListener,sender); } } /// - /// Actual wire call for method. + /// Actual wire call for method. /// /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). @@ -24172,7 +35125,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -24183,106 +35136,6 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - break; - } - } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -24290,7 +35143,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ReplicationProtectedItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ProtectionContainerMapping.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -24310,21 +35163,20 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Unique fabric name. + /// Fabric name. /// Protection container name. - /// Replication protected item name. - /// Health issue input object. + /// 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 ReplicationProtectedItemsResolveHealthErrors_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IResolveHealthInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + 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.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -24333,27 +35185,65 @@ public partial class Migrate 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); + await eventListener.AssertNotNull(nameof(mappingName),mappingName); } } - /// Operation to initiate a switch provider of the replication protected item. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Unique 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.ISwitchProviderInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -24371,9 +35261,7 @@ public partial class Migrate + global::System.Uri.EscapeDataString(fabricName) + "/replicationProtectionContainers/" + global::System.Uri.EscapeDataString(protectionContainerName) - + "/replicationProtectedItems/" - + global::System.Uri.EscapeDataString(replicatedProtectedItemName) - + "/switchProvider" + + "/replicationProtectionContainerMappings" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -24382,29 +35270,154 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectedItemsSwitchProvider_Call(request,onOk,eventListener,sender); + 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ProtectionContainerMappingCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.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); } } - /// Operation to initiate a switch provider of the replication protected item. + /// Lists the protection container mappings in the vault. /// - /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.ISwitchProviderInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -24412,19 +35425,16 @@ public partial class Migrate { // 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); + 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}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/switchProvider'"); + 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; - 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/" @@ -24433,13 +35443,7 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationFabrics/" - + fabricName - + "/replicationProtectionContainers/" - + protectionContainerName - + "/replicationProtectedItems/" - + replicatedProtectedItemName - + "/switchProvider" + + "/replicationProtectionContainerMappings" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -24448,21 +35452,17 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectedItemsSwitchProvider_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectionContainerMappingsList_Call(request,onOk,eventListener,sender); } } /// - /// Actual wire call for method. + /// Actual wire call for method. /// /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). @@ -24471,7 +35471,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -24482,103 +35482,6 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - break; - } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -24586,7 +35489,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ReplicationProtectedItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ProtectionContainerMappingCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -24606,106 +35509,40 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but - /// you will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// 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.Migrate.Models.Api202301.ISwitchProviderInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationProtectionContainerMappingsList_Validate(string resourceName, string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. - /// Azure Subscription Id in which migrate project was created. - /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.ITestFailoverInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - // generate request object - var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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 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. /// Azure Subscription Id in which migrate project was created. - /// Unique fabric name. + /// 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). + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.ITestFailoverCleanupInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -24723,9 +35560,8 @@ public partial class Migrate + global::System.Uri.EscapeDataString(fabricName) + "/replicationProtectionContainers/" + global::System.Uri.EscapeDataString(protectionContainerName) - + "/replicationProtectedItems/" - + global::System.Uri.EscapeDataString(replicatedProtectedItemName) - + "/testFailoverCleanup" + + "/replicationProtectionContainerMappings/" + + global::System.Uri.EscapeDataString(mappingName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -24734,29 +35570,24 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectedItemsTestFailoverCleanup_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectionContainerMappingsPurge_Call(request,onNoContent,eventListener,sender); } } - /// Operation to clean up the test failover of a replication protected item. + /// The operation to purge(force delete) a protection container mapping. /// - /// Test failover cleanup input. - /// a delegate that is called when the remote service returns 200 (OK). + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.ITestFailoverCleanupInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationProtectionContainerMappingsPurgeViaIdentity(global::System.String viaIdentity, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -24764,10 +35595,10 @@ public partial class Migrate { // 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); + 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}/replicationProtectedItems/{replicatedProtectedItemName}/testFailoverCleanup'"); + 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 @@ -24776,7 +35607,7 @@ public partial class Migrate 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 mappingName = _match.Groups["mappingName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -24789,9 +35620,8 @@ public partial class Migrate + fabricName + "/replicationProtectionContainers/" + protectionContainerName - + "/replicationProtectedItems/" - + replicatedProtectedItemName - + "/testFailoverCleanup" + + "/replicationProtectionContainerMappings/" + + mappingName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -24800,30 +35630,26 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectedItemsTestFailoverCleanup_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectionContainerMappingsPurge_Call(request,onNoContent,eventListener,sender); } } /// - /// Actual wire call for method. + /// Actual wire call for method. /// /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 200 (OK). + /// 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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task ReplicationProtectionContainerMappingsPurge_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -24938,10 +35764,10 @@ public partial class Migrate switch ( _response.StatusCode ) { - case global::System.Net.HttpStatusCode.OK: + case global::System.Net.HttpStatusCode.NoContent: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ReplicationProtectedItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onNoContent(_response); break; } default: @@ -24961,21 +35787,20 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Unique fabric name. + /// Fabric name. /// Protection container name. - /// Replication protected item name. - /// Test failover cleanup input. + /// 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 ReplicationProtectedItemsTestFailoverCleanup_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ITestFailoverCleanupInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + 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.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -24984,22 +35809,75 @@ public partial class Migrate 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); + await eventListener.AssertNotNull(nameof(mappingName),mappingName); } } - /// Operation to perform a test failover of the replication protected item. + /// 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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IUpdateProtectionContainerMappingInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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. /// - /// Test failover input. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.ITestFailoverInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationProtectionContainerMappingsUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IUpdateProtectionContainerMappingInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -25007,10 +35885,10 @@ public partial class Migrate { // 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); + 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}/replicationProtectedItems/{replicatedProtectedItemName}/testFailover'"); + 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 @@ -25019,7 +35897,7 @@ public partial class Migrate 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 mappingName = _match.Groups["mappingName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -25032,9 +35910,8 @@ public partial class Migrate + fabricName + "/replicationProtectionContainers/" + protectionContainerName - + "/replicationProtectedItems/" - + replicatedProtectedItemName - + "/testFailover" + + "/replicationProtectionContainerMappings/" + + mappingName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -25043,7 +35920,7 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -25052,12 +35929,12 @@ public partial class Migrate request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectedItemsTestFailover_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectionContainerMappingsUpdate_Call(request,onOk,eventListener,sender); } } /// - /// Actual wire call for method. + /// Actual wire call for method. /// /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). @@ -25066,7 +35943,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -25080,7 +35957,6 @@ public partial class Migrate // 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 ) @@ -25163,10 +36039,10 @@ public partial class Migrate continue; } // we are done polling, do a request on final target? - if (!string.IsNullOrWhiteSpace(_finalUri)) + if (!string.IsNullOrWhiteSpace(_originalUri)) { // create a new request with the final uri - request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get); + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get); // drop the old response _response?.Dispose(); @@ -25184,7 +36060,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ReplicationProtectedItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ProtectionContainerMapping.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -25204,21 +36080,21 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but - /// you will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Unique fabric name. + /// Fabric name. /// Protection container name. - /// Replication protected item name. - /// Test failover input. + /// 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 ReplicationProtectedItemsTestFailover_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ITestFailoverInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + 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.Migrate.Models.Api202301.IUpdateProtectionContainerMappingInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -25227,27 +36103,26 @@ public partial class Migrate 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(mappingName),mappingName); await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// Operation to initiate a failover of the replication protected item. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Unique fabric name. - /// Protection container name. - /// Replication protected item name. - /// Failover input. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IUnplannedFailoverInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationProtectionContainersCreate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ICreateProtectionContainerInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -25265,9 +36140,6 @@ public partial class Migrate + 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"); @@ -25276,7 +36148,7 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -25285,20 +36157,20 @@ public partial class Migrate request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectedItemsUnplannedFailover_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectionContainersCreate_Call(request,onOk,eventListener,sender); } } - /// Operation to initiate a failover of the replication protected item. + /// Operation to create a protection container. /// - /// Failover input. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IUnplannedFailoverInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationProtectionContainersCreateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ICreateProtectionContainerInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -25306,10 +36178,10 @@ public partial class Migrate { // 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); + 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}/replicationProtectedItems/{replicatedProtectedItemName}/unplannedFailover'"); + 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 @@ -25318,7 +36190,6 @@ public partial class Migrate 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/" @@ -25331,9 +36202,6 @@ public partial class Migrate + fabricName + "/replicationProtectionContainers/" + protectionContainerName - + "/replicationProtectedItems/" - + replicatedProtectedItemName - + "/unplannedFailover" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -25342,7 +36210,7 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -25351,12 +36219,12 @@ public partial class Migrate request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectedItemsUnplannedFailover_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectionContainersCreate_Call(request,onOk,eventListener,sender); } } /// - /// Actual wire call for method. + /// Actual wire call for method. /// /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). @@ -25365,7 +36233,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -25379,7 +36247,6 @@ public partial class Migrate // 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 ) @@ -25462,10 +36329,10 @@ public partial class Migrate continue; } // we are done polling, do a request on final target? - if (!string.IsNullOrWhiteSpace(_finalUri)) + if (!string.IsNullOrWhiteSpace(_originalUri)) { // create a new request with the final uri - request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get); + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get); // drop the old response _response?.Dispose(); @@ -25483,7 +36350,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ReplicationProtectedItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ProtectionContainer.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -25503,107 +36370,46 @@ public partial class Migrate } /// - /// 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. - /// Azure Subscription Id in which migrate project was created. - /// 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.Migrate.Models.Api202301.IUnplannedFailoverInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// 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. - /// Azure Subscription Id in which migrate project was created. - /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IUpdateReplicationProtectedItemInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - // generate request object - var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } - // make the call - await this.ReplicationProtectedItemsUpdate_Call(request,onOk,eventListener,sender); + /// The name of the resource group where the recovery services vault is present. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Models.Api202301.ICreateProtectionContainerInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 update appliance of an ASR replication protected item. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// 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). + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -25621,9 +36427,7 @@ public partial class Migrate + global::System.Uri.EscapeDataString(fabricName) + "/replicationProtectionContainers/" + global::System.Uri.EscapeDataString(protectionContainerName) - + "/replicationProtectedItems/" - + global::System.Uri.EscapeDataString(replicatedProtectedItemName) - + "/updateAppliance" + + "/remove" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -25636,25 +36440,20 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectedItemsUpdateAppliance_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectionContainersDelete_Call(request,onNoContent,eventListener,sender); } } - /// The operation to update appliance of an ASR replication protected item. + /// Operation to remove a protection container. /// - /// Appliance update protection input. - /// a delegate that is called when the remote service returns 200 (OK). + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationProtectionContainersDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -25662,10 +36461,10 @@ public partial class Migrate { // 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); + 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}/replicationProtectedItems/{replicatedProtectedItemName}/updateAppliance'"); + 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 @@ -25674,7 +36473,6 @@ public partial class Migrate 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/" @@ -25687,9 +36485,7 @@ public partial class Migrate + fabricName + "/replicationProtectionContainers/" + protectionContainerName - + "/replicationProtectedItems/" - + replicatedProtectedItemName - + "/updateAppliance" + + "/remove" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -25702,26 +36498,22 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectedItemsUpdateAppliance_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectionContainersDelete_Call(request,onNoContent,eventListener,sender); } } /// - /// Actual wire call for method. + /// Actual wire call for method. /// /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 200 (OK). + /// 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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task ReplicationProtectionContainersDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -25836,10 +36628,10 @@ public partial class Migrate switch ( _response.StatusCode ) { - case global::System.Net.HttpStatusCode.OK: + case global::System.Net.HttpStatusCode.NoContent: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ReplicationProtectedItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onNoContent(_response); break; } default: @@ -25859,21 +36651,19 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, - /// but you will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. - /// Protection container name. - /// Replication protected item name. - /// Appliance update protection input. + /// 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 ReplicationProtectedItemsUpdateAppliance_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IUpdateApplianceForReplicationProtectedItemInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationProtectionContainersDelete_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -25882,30 +36672,25 @@ public partial class Migrate 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 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. /// Azure Subscription Id in which migrate project was created. - /// 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. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IUpdateMobilityServiceRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationProtectionContainersDiscoverProtectableItem(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IDiscoverProtectableItemRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -25923,9 +36708,7 @@ public partial class Migrate + global::System.Uri.EscapeDataString(fabricName) + "/replicationProtectionContainers/" + global::System.Uri.EscapeDataString(protectionContainerName) - + "/replicationProtectedItems/" - + global::System.Uri.EscapeDataString(replicatedProtectedItemName) - + "/updateMobilityService" + + "/discoverProtectableItem" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -25943,23 +36726,22 @@ public partial class Migrate request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectedItemsUpdateMobilityService_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectionContainersDiscoverProtectableItem_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. + /// The operation to a add a protectable item to a protection container(Add physical server). /// /// - /// Request to update the mobility service on the protected item. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IUpdateMobilityServiceRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationProtectionContainersDiscoverProtectableItemViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IDiscoverProtectableItemRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -25967,10 +36749,10 @@ public partial class Migrate { // 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); + 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}/replicationProtectedItems/{replicatedProtectedItemName}/updateMobilityService'"); + 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 @@ -25979,7 +36761,6 @@ public partial class Migrate 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/" @@ -25992,9 +36773,7 @@ public partial class Migrate + fabricName + "/replicationProtectionContainers/" + protectionContainerName - + "/replicationProtectedItems/" - + replicatedProtectedItemName - + "/updateMobilityService" + + "/discoverProtectableItem" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -26012,12 +36791,12 @@ public partial class Migrate request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectedItemsUpdateMobilityService_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectionContainersDiscoverProtectableItem_Call(request,onOk,eventListener,sender); } } /// - /// Actual wire call for method. + /// Actual wire call for method. /// /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). @@ -26026,7 +36805,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -26039,7 +36818,7 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 + // declared final-state-via: default var _finalUri = _response.GetFirstHeader(@"Location"); var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); var location = _response.GetFirstHeader(@"Location"); @@ -26123,16 +36902,19 @@ public partial class Migrate 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.Migrate.Runtime.Method.Get); + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get); - // drop the old response - _response?.Dispose(); + // drop the old response + _response?.Dispose(); - // make the final call - _response = await sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - break; + // make the final call + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } } var _contentType = _response.Content.Headers.ContentType?.MediaType; @@ -26141,7 +36923,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ReplicationProtectedItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ProtectionContainer.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -26161,21 +36943,20 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual - /// call, but you will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// 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. + /// 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 ReplicationProtectedItemsUpdateMobilityService_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string replicatedProtectedItemName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IUpdateMobilityServiceRequest body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationProtectionContainersDiscoverProtectableItem_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IDiscoverProtectableItemRequest body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -26184,24 +36965,67 @@ public partial class Migrate 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. - /// + /// 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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. /// - /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IUpdateReplicationProtectedItemInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -26209,10 +37033,10 @@ public partial class Migrate { // 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); + 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}/replicationProtectedItems/{replicatedProtectedItemName}'"); + 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 @@ -26221,7 +37045,6 @@ public partial class Migrate 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/" @@ -26234,8 +37057,6 @@ public partial class Migrate + fabricName + "/replicationProtectionContainers/" + protectionContainerName - + "/replicationProtectedItems/" - + replicatedProtectedItemName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -26244,20 +37065,16 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectedItemsUpdate_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectionContainersGet_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -26265,7 +37082,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -26276,105 +37093,6 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - break; - } - } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -26382,7 +37100,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ReplicationProtectedItem.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ProtectionContainer.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -26402,21 +37120,19 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will - /// get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. /// 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.Migrate.Models.Api202301.IUpdateReplicationProtectedItemInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationProtectionContainersGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -26425,27 +37141,63 @@ public partial class Migrate 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. + /// 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. + /// Azure Subscription Id in which migrate project was created. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. /// Azure Subscription Id in which migrate project was created. /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.ICreateProtectionContainerMappingInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -26461,10 +37213,7 @@ public partial class Migrate + global::System.Uri.EscapeDataString(resourceName) + "/replicationFabrics/" + global::System.Uri.EscapeDataString(fabricName) - + "/replicationProtectionContainers/" - + global::System.Uri.EscapeDataString(protectionContainerName) - + "/replicationProtectionContainerMappings/" - + global::System.Uri.EscapeDataString(mappingName) + + "/replicationProtectionContainers" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -26473,29 +37222,149 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectionContainerMappingsCreate_Call(request,onOk,eventListener,sender); + 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ProtectionContainerCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } } } - /// The operation to create a protection container mapping. + /// + /// 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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.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. /// - /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.ICreateProtectionContainerMappingInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -26503,19 +37372,16 @@ public partial class Migrate { // 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); + 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}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}'"); + 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; - 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/" @@ -26524,12 +37390,7 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationFabrics/" - + fabricName - + "/replicationProtectionContainers/" - + protectionContainerName - + "/replicationProtectionContainerMappings/" - + mappingName + + "/replicationProtectionContainers" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -26538,22 +37399,16 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectionContainerMappingsCreate_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectionContainersList_Call(request,onOk,eventListener,sender); } } - /// - /// Actual wire call for method. - /// + /// 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. @@ -26561,7 +37416,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -26572,105 +37427,6 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - break; - } - } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -26678,7 +37434,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ProtectionContainerMapping.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ProtectionContainerCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -26698,50 +37454,42 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, - /// but you will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// 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.Migrate.Models.Api202301.ICreateProtectionContainerMappingInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationProtectionContainersList_Validate(string resourceName, string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. + /// Unique fabric name. /// Protection container name. - /// Protection container mapping name. - /// Removal input. - /// a delegate that is called when the remote service returns 204 (NoContent). + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IRemoveProtectionContainerMappingInput body, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationProtectionContainersSwitchProtection(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ISwitchProtectionInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -26759,9 +37507,7 @@ public partial class Migrate + global::System.Uri.EscapeDataString(fabricName) + "/replicationProtectionContainers/" + global::System.Uri.EscapeDataString(protectionContainerName) - + "/replicationProtectionContainerMappings/" - + global::System.Uri.EscapeDataString(mappingName) - + "/remove" + + "/switchprotection" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -26779,20 +37525,22 @@ public partial class Migrate request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectionContainerMappingsDelete_Call(request,onNoContent,eventListener,sender); + await this.ReplicationProtectionContainersSwitchProtection_Call(request,onOk,eventListener,sender); } } - /// The operation to delete or remove a protection container mapping. + /// + /// Operation to switch protection from one container to another or one replication provider to another. + /// /// - /// Removal input. - /// a delegate that is called when the remote service returns 204 (NoContent). + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IRemoveProtectionContainerMappingInput body, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationProtectionContainersSwitchProtectionViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ISwitchProtectionInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -26800,10 +37548,10 @@ public partial class Migrate { // 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); + 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}/replicationProtectionContainerMappings/{mappingName}/remove'"); + 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 @@ -26812,7 +37560,6 @@ public partial class Migrate 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/" @@ -26825,9 +37572,7 @@ public partial class Migrate + fabricName + "/replicationProtectionContainers/" + protectionContainerName - + "/replicationProtectionContainerMappings/" - + mappingName - + "/remove" + + "/switchprotection" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -26845,21 +37590,21 @@ public partial class Migrate request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectionContainerMappingsDelete_Call(request,onNoContent,eventListener,sender); + await this.ReplicationProtectionContainersSwitchProtection_Call(request,onOk,eventListener,sender); } } /// - /// Actual wire call for method. + /// Actual wire call for method. /// /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -26974,10 +37719,10 @@ public partial class Migrate switch ( _response.StatusCode ) { - case global::System.Net.HttpStatusCode.NoContent: + case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onNoContent(_response); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ProtectionContainer.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -26997,21 +37742,20 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, - /// but you will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. + /// Unique fabric name. /// Protection container name. - /// Protection container mapping name. - /// Removal input. + /// 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 ReplicationProtectionContainerMappingsDelete_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string mappingName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IRemoveProtectionContainerMappingInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationProtectionContainersSwitchProtection_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ISwitchProtectionInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -27020,26 +37764,24 @@ public partial class Migrate 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 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. - /// Protection container name. - /// Protection Container mapping name. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationProtectionIntentsCreate(string resourceName, string resourceGroupName, string subscriptionId, string intentObjectName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ICreateProtectionIntentInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -27053,12 +37795,8 @@ public partial class Migrate + 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) + + "/replicationProtectionIntents/" + + global::System.Uri.EscapeDataString(intentObjectName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -27067,24 +37805,29 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectionContainerMappingsGet_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectionIntentsCreate_Call(request,onOk,eventListener,sender); } } - /// Gets the details of a protection container mapping. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationProtectionIntentsCreateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ICreateProtectionIntentInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -27092,19 +37835,17 @@ public partial class Migrate { // 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); + 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}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}'"); + 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 fabricName = _match.Groups["fabricName"].Value; - var protectionContainerName = _match.Groups["protectionContainerName"].Value; - var mappingName = _match.Groups["mappingName"].Value; + var intentObjectName = _match.Groups["intentObjectName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -27113,12 +37854,8 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationFabrics/" - + fabricName - + "/replicationProtectionContainers/" - + protectionContainerName - + "/replicationProtectionContainerMappings/" - + mappingName + + "/replicationProtectionIntents/" + + intentObjectName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -27127,18 +37864,20 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectionContainerMappingsGet_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectionIntentsCreate_Call(request,onOk,eventListener,sender); } } - /// - /// Actual wire call for method. - /// + /// 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. @@ -27146,7 +37885,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -27164,7 +37903,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ProtectionContainerMapping.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ReplicationProtectionIntent.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -27184,253 +37923,76 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, - /// but you will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// 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.Migrate.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. - /// Azure Subscription Id in which migrate project was created. - /// a delegate that is called when the remote service returns 200 (OK). - /// an instance that will receive events. - /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - // generate request object - var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. - /// Azure Subscription Id in which migrate project was created. - /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - // generate request object - var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - // generate request object - var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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). + /// A name for the replication protection item. + /// Create Protection Intent Input. /// an instance that will receive events. - /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task ReplicationProtectionIntentsCreate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string intentObjectName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ICreateProtectionIntentInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) - { - global::System.Net.Http.HttpResponseMessage _response = null; - try - { - var sendTask = sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } - _response = await sendTask; - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ProtectionContainerMappingCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - default: - { - throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); - } - } - } - finally - { - // finally statements - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Finally, request, _response); - _response?.Dispose(); - request?.Dispose(); - } + { + 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); } } - /// - /// Validation method for method. - /// Call this like the actual call, but you will get validation events back. - /// + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. - /// Protection container name. + /// 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.Migrate.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_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { + var apiVersion = @"2023-01-01"; + // Constant Parameters 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); + // 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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationProtectionIntentsGet_Call(request,onOk,eventListener,sender); } } - /// Lists the protection container mappings in the vault. + /// 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. @@ -27438,7 +38000,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -27446,16 +38008,17 @@ public partial class Migrate { // 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); + 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}/replicationProtectionContainerMappings'"); + 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/" @@ -27464,7 +38027,8 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationProtectionContainerMappings" + + "/replicationProtectionIntents/" + + intentObjectName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -27478,13 +38042,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectionContainerMappingsList_Call(request,onOk,eventListener,sender); + await this.ReplicationProtectionIntentsGet_Call(request,onOk,eventListener,sender); } } - /// - /// Actual wire call for method. - /// + /// 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. @@ -27492,7 +38054,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -27510,7 +38072,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ProtectionContainerMappingCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ReplicationProtectionIntent.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -27530,40 +38092,41 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, - /// but you will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. + /// 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 ReplicationProtectionContainerMappingsList_Validate(string resourceName, string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationProtectionIntentsGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string intentObjectName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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); } } - /// The operation to purge(force delete) a protection container mapping. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. - /// Protection container name. - /// Protection container mapping name. - /// a delegate that is called when the remote service returns 204 (NoContent). + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -27577,38 +38140,39 @@ public partial class Migrate + 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) + + "/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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectionContainerMappingsPurge_Call(request,onNoContent,eventListener,sender); + await this.ReplicationProtectionIntentsList_Call(request,onOk,eventListener,sender); } } - /// The operation to purge(force delete) a protection container mapping. + /// Gets the list of ASR replication protection intent objects in the vault. /// - /// a delegate that is called when the remote service returns 204 (NoContent). + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -27616,19 +38180,16 @@ public partial class Migrate { // 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); + 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}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}'"); + 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; - 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/" @@ -27637,40 +38198,37 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationFabrics/" - + fabricName - + "/replicationProtectionContainers/" - + protectionContainerName - + "/replicationProtectionContainerMappings/" - + mappingName + + "/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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectionContainerMappingsPurge_Call(request,onNoContent,eventListener,sender); + await this.ReplicationProtectionIntentsList_Call(request,onOk,eventListener,sender); } } - /// - /// Actual wire call for method. - /// + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -27681,114 +38239,14 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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: + case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onNoContent(_response); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ReplicationProtectionIntentCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -27808,47 +38266,43 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, - /// but you will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. - /// Protection container name. - /// Protection container mapping name. + /// 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 ReplicationProtectionContainerMappingsPurge_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string mappingName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationProtectionIntentsList_Validate(string resourceName, string resourceGroupName, string subscriptionId, string skipToken, string takeToken, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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(skipToken),skipToken); + await eventListener.AssertNotNull(nameof(takeToken),takeToken); } } - /// The operation to update protection container mapping. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. - /// Protection container name. - /// Protection container mapping name. - /// Mapping update input. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IUpdateProtectionContainerMappingInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationRecoveryPlansCreate(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ICreateRecoveryPlanInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -27862,12 +38316,8 @@ public partial class Migrate + 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) + + "/replicationRecoveryPlans/" + + global::System.Uri.EscapeDataString(recoveryPlanName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -27876,7 +38326,7 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -27885,20 +38335,20 @@ public partial class Migrate request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectionContainerMappingsUpdate_Call(request,onOk,eventListener,sender); + await this.ReplicationRecoveryPlansCreate_Call(request,onOk,eventListener,sender); } } - /// The operation to update protection container mapping. + /// The operation to create a recovery plan. /// - /// Mapping update input. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IUpdateProtectionContainerMappingInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationRecoveryPlansCreateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ICreateRecoveryPlanInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -27906,19 +38356,17 @@ public partial class Migrate { // 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); + 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}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}'"); + 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 fabricName = _match.Groups["fabricName"].Value; - var protectionContainerName = _match.Groups["protectionContainerName"].Value; - var mappingName = _match.Groups["mappingName"].Value; + var recoveryPlanName = _match.Groups["recoveryPlanName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -27927,12 +38375,8 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationFabrics/" - + fabricName - + "/replicationProtectionContainers/" - + protectionContainerName - + "/replicationProtectionContainerMappings/" - + mappingName + + "/replicationRecoveryPlans/" + + recoveryPlanName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -27941,7 +38385,7 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -27950,13 +38394,11 @@ public partial class Migrate request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectionContainerMappingsUpdate_Call(request,onOk,eventListener,sender); + await this.ReplicationRecoveryPlansCreate_Call(request,onOk,eventListener,sender); } } - /// - /// Actual wire call for method. - /// + /// 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. @@ -27964,7 +38406,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -28081,7 +38523,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ProtectionContainerMapping.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.RecoveryPlan.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -28101,49 +38543,43 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, - /// but you will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. - /// Protection container name. - /// Protection container mapping name. - /// Mapping update input. + /// 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 ReplicationProtectionContainerMappingsUpdate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, string mappingName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IUpdateProtectionContainerMappingInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationRecoveryPlansCreate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ICreateRecoveryPlanInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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(recoveryPlanName),recoveryPlanName); await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// Operation to create a protection container. + /// Delete a recovery plan. /// The name of the recovery services vault. /// The name of the resource group where the recovery services vault is present. /// Azure Subscription Id in which migrate project was created. - /// Unique fabric ARM name. - /// Unique protection container ARM name. - /// Creation input. - /// a delegate that is called when the remote service returns 200 (OK). + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.ICreateProtectionContainerInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationRecoveryPlansDelete(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -28157,10 +38593,8 @@ public partial class Migrate + 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) + + "/replicationRecoveryPlans/" + + global::System.Uri.EscapeDataString(recoveryPlanName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -28169,29 +38603,24 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectionContainersCreate_Call(request,onOk,eventListener,sender); + await this.ReplicationRecoveryPlansDelete_Call(request,onNoContent,eventListener,sender); } } - /// Operation to create a protection container. + /// Delete a recovery plan. /// - /// Creation input. - /// a delegate that is called when the remote service returns 200 (OK). + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.ICreateProtectionContainerInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationRecoveryPlansDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -28199,18 +38628,17 @@ public partial class Migrate { // 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); + 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}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}'"); + 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 fabricName = _match.Groups["fabricName"].Value; - var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var recoveryPlanName = _match.Groups["recoveryPlanName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -28219,10 +38647,8 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationFabrics/" - + fabricName - + "/replicationProtectionContainers/" - + protectionContainerName + + "/replicationRecoveryPlans/" + + recoveryPlanName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -28231,30 +38657,24 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectionContainersCreate_Call(request,onOk,eventListener,sender); + await this.ReplicationRecoveryPlansDelete_Call(request,onNoContent,eventListener,sender); } } - /// - /// Actual wire call for method. - /// + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 200 (OK). + /// 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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task ReplicationRecoveryPlansDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -28268,6 +38688,7 @@ public partial class Migrate // 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 ) @@ -28350,10 +38771,10 @@ public partial class Migrate continue; } // we are done polling, do a request on final target? - if (!string.IsNullOrWhiteSpace(_originalUri)) + if (!string.IsNullOrWhiteSpace(_finalUri)) { // create a new request with the final uri - request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get); + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get); // drop the old response _response?.Dispose(); @@ -28368,10 +38789,10 @@ public partial class Migrate switch ( _response.StatusCode ) { - case global::System.Net.HttpStatusCode.OK: + case global::System.Net.HttpStatusCode.NoContent: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ProtectionContainer.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onNoContent(_response); break; } default: @@ -28391,46 +38812,40 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but - /// you will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Unique fabric ARM name. - /// Unique protection container ARM name. - /// Creation input. + /// 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 ReplicationProtectionContainersCreate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ICreateProtectionContainerInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationRecoveryPlansDelete_Validate(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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); + await eventListener.AssertNotNull(nameof(recoveryPlanName),recoveryPlanName); } } - /// Operation to remove a protection container. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Unique fabric ARM name. - /// Unique protection container ARM name. - /// a delegate that is called when the remote service returns 204 (NoContent). + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -28444,11 +38859,9 @@ public partial class Migrate + 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" + + "/replicationRecoveryPlans/" + + global::System.Uri.EscapeDataString(recoveryPlanName) + + "/failoverCancel" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -28462,19 +38875,19 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectionContainersDelete_Call(request,onNoContent,eventListener,sender); + await this.ReplicationRecoveryPlansFailoverCancel_Call(request,onOk,eventListener,sender); } } - /// Operation to remove a protection container. + /// The operation to cancel the failover of a recovery plan. /// - /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -28482,18 +38895,17 @@ public partial class Migrate { // 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); + 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}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/remove'"); + 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 fabricName = _match.Groups["fabricName"].Value; - var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var recoveryPlanName = _match.Groups["recoveryPlanName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -28502,11 +38914,9 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationFabrics/" - + fabricName - + "/replicationProtectionContainers/" - + protectionContainerName - + "/remove" + + "/replicationRecoveryPlans/" + + recoveryPlanName + + "/failoverCancel" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -28520,21 +38930,21 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectionContainersDelete_Call(request,onNoContent,eventListener,sender); + await this.ReplicationRecoveryPlansFailoverCancel_Call(request,onOk,eventListener,sender); } } /// - /// Actual wire call for method. + /// Actual wire call for method. /// /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -28649,10 +39059,10 @@ public partial class Migrate switch ( _response.StatusCode ) { - case global::System.Net.HttpStatusCode.NoContent: + case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onNoContent(_response); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.RecoveryPlan.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -28672,46 +39082,40 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Unique fabric ARM name. - /// Unique protection container ARM name. + /// 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 ReplicationProtectionContainersDelete_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationRecoveryPlansFailoverCancel_Validate(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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(recoveryPlanName),recoveryPlanName); } } - /// - /// The operation to a add a protectable item to a protection container(Add physical server). - /// + /// 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. /// Azure Subscription Id in which migrate project was created. - /// The name of the fabric. - /// The name of the protection container. - /// The request object to add a protectable item. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IDiscoverProtectableItemRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -28725,11 +39129,9 @@ public partial class Migrate + 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" + + "/replicationRecoveryPlans/" + + global::System.Uri.EscapeDataString(recoveryPlanName) + + "/failoverCommit" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -28742,27 +39144,20 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectionContainersDiscoverProtectableItem_Call(request,onOk,eventListener,sender); + await this.ReplicationRecoveryPlansFailoverCommit_Call(request,onOk,eventListener,sender); } } - /// - /// The operation to a add a protectable item to a protection container(Add physical server). - /// + /// The operation to commit the failover of a recovery plan. /// - /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IDiscoverProtectableItemRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -28770,18 +39165,17 @@ public partial class Migrate { // 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); + 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}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/discoverProtectableItem'"); + 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 fabricName = _match.Groups["fabricName"].Value; - var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var recoveryPlanName = _match.Groups["recoveryPlanName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -28790,11 +39184,9 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationFabrics/" - + fabricName - + "/replicationProtectionContainers/" - + protectionContainerName - + "/discoverProtectableItem" + + "/replicationRecoveryPlans/" + + recoveryPlanName + + "/failoverCommit" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -28807,17 +39199,13 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectionContainersDiscoverProtectableItem_Call(request,onOk,eventListener,sender); + await this.ReplicationRecoveryPlansFailoverCommit_Call(request,onOk,eventListener,sender); } } /// - /// Actual wire call for method. + /// Actual wire call for method. /// /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). @@ -28826,7 +39214,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -28944,7 +39332,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ProtectionContainer.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.RecoveryPlan.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -28964,46 +39352,40 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the - /// actual call, but you will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// The name of the fabric. - /// The name of the protection container. - /// The request object to add a protectable item. + /// 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 ReplicationProtectionContainersDiscoverProtectableItem_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IDiscoverProtectableItemRequest body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationRecoveryPlansFailoverCommit_Validate(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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); + await eventListener.AssertNotNull(nameof(recoveryPlanName),recoveryPlanName); } } - /// Gets the details of a protection container. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. - /// Protection container name. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -29017,10 +39399,8 @@ public partial class Migrate + 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) + + "/replicationRecoveryPlans/" + + global::System.Uri.EscapeDataString(recoveryPlanName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -29034,11 +39414,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectionContainersGet_Call(request,onOk,eventListener,sender); + await this.ReplicationRecoveryPlansGet_Call(request,onOk,eventListener,sender); } } - /// Gets the details of a protection container. + /// 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. @@ -29046,7 +39426,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -29054,18 +39434,17 @@ public partial class Migrate { // 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); + 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}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}'"); + 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 fabricName = _match.Groups["fabricName"].Value; - var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var recoveryPlanName = _match.Groups["recoveryPlanName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -29074,10 +39453,8 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationFabrics/" - + fabricName - + "/replicationProtectionContainers/" - + protectionContainerName + + "/replicationRecoveryPlans/" + + recoveryPlanName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -29091,11 +39468,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectionContainersGet_Call(request,onOk,eventListener,sender); + await this.ReplicationRecoveryPlansGet_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -29103,7 +39480,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -29121,7 +39498,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ProtectionContainer.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.RecoveryPlan.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -29141,84 +39518,39 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you - /// will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. - /// Protection container name. + /// 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 ReplicationProtectionContainersGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationRecoveryPlansGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. - /// Azure Subscription Id in which migrate project was created. - /// a delegate that is called when the remote service returns 200 (OK). - /// an instance that will receive events. - /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - // generate request object - var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } - // make the call - await this.ReplicationProtectionContainersList_Call(request,onOk,eventListener,sender); + await eventListener.AssertNotNull(nameof(recoveryPlanName),recoveryPlanName); } } - /// Lists the protection containers in the specified fabric. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -29232,64 +39564,7 @@ public partial class Migrate + 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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - // generate request object - var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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" + + "/replicationRecoveryPlans" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -29303,81 +39578,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } - _response = await sendTask; - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ProtectionContainerCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - default: - { - throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); - } - } - } - finally - { - // finally statements - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. - /// Azure Subscription Id in which migrate project was created. - /// 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.Migrate.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 this.ReplicationRecoveryPlansList_Call(request,onOk,eventListener,sender); } } - /// Lists the protection containers in a vault. + /// 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. @@ -29385,7 +39590,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -29393,10 +39598,10 @@ public partial class Migrate { // 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); + 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}/replicationProtectionContainers'"); + 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 @@ -29411,7 +39616,7 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationProtectionContainers" + + "/replicationRecoveryPlans" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -29425,11 +39630,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectionContainersList_Call(request,onOk,eventListener,sender); + await this.ReplicationRecoveryPlansList_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -29437,7 +39642,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -29455,7 +39660,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ProtectionContainerCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.RecoveryPlanCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -29475,8 +39680,8 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you - /// will get validation events back. + /// 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. @@ -29485,7 +39690,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationRecoveryPlansList_Validate(string resourceName, string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -29495,22 +39700,19 @@ public partial class Migrate } } - /// - /// Operation to switch protection from one container to another or one replication provider to another. - /// + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Unique fabric name. - /// Protection container name. - /// Switch protection input. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.ISwitchProtectionInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationRecoveryPlansPlannedFailover(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IRecoveryPlanPlannedFailoverInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -29524,11 +39726,9 @@ public partial class Migrate + 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" + + "/replicationRecoveryPlans/" + + global::System.Uri.EscapeDataString(recoveryPlanName) + + "/plannedFailover" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -29546,22 +39746,20 @@ public partial class Migrate request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectionContainersSwitchProtection_Call(request,onOk,eventListener,sender); + await this.ReplicationRecoveryPlansPlannedFailover_Call(request,onOk,eventListener,sender); } } - /// - /// Operation to switch protection from one container to another or one replication provider to another. - /// + /// The operation to start the planned failover of a recovery plan. /// - /// Switch protection input. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.ISwitchProtectionInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationRecoveryPlansPlannedFailoverViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IRecoveryPlanPlannedFailoverInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -29569,18 +39767,17 @@ public partial class Migrate { // 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); + 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}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/switchprotection'"); + 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 fabricName = _match.Groups["fabricName"].Value; - var protectionContainerName = _match.Groups["protectionContainerName"].Value; + var recoveryPlanName = _match.Groups["recoveryPlanName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -29589,11 +39786,9 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationFabrics/" - + fabricName - + "/replicationProtectionContainers/" - + protectionContainerName - + "/switchprotection" + + "/replicationRecoveryPlans/" + + recoveryPlanName + + "/plannedFailover" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -29611,12 +39806,12 @@ public partial class Migrate request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectionContainersSwitchProtection_Call(request,onOk,eventListener,sender); + await this.ReplicationRecoveryPlansPlannedFailover_Call(request,onOk,eventListener,sender); } } /// - /// Actual wire call for method. + /// Actual wire call for method. /// /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). @@ -29625,7 +39820,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -29743,7 +39938,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ProtectionContainer.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.RecoveryPlan.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -29763,46 +39958,43 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual - /// call, but you will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Unique fabric name. - /// Protection container name. - /// Switch protection input. + /// 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 ReplicationProtectionContainersSwitchProtection_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string protectionContainerName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ISwitchProtectionInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationRecoveryPlansPlannedFailover_Validate(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IRecoveryPlanPlannedFailoverInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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(recoveryPlanName),recoveryPlanName); await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// The operation to create an ASR replication protection intent item. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// A name for the replication protection item. - /// Create Protection Intent Input. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.ICreateProtectionIntentInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -29816,8 +40008,9 @@ public partial class Migrate + global::System.Uri.EscapeDataString(resourceGroupName) + "/providers/Microsoft.RecoveryServices/vaults/" + global::System.Uri.EscapeDataString(resourceName) - + "/replicationProtectionIntents/" - + global::System.Uri.EscapeDataString(intentObjectName) + + "/replicationRecoveryPlans/" + + global::System.Uri.EscapeDataString(recoveryPlanName) + + "/reProtect" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -29826,29 +40019,24 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectionIntentsCreate_Call(request,onOk,eventListener,sender); + await this.ReplicationRecoveryPlansReprotect_Call(request,onOk,eventListener,sender); } } - /// The operation to create an ASR replication protection intent item. + /// The operation to reprotect(reverse replicate) a recovery plan. /// - /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.ICreateProtectionIntentInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -29856,17 +40044,17 @@ public partial class Migrate { // 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); + 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}/replicationProtectionIntents/{intentObjectName}'"); + 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 intentObjectName = _match.Groups["intentObjectName"].Value; + var recoveryPlanName = _match.Groups["recoveryPlanName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -29875,8 +40063,9 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationProtectionIntents/" - + intentObjectName + + "/replicationRecoveryPlans/" + + recoveryPlanName + + "/reProtect" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -29885,38 +40074,134 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectionIntentsCreate_Call(request,onOk,eventListener,sender); + 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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } - _response = await sendTask; - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + /// 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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -29924,7 +40209,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ReplicationProtectionIntent.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.RecoveryPlan.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -29944,43 +40229,41 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you + /// 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. /// Azure Subscription Id in which migrate project was created. - /// A name for the replication protection item. - /// Create Protection Intent Input. + /// 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 ReplicationProtectionIntentsCreate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string intentObjectName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ICreateProtectionIntentInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationRecoveryPlansReprotect_Validate(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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); + await eventListener.AssertNotNull(nameof(recoveryPlanName),recoveryPlanName); } } - /// Gets the details of an ASR replication protection intent. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Replication protection intent name. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationRecoveryPlansTestFailover(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IRecoveryPlanTestFailoverInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -29994,8 +40277,9 @@ public partial class Migrate + global::System.Uri.EscapeDataString(resourceGroupName) + "/providers/Microsoft.RecoveryServices/vaults/" + global::System.Uri.EscapeDataString(resourceName) - + "/replicationProtectionIntents/" - + global::System.Uri.EscapeDataString(intentObjectName) + + "/replicationRecoveryPlans/" + + global::System.Uri.EscapeDataString(recoveryPlanName) + + "/testFailover" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -30004,24 +40288,79 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IRecoveryPlanTestFailoverCleanupInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectionIntentsGet_Call(request,onOk,eventListener,sender); + await this.ReplicationRecoveryPlansTestFailoverCleanup_Call(request,onOk,eventListener,sender); } } - /// Gets the details of an ASR replication protection intent. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationRecoveryPlansTestFailoverCleanupViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IRecoveryPlanTestFailoverCleanupInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -30029,17 +40368,17 @@ public partial class Migrate { // 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); + 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}/replicationProtectionIntents/{intentObjectName}'"); + 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 intentObjectName = _match.Groups["intentObjectName"].Value; + var recoveryPlanName = _match.Groups["recoveryPlanName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -30048,8 +40387,9 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationProtectionIntents/" - + intentObjectName + + "/replicationRecoveryPlans/" + + recoveryPlanName + + "/testFailoverCleanup" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -30058,16 +40398,22 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectionIntentsGet_Call(request,onOk,eventListener,sender); + await this.ReplicationRecoveryPlansTestFailoverCleanup_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// + /// 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. @@ -30075,7 +40421,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -30086,6 +40432,106 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -30093,7 +40539,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ReplicationProtectionIntent.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.RecoveryPlan.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -30113,87 +40559,41 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will - /// get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Replication protection intent name. + /// 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 ReplicationProtectionIntentsGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string intentObjectName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationRecoveryPlansTestFailoverCleanup_Validate(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IRecoveryPlanTestFailoverCleanupInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. - /// Azure Subscription Id in which migrate project was created. - /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - // generate request object - var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } - // make the call - await this.ReplicationProtectionIntentsList_Call(request,onOk,eventListener,sender); + await eventListener.AssertNotNull(nameof(recoveryPlanName),recoveryPlanName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// Gets the list of ASR replication protection intent objects in the vault. + /// The operation to start the test failover of a recovery plan. /// - /// The pagination token. - /// The page size. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationRecoveryPlansTestFailoverViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IRecoveryPlanTestFailoverInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -30201,16 +40601,17 @@ public partial class Migrate { // 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); + 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}/replicationProtectionIntents'"); + 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/" @@ -30219,29 +40620,33 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationProtectionIntents" + + "/replicationRecoveryPlans/" + + recoveryPlanName + + "/testFailover" + "?" + "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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationProtectionIntentsList_Call(request,onOk,eventListener,sender); + await this.ReplicationRecoveryPlansTestFailover_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// + /// 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. @@ -30249,7 +40654,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -30260,6 +40665,106 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -30267,7 +40772,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ReplicationProtectionIntentCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.RecoveryPlan.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -30287,43 +40792,44 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you - /// will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// The pagination token. - /// The page size. + /// 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 ReplicationProtectionIntentsList_Validate(string resourceName, string resourceGroupName, string subscriptionId, string skipToken, string takeToken, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationRecoveryPlansTestFailover_Validate(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IRecoveryPlanTestFailoverInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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(recoveryPlanName),recoveryPlanName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// The operation to create a recovery plan. + /// 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. /// Azure Subscription Id in which migrate project was created. /// Recovery plan name. - /// Recovery Plan creation input. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.ICreateRecoveryPlanInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationRecoveryPlansUnplannedFailover(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IRecoveryPlanUnplannedFailoverInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -30339,6 +40845,7 @@ public partial class Migrate + global::System.Uri.EscapeDataString(resourceName) + "/replicationRecoveryPlans/" + global::System.Uri.EscapeDataString(recoveryPlanName) + + "/unplannedFailover" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -30347,7 +40854,7 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -30356,20 +40863,20 @@ public partial class Migrate request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationRecoveryPlansCreate_Call(request,onOk,eventListener,sender); + await this.ReplicationRecoveryPlansUnplannedFailover_Call(request,onOk,eventListener,sender); } } - /// The operation to create a recovery plan. + /// The operation to start the unplanned failover of a recovery plan. /// - /// Recovery Plan creation input. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.ICreateRecoveryPlanInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationRecoveryPlansUnplannedFailoverViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IRecoveryPlanUnplannedFailoverInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -30377,10 +40884,10 @@ public partial class Migrate { // 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); + 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}'"); + 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 @@ -30398,6 +40905,7 @@ public partial class Migrate + resourceName + "/replicationRecoveryPlans/" + recoveryPlanName + + "/unplannedFailover" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -30406,7 +40914,7 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -30415,11 +40923,13 @@ public partial class Migrate request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationRecoveryPlansCreate_Call(request,onOk,eventListener,sender); + await this.ReplicationRecoveryPlansUnplannedFailover_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// + /// 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. @@ -30427,7 +40937,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -30441,6 +40951,7 @@ public partial class Migrate // 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 ) @@ -30523,10 +41034,10 @@ public partial class Migrate continue; } // we are done polling, do a request on final target? - if (!string.IsNullOrWhiteSpace(_originalUri)) + if (!string.IsNullOrWhiteSpace(_finalUri)) { // create a new request with the final uri - request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get); + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get); // drop the old response _response?.Dispose(); @@ -30564,19 +41075,19 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will - /// get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. /// Recovery plan name. - /// Recovery Plan creation input. + /// 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 ReplicationRecoveryPlansCreate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.ICreateRecoveryPlanInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationRecoveryPlansUnplannedFailover_Validate(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IRecoveryPlanUnplannedFailoverInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -30589,18 +41100,19 @@ public partial class Migrate } } - /// Delete a recovery plan. + /// 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. /// Azure Subscription Id in which migrate project was created. /// Recovery plan name. - /// a delegate that is called when the remote service returns 204 (NoContent). + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationRecoveryPlansUpdate(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IUpdateRecoveryPlanInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -30624,24 +41136,29 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationRecoveryPlansDelete_Call(request,onNoContent,eventListener,sender); + await this.ReplicationRecoveryPlansUpdate_Call(request,onOk,eventListener,sender); } } - /// Delete a recovery plan. + /// The operation to update a recovery plan. /// - /// a delegate that is called when the remote service returns 204 (NoContent). + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationRecoveryPlansUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IUpdateRecoveryPlanInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -30678,24 +41195,28 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationRecoveryPlansDelete_Call(request,onNoContent,eventListener,sender); + await this.ReplicationRecoveryPlansUpdate_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -30709,7 +41230,6 @@ public partial class Migrate // 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 ) @@ -30792,10 +41312,10 @@ public partial class Migrate continue; } // we are done polling, do a request on final target? - if (!string.IsNullOrWhiteSpace(_finalUri)) + if (!string.IsNullOrWhiteSpace(_originalUri)) { // create a new request with the final uri - request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get); + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get); // drop the old response _response?.Dispose(); @@ -30810,10 +41330,10 @@ public partial class Migrate switch ( _response.StatusCode ) { - case global::System.Net.HttpStatusCode.NoContent: + case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onNoContent(_response); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.RecoveryPlan.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -30833,18 +41353,19 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will + /// 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. /// Azure Subscription Id in which migrate project was created. /// 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 ReplicationRecoveryPlansDelete_Validate(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationRecoveryPlansUpdate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IUpdateRecoveryPlanInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -30852,21 +41373,25 @@ public partial class Migrate 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 cancel the failover of a recovery plan. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Recovery plan name. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationRecoveryServicesProvidersCreate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string providerName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IAddRecoveryServicesProviderInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -30880,9 +41405,10 @@ public partial class Migrate + global::System.Uri.EscapeDataString(resourceGroupName) + "/providers/Microsoft.RecoveryServices/vaults/" + global::System.Uri.EscapeDataString(resourceName) - + "/replicationRecoveryPlans/" - + global::System.Uri.EscapeDataString(recoveryPlanName) - + "/failoverCancel" + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationRecoveryServicesProviders/" + + global::System.Uri.EscapeDataString(providerName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -30891,24 +41417,29 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationRecoveryPlansFailoverCancel_Call(request,onOk,eventListener,sender); + await this.ReplicationRecoveryServicesProvidersCreate_Call(request,onOk,eventListener,sender); } } - /// The operation to cancel the failover of a recovery plan. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationRecoveryServicesProvidersCreateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IAddRecoveryServicesProviderInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -30916,17 +41447,18 @@ public partial class Migrate { // 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); + 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}/replicationRecoveryPlans/{recoveryPlanName}/failoverCancel'"); + 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 recoveryPlanName = _match.Groups["recoveryPlanName"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var providerName = _match.Groups["providerName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -30935,9 +41467,10 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationRecoveryPlans/" - + recoveryPlanName - + "/failoverCancel" + + "/replicationFabrics/" + + fabricName + + "/replicationRecoveryServicesProviders/" + + providerName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -30946,17 +41479,21 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationRecoveryPlansFailoverCancel_Call(request,onOk,eventListener,sender); + await this.ReplicationRecoveryServicesProvidersCreate_Call(request,onOk,eventListener,sender); } } /// - /// Actual wire call for method. + /// Actual wire call for method. /// /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). @@ -30965,7 +41502,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -30979,7 +41516,6 @@ public partial class Migrate // 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 ) @@ -31062,10 +41598,10 @@ public partial class Migrate continue; } // we are done polling, do a request on final target? - if (!string.IsNullOrWhiteSpace(_finalUri)) + if (!string.IsNullOrWhiteSpace(_originalUri)) { // create a new request with the final uri - request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get); + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get); // drop the old response _response?.Dispose(); @@ -31083,7 +41619,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.RecoveryPlan.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.RecoveryServicesProvider.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -31103,40 +41639,48 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but - /// you will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Recovery plan name. + /// 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 ReplicationRecoveryPlansFailoverCancel_Validate(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationRecoveryServicesProvidersCreate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string providerName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IAddRecoveryServicesProviderInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(providerName),providerName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// The operation to commit the failover of a recovery plan. + /// + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Recovery plan name. - /// a delegate that is called when the remote service returns 200 (OK). + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -31150,9 +41694,11 @@ public partial class Migrate + global::System.Uri.EscapeDataString(resourceGroupName) + "/providers/Microsoft.RecoveryServices/vaults/" + global::System.Uri.EscapeDataString(resourceName) - + "/replicationRecoveryPlans/" - + global::System.Uri.EscapeDataString(recoveryPlanName) - + "/failoverCommit" + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationRecoveryServicesProviders/" + + global::System.Uri.EscapeDataString(providerName) + + "/remove" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -31166,19 +41712,21 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationRecoveryPlansFailoverCommit_Call(request,onOk,eventListener,sender); + await this.ReplicationRecoveryServicesProvidersDelete_Call(request,onNoContent,eventListener,sender); } } - /// The operation to commit the failover of a recovery plan. + /// + /// The operation to removes/delete(unregister) a recovery services provider from the vault. + /// /// - /// a delegate that is called when the remote service returns 200 (OK). + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationRecoveryServicesProvidersDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -31186,17 +41734,18 @@ public partial class Migrate { // 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); + 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}/replicationRecoveryPlans/{recoveryPlanName}/failoverCommit'"); + 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 recoveryPlanName = _match.Groups["recoveryPlanName"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var providerName = _match.Groups["providerName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -31205,9 +41754,11 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationRecoveryPlans/" - + recoveryPlanName - + "/failoverCommit" + + "/replicationFabrics/" + + fabricName + + "/replicationRecoveryServicesProviders/" + + providerName + + "/remove" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -31221,21 +41772,21 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationRecoveryPlansFailoverCommit_Call(request,onOk,eventListener,sender); + await this.ReplicationRecoveryServicesProvidersDelete_Call(request,onNoContent,eventListener,sender); } } /// - /// Actual wire call for method. + /// Actual wire call for method. /// /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 200 (OK). + /// 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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task ReplicationRecoveryServicesProvidersDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -31350,10 +41901,10 @@ public partial class Migrate switch ( _response.StatusCode ) { - case global::System.Net.HttpStatusCode.OK: + case global::System.Net.HttpStatusCode.NoContent: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.RecoveryPlan.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onNoContent(_response); break; } default: @@ -31373,40 +41924,43 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but - /// you will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Recovery plan name. + /// 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 ReplicationRecoveryPlansFailoverCommit_Validate(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationRecoveryServicesProvidersDelete_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string providerName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(providerName),providerName); } } - /// Gets the details of the recovery plan. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Name of the recovery plan. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -31420,8 +41974,10 @@ public partial class Migrate + global::System.Uri.EscapeDataString(resourceGroupName) + "/providers/Microsoft.RecoveryServices/vaults/" + global::System.Uri.EscapeDataString(resourceName) - + "/replicationRecoveryPlans/" - + global::System.Uri.EscapeDataString(recoveryPlanName) + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationRecoveryServicesProviders/" + + global::System.Uri.EscapeDataString(providerName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -31435,11 +41991,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationRecoveryPlansGet_Call(request,onOk,eventListener,sender); + await this.ReplicationRecoveryServicesProvidersGet_Call(request,onOk,eventListener,sender); } } - /// Gets the details of the recovery plan. + /// 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. @@ -31447,7 +42003,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -31455,17 +42011,18 @@ public partial class Migrate { // 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); + 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}/replicationRecoveryPlans/{recoveryPlanName}'"); + 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 recoveryPlanName = _match.Groups["recoveryPlanName"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var providerName = _match.Groups["providerName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -31474,8 +42031,10 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationRecoveryPlans/" - + recoveryPlanName + + "/replicationFabrics/" + + fabricName + + "/replicationRecoveryServicesProviders/" + + providerName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -31489,11 +42048,13 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationRecoveryPlansGet_Call(request,onOk,eventListener,sender); + await this.ReplicationRecoveryServicesProvidersGet_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// + /// 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. @@ -31501,7 +42062,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -31519,7 +42080,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.RecoveryPlan.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.RecoveryServicesProvider.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -31539,39 +42100,84 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will - /// get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Name of the recovery plan. + /// 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 ReplicationRecoveryPlansGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationRecoveryServicesProvidersGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string providerName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// Azure Subscription Id in which migrate project was created. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { + var apiVersion = @"2023-01-01"; + // Constant Parameters 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); + // 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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.ReplicationRecoveryServicesProvidersList_Call(request,onOk,eventListener,sender); } } - /// Lists the recovery plans in the vault. + /// 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. /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -31585,7 +42191,9 @@ public partial class Migrate + global::System.Uri.EscapeDataString(resourceGroupName) + "/providers/Microsoft.RecoveryServices/vaults/" + global::System.Uri.EscapeDataString(resourceName) - + "/replicationRecoveryPlans" + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationRecoveryServicesProviders" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -31599,11 +42207,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationRecoveryPlansList_Call(request,onOk,eventListener,sender); + await this.ReplicationRecoveryServicesProvidersListByReplicationFabrics_Call(request,onOk,eventListener,sender); } } - /// Lists the recovery plans in the vault. + /// 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. @@ -31611,7 +42219,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -31619,16 +42227,17 @@ public partial class Migrate { // 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); + 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}/replicationRecoveryPlans'"); + 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/" @@ -31637,7 +42246,9 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationRecoveryPlans" + + "/replicationFabrics/" + + fabricName + + "/replicationRecoveryServicesProviders" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -31651,11 +42262,13 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationRecoveryPlansList_Call(request,onOk,eventListener,sender); + await this.ReplicationRecoveryServicesProvidersListByReplicationFabrics_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// + /// 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. @@ -31663,7 +42276,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -31681,7 +42294,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.RecoveryPlanCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.RecoveryServicesProviderCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -31701,86 +42314,37 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will - /// get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. + /// 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 ReplicationRecoveryPlansList_Validate(string resourceName, string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationRecoveryServicesProvidersListByReplicationFabrics_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 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. - /// Azure Subscription Id in which migrate project was created. - /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IRecoveryPlanPlannedFailoverInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - // generate request object - var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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. + /// Lists the registered recovery services providers in the vault. /// - /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IRecoveryPlanPlannedFailoverInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -31788,17 +42352,16 @@ public partial class Migrate { // 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); + 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}/replicationRecoveryPlans/{recoveryPlanName}/plannedFailover'"); + 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; - var recoveryPlanName = _match.Groups["recoveryPlanName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -31807,9 +42370,7 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationRecoveryPlans/" - + recoveryPlanName - + "/plannedFailover" + + "/replicationRecoveryServicesProviders" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -31818,21 +42379,17 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationRecoveryPlansPlannedFailover_Call(request,onOk,eventListener,sender); + await this.ReplicationRecoveryServicesProvidersList_Call(request,onOk,eventListener,sender); } } /// - /// Actual wire call for method. + /// Actual wire call for method. /// /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). @@ -31841,7 +42398,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -31852,106 +42409,6 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - break; - } - } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -31959,7 +42416,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.RecoveryPlan.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.RecoveryServicesProviderCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -31979,43 +42436,41 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but - /// you will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// 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.Migrate.Models.Api202301.IRecoveryPlanPlannedFailoverInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationRecoveryServicesProvidersList_Validate(string resourceName, string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 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. /// Azure Subscription Id in which migrate project was created. - /// Recovery plan name. - /// a delegate that is called when the remote service returns 200 (OK). + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -32029,9 +42484,10 @@ public partial class Migrate + global::System.Uri.EscapeDataString(resourceGroupName) + "/providers/Microsoft.RecoveryServices/vaults/" + global::System.Uri.EscapeDataString(resourceName) - + "/replicationRecoveryPlans/" - + global::System.Uri.EscapeDataString(recoveryPlanName) - + "/reProtect" + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationRecoveryServicesProviders/" + + global::System.Uri.EscapeDataString(providerName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -32040,24 +42496,26 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationRecoveryPlansReprotect_Call(request,onOk,eventListener,sender); + await this.ReplicationRecoveryServicesProvidersPurge_Call(request,onNoContent,eventListener,sender); } } - /// The operation to reprotect(reverse replicate) a recovery plan. + /// + /// The operation to purge(force delete) a recovery services provider from the vault. + /// /// - /// a delegate that is called when the remote service returns 200 (OK). + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationRecoveryServicesProvidersPurgeViaIdentity(global::System.String viaIdentity, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -32065,17 +42523,18 @@ public partial class Migrate { // 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); + 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}/replicationRecoveryPlans/{recoveryPlanName}/reProtect'"); + 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 recoveryPlanName = _match.Groups["recoveryPlanName"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var providerName = _match.Groups["providerName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -32084,9 +42543,10 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationRecoveryPlans/" - + recoveryPlanName - + "/reProtect" + + "/replicationFabrics/" + + fabricName + + "/replicationRecoveryServicesProviders/" + + providerName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -32095,24 +42555,26 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationRecoveryPlansReprotect_Call(request,onOk,eventListener,sender); + await this.ReplicationRecoveryServicesProvidersPurge_Call(request,onNoContent,eventListener,sender); } } - /// Actual wire call for method. + /// + /// Actual wire call for method. + /// /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 200 (OK). + /// 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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task ReplicationRecoveryServicesProvidersPurge_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -32227,10 +42689,10 @@ public partial class Migrate switch ( _response.StatusCode ) { - case global::System.Net.HttpStatusCode.OK: + case global::System.Net.HttpStatusCode.NoContent: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.RecoveryPlan.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onNoContent(_response); break; } default: @@ -32250,91 +42712,43 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you - /// will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Recovery plan name. + /// 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 ReplicationRecoveryPlansReprotect_Validate(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationRecoveryServicesProvidersPurge_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string providerName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. - /// Azure Subscription Id in which migrate project was created. - /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IRecoveryPlanTestFailoverInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - // generate request object - var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } - // make the call - await this.ReplicationRecoveryPlansTestFailover_Call(request,onOk,eventListener,sender); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(providerName),providerName); } } - /// The operation to cleanup test failover of a recovery plan. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Recovery plan name. - /// Recovery plan test failover cleanup input. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IRecoveryPlanTestFailoverCleanupInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -32348,9 +42762,11 @@ public partial class Migrate + global::System.Uri.EscapeDataString(resourceGroupName) + "/providers/Microsoft.RecoveryServices/vaults/" + global::System.Uri.EscapeDataString(resourceName) - + "/replicationRecoveryPlans/" - + global::System.Uri.EscapeDataString(recoveryPlanName) - + "/testFailoverCleanup" + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationRecoveryServicesProviders/" + + global::System.Uri.EscapeDataString(providerName) + + "/refreshProvider" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -32363,25 +42779,20 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationRecoveryPlansTestFailoverCleanup_Call(request,onOk,eventListener,sender); + await this.ReplicationRecoveryServicesProvidersRefreshProvider_Call(request,onOk,eventListener,sender); } } - /// The operation to cleanup test failover of a recovery plan. + /// The operation to refresh the information from the recovery services provider. /// - /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IRecoveryPlanTestFailoverCleanupInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -32389,17 +42800,18 @@ public partial class Migrate { // 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); + 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}/replicationRecoveryPlans/{recoveryPlanName}/testFailoverCleanup'"); + 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 recoveryPlanName = _match.Groups["recoveryPlanName"].Value; + var fabricName = _match.Groups["fabricName"].Value; + var providerName = _match.Groups["providerName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -32408,9 +42820,11 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationRecoveryPlans/" - + recoveryPlanName - + "/testFailoverCleanup" + + "/replicationFabrics/" + + fabricName + + "/replicationRecoveryServicesProviders/" + + providerName + + "/refreshProvider" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -32423,17 +42837,13 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationRecoveryPlansTestFailoverCleanup_Call(request,onOk,eventListener,sender); + await this.ReplicationRecoveryServicesProvidersRefreshProvider_Call(request,onOk,eventListener,sender); } } /// - /// Actual wire call for method. + /// Actual wire call for method. /// /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). @@ -32442,7 +42852,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -32560,7 +42970,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.RecoveryPlan.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.RecoveryServicesProvider.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -32580,41 +42990,95 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, - /// but you will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Recovery plan name. - /// Recovery plan test failover cleanup input. + /// 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 ReplicationRecoveryPlansTestFailoverCleanup_Validate(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IRecoveryPlanTestFailoverCleanupInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationRecoveryServicesProvidersRefreshProvider_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string providerName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(providerName),providerName); } } - /// The operation to start the test failover of a recovery plan. + /// 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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IStorageClassificationMappingInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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. /// - /// Recovery plan test failover input. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IRecoveryPlanTestFailoverInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationStorageClassificationMappingsCreateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IStorageClassificationMappingInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -32622,17 +43086,19 @@ public partial class Migrate { // 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); + 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}/replicationRecoveryPlans/{recoveryPlanName}/testFailover'"); + 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 recoveryPlanName = _match.Groups["recoveryPlanName"].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/" @@ -32641,9 +43107,12 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationRecoveryPlans/" - + recoveryPlanName - + "/testFailover" + + "/replicationFabrics/" + + fabricName + + "/replicationStorageClassifications/" + + storageClassificationName + + "/replicationStorageClassificationMappings/" + + storageClassificationMappingName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -32652,7 +43121,7 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -32661,12 +43130,12 @@ public partial class Migrate request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationRecoveryPlansTestFailover_Call(request,onOk,eventListener,sender); + await this.ReplicationStorageClassificationMappingsCreate_Call(request,onOk,eventListener,sender); } } /// - /// Actual wire call for method. + /// Actual wire call for method. /// /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). @@ -32675,7 +43144,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -32689,7 +43158,6 @@ public partial class Migrate // 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 ) @@ -32772,10 +43240,10 @@ public partial class Migrate continue; } // we are done polling, do a request on final target? - if (!string.IsNullOrWhiteSpace(_finalUri)) + if (!string.IsNullOrWhiteSpace(_originalUri)) { // create a new request with the final uri - request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get); + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get); // drop the old response _response?.Dispose(); @@ -32793,7 +43261,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.RecoveryPlan.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.StorageClassificationMapping.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -32813,44 +43281,49 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but - /// you will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Recovery plan name. - /// Recovery plan test failover input. + /// 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 ReplicationRecoveryPlansTestFailover_Validate(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IRecoveryPlanTestFailoverInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + 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.Migrate.Models.Api202301.IStorageClassificationMappingInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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(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 start the unplanned failover of a recovery plan. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Recovery plan name. - /// Recovery plan unplanned failover input. - /// a delegate that is called when the remote service returns 200 (OK). + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IRecoveryPlanUnplannedFailoverInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -32864,9 +43337,12 @@ public partial class Migrate + global::System.Uri.EscapeDataString(resourceGroupName) + "/providers/Microsoft.RecoveryServices/vaults/" + global::System.Uri.EscapeDataString(resourceName) - + "/replicationRecoveryPlans/" - + global::System.Uri.EscapeDataString(recoveryPlanName) - + "/unplannedFailover" + + "/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"); @@ -32875,29 +43351,24 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationRecoveryPlansUnplannedFailover_Call(request,onOk,eventListener,sender); + await this.ReplicationStorageClassificationMappingsDelete_Call(request,onNoContent,eventListener,sender); } } - /// The operation to start the unplanned failover of a recovery plan. + /// The operation to delete a storage classification mapping. /// - /// Recovery plan unplanned failover input. - /// a delegate that is called when the remote service returns 200 (OK). + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IRecoveryPlanUnplannedFailoverInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationStorageClassificationMappingsDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -32905,17 +43376,19 @@ public partial class Migrate { // 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); + 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}/replicationRecoveryPlans/{recoveryPlanName}/unplannedFailover'"); + 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 recoveryPlanName = _match.Groups["recoveryPlanName"].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/" @@ -32924,9 +43397,12 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationRecoveryPlans/" - + recoveryPlanName - + "/unplannedFailover" + + "/replicationFabrics/" + + fabricName + + "/replicationStorageClassifications/" + + storageClassificationName + + "/replicationStorageClassificationMappings/" + + storageClassificationMappingName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -32935,30 +43411,26 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationRecoveryPlansUnplannedFailover_Call(request,onOk,eventListener,sender); + await this.ReplicationStorageClassificationMappingsDelete_Call(request,onNoContent,eventListener,sender); } } /// - /// Actual wire call for method. + /// Actual wire call for method. /// /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 200 (OK). + /// 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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task ReplicationStorageClassificationMappingsDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -33073,10 +43545,10 @@ public partial class Migrate switch ( _response.StatusCode ) { - case global::System.Net.HttpStatusCode.OK: + case global::System.Net.HttpStatusCode.NoContent: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.RecoveryPlan.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onNoContent(_response); break; } default: @@ -33096,44 +43568,46 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, - /// but you will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Recovery plan name. - /// Recovery plan unplanned failover input. + /// 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 ReplicationRecoveryPlansUnplannedFailover_Validate(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IRecoveryPlanUnplannedFailoverInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + 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.Migrate.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); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(storageClassificationName),storageClassificationName); + await eventListener.AssertNotNull(nameof(storageClassificationMappingName),storageClassificationMappingName); } } - /// The operation to update a recovery plan. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Recovery plan name. - /// Update recovery plan input. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IUpdateRecoveryPlanInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -33147,8 +43621,12 @@ public partial class Migrate + global::System.Uri.EscapeDataString(resourceGroupName) + "/providers/Microsoft.RecoveryServices/vaults/" + global::System.Uri.EscapeDataString(resourceName) - + "/replicationRecoveryPlans/" - + global::System.Uri.EscapeDataString(recoveryPlanName) + + "/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"); @@ -33157,29 +43635,24 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationRecoveryPlansUpdate_Call(request,onOk,eventListener,sender); + await this.ReplicationStorageClassificationMappingsGet_Call(request,onOk,eventListener,sender); } } - /// The operation to update a recovery plan. + /// Gets the details of the specified storage classification mapping. /// - /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IUpdateRecoveryPlanInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -33187,17 +43660,19 @@ public partial class Migrate { // 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); + 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}/replicationRecoveryPlans/{recoveryPlanName}'"); + 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 recoveryPlanName = _match.Groups["recoveryPlanName"].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/" @@ -33206,8 +43681,12 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationRecoveryPlans/" - + recoveryPlanName + + "/replicationFabrics/" + + fabricName + + "/replicationStorageClassifications/" + + storageClassificationName + + "/replicationStorageClassificationMappings/" + + storageClassificationMappingName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -33216,20 +43695,18 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationRecoveryPlansUpdate_Call(request,onOk,eventListener,sender); + await this.ReplicationStorageClassificationMappingsGet_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// + /// 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. @@ -33237,7 +43714,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -33248,105 +43725,6 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - break; - } - } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -33354,7 +43732,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.RecoveryPlan.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.StorageClassificationMapping.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -33374,45 +43752,87 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will - /// get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Recovery plan name. - /// Update recovery plan input. + /// 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 ReplicationRecoveryPlansUpdate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string recoveryPlanName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IUpdateRecoveryPlanInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + 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.Migrate.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); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(storageClassificationName),storageClassificationName); + await eventListener.AssertNotNull(nameof(storageClassificationMappingName),storageClassificationMappingName); } } - /// The operation to add a recovery services provider. + /// 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. + /// Azure Subscription Id in which migrate project was created. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. /// Azure Subscription Id in which migrate project was created. /// Fabric name. - /// Recovery services provider name. - /// Add provider input. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IAddRecoveryServicesProviderInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -33428,8 +43848,9 @@ public partial class Migrate + global::System.Uri.EscapeDataString(resourceName) + "/replicationFabrics/" + global::System.Uri.EscapeDataString(fabricName) - + "/replicationRecoveryServicesProviders/" - + global::System.Uri.EscapeDataString(providerName) + + "/replicationStorageClassifications/" + + global::System.Uri.EscapeDataString(storageClassificationName) + + "/replicationStorageClassificationMappings" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -33438,29 +43859,24 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationRecoveryServicesProvidersCreate_Call(request,onOk,eventListener,sender); + await this.ReplicationStorageClassificationMappingsListByReplicationStorageClassifications_Call(request,onOk,eventListener,sender); } } - /// The operation to add a recovery services provider. + /// Lists the storage classification mappings for the fabric. /// - /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IAddRecoveryServicesProviderInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -33468,10 +43884,10 @@ public partial class Migrate { // 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); + 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}/replicationRecoveryServicesProviders/{providerName}'"); + 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 @@ -33479,7 +43895,7 @@ public partial class Migrate var resourceGroupName = _match.Groups["resourceGroupName"].Value; var subscriptionId = _match.Groups["subscriptionId"].Value; var fabricName = _match.Groups["fabricName"].Value; - var providerName = _match.Groups["providerName"].Value; + var storageClassificationName = _match.Groups["storageClassificationName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -33490,8 +43906,9 @@ public partial class Migrate + resourceName + "/replicationFabrics/" + fabricName - + "/replicationRecoveryServicesProviders/" - + providerName + + "/replicationStorageClassifications/" + + storageClassificationName + + "/replicationStorageClassificationMappings" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -33500,139 +43917,36 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationRecoveryServicesProvidersCreate_Call(request,onOk,eventListener,sender); + await this.ReplicationStorageClassificationMappingsListByReplicationStorageClassifications_Call(request,onOk,eventListener,sender); } } /// - /// Actual wire call for method. + /// 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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } - _response = await sendTask; - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - break; - } - } + /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -33640,7 +43954,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.RecoveryServicesProvider.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.StorageClassificationMappingCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -33660,20 +43974,19 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, - /// but you will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. /// Fabric name. - /// Recovery services provider name. - /// Add provider input. + /// 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 ReplicationRecoveryServicesProvidersCreate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string providerName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IAddRecoveryServicesProviderInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationStorageClassificationMappingsListByReplicationStorageClassifications_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string storageClassificationName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -33681,73 +43994,19 @@ public partial class Migrate 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. - /// Azure Subscription Id in which migrate project was created. - /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - // generate request object - var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } - // make the call - await this.ReplicationRecoveryServicesProvidersDelete_Call(request,onNoContent,eventListener,sender); + await eventListener.AssertNotNull(nameof(storageClassificationName),storageClassificationName); } } - /// - /// The operation to removes/delete(unregister) a recovery services provider from the vault. - /// + /// Lists the storage classification mappings in the vault. /// - /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -33755,18 +44014,16 @@ public partial class Migrate { // 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); + 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}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}/remove'"); + 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; - var fabricName = _match.Groups["fabricName"].Value; - var providerName = _match.Groups["providerName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -33775,11 +44032,7 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationFabrics/" - + fabricName - + "/replicationRecoveryServicesProviders/" - + providerName - + "/remove" + + "/replicationStorageClassificationMappings" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -33788,26 +44041,26 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationRecoveryServicesProvidersDelete_Call(request,onNoContent,eventListener,sender); + await this.ReplicationStorageClassificationMappingsList_Call(request,onOk,eventListener,sender); } } /// - /// Actual wire call for method. + /// Actual wire call for method. /// /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -33818,114 +44071,14 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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: + case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onNoContent(_response); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.StorageClassificationMappingCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -33945,43 +44098,39 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, + /// 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. /// Azure Subscription Id in which migrate project was created. - /// 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.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationStorageClassificationMappingsList_Validate(string resourceName, string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// 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. /// Azure Subscription Id in which migrate project was created. /// Fabric name. - /// Recovery services provider 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -33997,8 +44146,8 @@ public partial class Migrate + global::System.Uri.EscapeDataString(resourceName) + "/replicationFabrics/" + global::System.Uri.EscapeDataString(fabricName) - + "/replicationRecoveryServicesProviders/" - + global::System.Uri.EscapeDataString(providerName) + + "/replicationStorageClassifications/" + + global::System.Uri.EscapeDataString(storageClassificationName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -34012,11 +44161,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationRecoveryServicesProvidersGet_Call(request,onOk,eventListener,sender); + await this.ReplicationStorageClassificationsGet_Call(request,onOk,eventListener,sender); } } - /// Gets the details of registered recovery services provider. + /// 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. @@ -34024,7 +44173,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -34032,10 +44181,10 @@ public partial class Migrate { // 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); + 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}/replicationRecoveryServicesProviders/{providerName}'"); + 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 @@ -34043,7 +44192,7 @@ public partial class Migrate var resourceGroupName = _match.Groups["resourceGroupName"].Value; var subscriptionId = _match.Groups["subscriptionId"].Value; var fabricName = _match.Groups["fabricName"].Value; - var providerName = _match.Groups["providerName"].Value; + var storageClassificationName = _match.Groups["storageClassificationName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -34054,8 +44203,8 @@ public partial class Migrate + resourceName + "/replicationFabrics/" + fabricName - + "/replicationRecoveryServicesProviders/" - + providerName + + "/replicationStorageClassifications/" + + storageClassificationName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -34069,12 +44218,12 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationRecoveryServicesProvidersGet_Call(request,onOk,eventListener,sender); + await this.ReplicationStorageClassificationsGet_Call(request,onOk,eventListener,sender); } } /// - /// Actual wire call for method. + /// Actual wire call for method. /// /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). @@ -34083,7 +44232,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -34101,7 +44250,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.RecoveryServicesProvider.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.StorageClassification.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -34121,19 +44270,19 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but + /// 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. /// Azure Subscription Id in which migrate project was created. /// Fabric name. - /// Recovery services provider 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 ReplicationRecoveryServicesProvidersGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string providerName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationStorageClassificationsGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string storageClassificationName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -34141,11 +44290,11 @@ public partial class Migrate 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(storageClassificationName),storageClassificationName); } } - /// Lists the registered recovery services providers in the vault. + /// 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. /// Azure Subscription Id in which migrate project was created. @@ -34155,7 +44304,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -34169,7 +44318,7 @@ public partial class Migrate + global::System.Uri.EscapeDataString(resourceGroupName) + "/providers/Microsoft.RecoveryServices/vaults/" + global::System.Uri.EscapeDataString(resourceName) - + "/replicationRecoveryServicesProviders" + + "/replicationStorageClassifications" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -34183,22 +44332,22 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationRecoveryServicesProvidersList_Call(request,onOk,eventListener,sender); + await this.ReplicationStorageClassificationsList_Call(request,onOk,eventListener,sender); } } - /// Lists the registered recovery services providers for the specified fabric. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -34214,7 +44363,7 @@ public partial class Migrate + global::System.Uri.EscapeDataString(resourceName) + "/replicationFabrics/" + global::System.Uri.EscapeDataString(fabricName) - + "/replicationRecoveryServicesProviders" + + "/replicationStorageClassifications" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -34228,11 +44377,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationRecoveryServicesProvidersListByReplicationFabrics_Call(request,onOk,eventListener,sender); + await this.ReplicationStorageClassificationsListByReplicationFabrics_Call(request,onOk,eventListener,sender); } } - /// Lists the registered recovery services providers for the specified fabric. + /// 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. @@ -34240,7 +44389,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -34248,10 +44397,10 @@ public partial class Migrate { // 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); + 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}/replicationRecoveryServicesProviders'"); + 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 @@ -34269,7 +44418,7 @@ public partial class Migrate + resourceName + "/replicationFabrics/" + fabricName - + "/replicationRecoveryServicesProviders" + + "/replicationStorageClassifications" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -34283,12 +44432,12 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationRecoveryServicesProvidersListByReplicationFabrics_Call(request,onOk,eventListener,sender); + await this.ReplicationStorageClassificationsListByReplicationFabrics_Call(request,onOk,eventListener,sender); } } /// - /// Actual wire call for method. + /// Actual wire call for method. /// /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). @@ -34297,7 +44446,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -34315,7 +44464,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.RecoveryServicesProviderCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.StorageClassificationCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -34335,18 +44484,18 @@ public partial class Migrate } /// - /// Validation method for method. Call this like + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. + /// 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 ReplicationRecoveryServicesProvidersListByReplicationFabrics_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationStorageClassificationsListByReplicationFabrics_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -34357,7 +44506,7 @@ public partial class Migrate } } - /// Lists the registered recovery services providers in the vault. + /// 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. @@ -34365,7 +44514,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -34373,10 +44522,10 @@ public partial class Migrate { // 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); + 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}/replicationRecoveryServicesProviders'"); + 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 @@ -34391,7 +44540,7 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationRecoveryServicesProviders" + + "/replicationStorageClassifications" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -34405,12 +44554,12 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationRecoveryServicesProvidersList_Call(request,onOk,eventListener,sender); + await this.ReplicationStorageClassificationsList_Call(request,onOk,eventListener,sender); } } /// - /// Actual wire call for method. + /// Actual wire call for method. /// /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). @@ -34419,7 +44568,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -34437,7 +44586,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.RecoveryServicesProviderCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.StorageClassificationCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -34457,8 +44606,8 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, - /// but you will get validation events back. + /// 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. @@ -34467,7 +44616,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationStorageClassificationsList_Validate(string resourceName, string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -34477,21 +44626,17 @@ public partial class Migrate } } - /// - /// The operation to purge(force delete) a recovery services provider from the vault. - /// + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. - /// Recovery services provider name. - /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -34505,10 +44650,7 @@ public partial class Migrate + 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) + + "/replicationVaultHealth" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -34517,26 +44659,24 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationRecoveryServicesProvidersPurge_Call(request,onNoContent,eventListener,sender); + await this.ReplicationVaultHealthGet_Call(request,onOk,eventListener,sender); } } - /// - /// The operation to purge(force delete) a recovery services provider from the vault. - /// + /// Gets the health details of the vault. /// - /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -34544,18 +44684,16 @@ public partial class Migrate { // 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); + 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}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}'"); + 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; - var fabricName = _match.Groups["fabricName"].Value; - var providerName = _match.Groups["providerName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -34564,10 +44702,7 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationFabrics/" - + fabricName - + "/replicationRecoveryServicesProviders/" - + providerName + + "/replicationVaultHealth" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -34576,26 +44711,24 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationRecoveryServicesProvidersPurge_Call(request,onNoContent,eventListener,sender); + await this.ReplicationVaultHealthGet_Call(request,onOk,eventListener,sender); } } - /// - /// Actual wire call for method. - /// + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -34606,114 +44739,14 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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: + case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onNoContent(_response); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.VaultHealthDetails.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -34733,43 +44766,37 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, - /// but you will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// 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.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationVaultHealthGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -34783,11 +44810,7 @@ public partial class Migrate + 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" + + "/replicationVaultHealth/default/refresh" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -34801,11 +44824,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationRecoveryServicesProvidersRefreshProvider_Call(request,onOk,eventListener,sender); + await this.ReplicationVaultHealthRefresh_Call(request,onOk,eventListener,sender); } } - /// The operation to refresh the information from the recovery services provider. + /// Refreshes health summary of the vault. /// /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. @@ -34813,7 +44836,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -34821,18 +44844,16 @@ public partial class Migrate { // 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); + 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}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}/refreshProvider'"); + 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; - var fabricName = _match.Groups["fabricName"].Value; - var providerName = _match.Groups["providerName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -34841,11 +44862,7 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationFabrics/" - + fabricName - + "/replicationRecoveryServicesProviders/" - + providerName - + "/refreshProvider" + + "/replicationVaultHealth/default/refresh" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -34859,13 +44876,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationRecoveryServicesProvidersRefreshProvider_Call(request,onOk,eventListener,sender); + await this.ReplicationVaultHealthRefresh_Call(request,onOk,eventListener,sender); } } - /// - /// Actual wire call for method. - /// + /// 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. @@ -34873,7 +44888,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -34991,7 +45006,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.RecoveryServicesProvider.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.VaultHealthDetails.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -35011,45 +45026,39 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual - /// call, but you will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// 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.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationVaultHealthRefresh_Validate(string resourceName, string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. - /// Storage classification name. - /// Storage classification mapping name. - /// Pairing input. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IStorageClassificationMappingInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationVaultSettingCreate(string resourceName, string resourceGroupName, string subscriptionId, string vaultSettingName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IVaultSettingCreationInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -35063,12 +45072,8 @@ public partial class Migrate + 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) + + "/replicationVaultSettings/" + + global::System.Uri.EscapeDataString(vaultSettingName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -35086,20 +45091,20 @@ public partial class Migrate request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationStorageClassificationMappingsCreate_Call(request,onOk,eventListener,sender); + await this.ReplicationVaultSettingCreate_Call(request,onOk,eventListener,sender); } } - /// The operation to create a storage classification mapping. + /// The operation to configure vault setting. /// - /// Pairing input. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IStorageClassificationMappingInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationVaultSettingCreateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IVaultSettingCreationInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -35107,19 +45112,17 @@ public partial class Migrate { // 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); + 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}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}'"); + 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 fabricName = _match.Groups["fabricName"].Value; - var storageClassificationName = _match.Groups["storageClassificationName"].Value; - var storageClassificationMappingName = _match.Groups["storageClassificationMappingName"].Value; + var vaultSettingName = _match.Groups["vaultSettingName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -35128,12 +45131,8 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationFabrics/" - + fabricName - + "/replicationStorageClassifications/" - + storageClassificationName - + "/replicationStorageClassificationMappings/" - + storageClassificationMappingName + + "/replicationVaultSettings/" + + vaultSettingName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -35151,13 +45150,11 @@ public partial class Migrate request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationStorageClassificationMappingsCreate_Call(request,onOk,eventListener,sender); + await this.ReplicationVaultSettingCreate_Call(request,onOk,eventListener,sender); } } - /// - /// Actual wire call for method. - /// + /// 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. @@ -35165,7 +45162,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -35282,7 +45279,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.StorageClassificationMapping.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.VaultSetting.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -35302,49 +45299,43 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual - /// call, but you will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. - /// Storage classification name. - /// Storage classification mapping name. - /// Pairing input. + /// 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 ReplicationStorageClassificationMappingsCreate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string storageClassificationName, string storageClassificationMappingName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IStorageClassificationMappingInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationVaultSettingCreate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string vaultSettingName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IVaultSettingCreationInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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(vaultSettingName),vaultSettingName); await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// The operation to delete a storage classification mapping. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. - /// Storage classification name. - /// Storage classification mapping name. - /// a delegate that is called when the remote service returns 204 (NoContent). + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -35358,12 +45349,8 @@ public partial class Migrate + 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) + + "/replicationVaultSettings/" + + global::System.Uri.EscapeDataString(vaultSettingName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -35372,24 +45359,24 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationStorageClassificationMappingsDelete_Call(request,onNoContent,eventListener,sender); + await this.ReplicationVaultSettingGet_Call(request,onOk,eventListener,sender); } } - /// The operation to delete a storage classification mapping. + /// Gets the vault setting. This includes the Migration Hub connection settings. /// - /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -35397,19 +45384,17 @@ public partial class Migrate { // 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); + 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}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}'"); + 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 fabricName = _match.Groups["fabricName"].Value; - var storageClassificationName = _match.Groups["storageClassificationName"].Value; - var storageClassificationMappingName = _match.Groups["storageClassificationMappingName"].Value; + var vaultSettingName = _match.Groups["vaultSettingName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -35418,12 +45403,8 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationFabrics/" - + fabricName - + "/replicationStorageClassifications/" - + storageClassificationName - + "/replicationStorageClassificationMappings/" - + storageClassificationMappingName + + "/replicationVaultSettings/" + + vaultSettingName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -35432,26 +45413,24 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationStorageClassificationMappingsDelete_Call(request,onNoContent,eventListener,sender); + await this.ReplicationVaultSettingGet_Call(request,onOk,eventListener,sender); } } - /// - /// Actual wire call for method. - /// + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -35462,114 +45441,14 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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: + case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onNoContent(_response); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.VaultSetting.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -35589,46 +45468,41 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual - /// call, but you will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. - /// Storage classification name. - /// Storage classification mapping name. + /// 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 ReplicationStorageClassificationMappingsDelete_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string storageClassificationName, string storageClassificationMappingName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationVaultSettingGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string vaultSettingName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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(vaultSettingName),vaultSettingName); } } - /// Gets the details of the specified storage classification mapping. + /// + /// 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. /// Azure Subscription Id in which migrate project was created. - /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -35642,12 +45516,7 @@ public partial class Migrate + 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) + + "/replicationVaultSettings" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -35661,11 +45530,13 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationStorageClassificationMappingsGet_Call(request,onOk,eventListener,sender); + await this.ReplicationVaultSettingList_Call(request,onOk,eventListener,sender); } } - /// Gets the details of the specified storage classification mapping. + /// + /// 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. @@ -35673,7 +45544,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -35681,19 +45552,16 @@ public partial class Migrate { // 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); + 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}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}'"); + 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; - 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/" @@ -35702,12 +45570,7 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationFabrics/" - + fabricName - + "/replicationStorageClassifications/" - + storageClassificationName - + "/replicationStorageClassificationMappings/" - + storageClassificationMappingName + + "/replicationVaultSettings" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -35721,13 +45584,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationStorageClassificationMappingsGet_Call(request,onOk,eventListener,sender); + await this.ReplicationVaultSettingList_Call(request,onOk,eventListener,sender); } } - /// - /// Actual wire call for method. - /// + /// 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. @@ -35735,7 +45596,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -35753,7 +45614,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.StorageClassificationMapping.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.VaultSettingCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -35773,87 +45634,40 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, - /// but you will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// 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.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationVaultSettingList_Validate(string resourceName, string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. - /// Azure Subscription Id in which migrate project was created. - /// a delegate that is called when the remote service returns 200 (OK). - /// an instance that will receive events. - /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - // generate request object - var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 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. /// Azure Subscription Id in which migrate project was created. /// Fabric name. - /// Storage classification 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationvCentersCreate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string vcenterName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IAddVCenterRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -35869,9 +45683,8 @@ public partial class Migrate + global::System.Uri.EscapeDataString(resourceName) + "/replicationFabrics/" + global::System.Uri.EscapeDataString(fabricName) - + "/replicationStorageClassifications/" - + global::System.Uri.EscapeDataString(storageClassificationName) - + "/replicationStorageClassificationMappings" + + "/replicationvCenters/" + + global::System.Uri.EscapeDataString(vcenterName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -35880,24 +45693,29 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationStorageClassificationMappingsListByReplicationStorageClassifications_Call(request,onOk,eventListener,sender); + await this.ReplicationvCentersCreate_Call(request,onOk,eventListener,sender); } } - /// Lists the storage classification mappings for the fabric. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationvCentersCreateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IAddVCenterRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -35905,10 +45723,10 @@ public partial class Migrate { // 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); + 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}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings'"); + 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 @@ -35916,7 +45734,7 @@ public partial class Migrate 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 vcenterName = _match.Groups["vcenterName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -35927,9 +45745,8 @@ public partial class Migrate + resourceName + "/replicationFabrics/" + fabricName - + "/replicationStorageClassifications/" - + storageClassificationName - + "/replicationStorageClassificationMappings" + + "/replicationvCenters/" + + vcenterName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -35938,18 +45755,20 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationStorageClassificationMappingsListByReplicationStorageClassifications_Call(request,onOk,eventListener,sender); + await this.ReplicationvCentersCreate_Call(request,onOk,eventListener,sender); } } - /// - /// Actual wire call for method. - /// + /// 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. @@ -35957,7 +45776,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -35968,6 +45787,105 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } + } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -35975,7 +45893,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.StorageClassificationMappingCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.VCenterAutoGenerated.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -35995,19 +45913,20 @@ public partial class Migrate } /// - /// Validation method for method. - /// Call this like the actual call, but you will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. /// Fabric name. - /// Storage classification 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 ReplicationStorageClassificationMappingsListByReplicationStorageClassifications_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string storageClassificationName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationvCentersCreate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string vcenterName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IAddVCenterRequest body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -36015,19 +45934,68 @@ public partial class Migrate 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(vcenterName),vcenterName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// Lists the storage classification mappings in the vault. + /// 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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 200 (OK). + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationvCentersDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -36035,16 +46003,18 @@ public partial class Migrate { // 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); + 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}/replicationStorageClassificationMappings'"); + 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/" @@ -36053,7 +46023,10 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationStorageClassificationMappings" + + "/replicationFabrics/" + + fabricName + + "/replicationvCenters/" + + vcenterName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -36062,26 +46035,24 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationStorageClassificationMappingsList_Call(request,onOk,eventListener,sender); + await this.ReplicationvCentersDelete_Call(request,onNoContent,eventListener,sender); } } - /// - /// Actual wire call for method. - /// + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 200 (OK). + /// 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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task ReplicationvCentersDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -36092,14 +46063,114 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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: + case global::System.Net.HttpStatusCode.NoContent: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.StorageClassificationMappingCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onNoContent(_response); break; } default: @@ -36119,39 +46190,43 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, - /// but you will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. + /// 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 ReplicationStorageClassificationMappingsList_Validate(string resourceName, string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationvCentersDelete_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string vcenterName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 the specified storage classification. + /// 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. /// Azure Subscription Id in which migrate project was created. /// Fabric name. - /// Storage classification 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -36167,8 +46242,8 @@ public partial class Migrate + global::System.Uri.EscapeDataString(resourceName) + "/replicationFabrics/" + global::System.Uri.EscapeDataString(fabricName) - + "/replicationStorageClassifications/" - + global::System.Uri.EscapeDataString(storageClassificationName) + + "/replicationvCenters/" + + global::System.Uri.EscapeDataString(vcenterName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -36182,11 +46257,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationStorageClassificationsGet_Call(request,onOk,eventListener,sender); + await this.ReplicationvCentersGet_Call(request,onOk,eventListener,sender); } } - /// Gets the details of the specified storage classification. + /// 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. @@ -36194,7 +46269,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -36202,10 +46277,10 @@ public partial class Migrate { // 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); + 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}/replicationStorageClassifications/{storageClassificationName}'"); + 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 @@ -36213,7 +46288,7 @@ public partial class Migrate 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 vcenterName = _match.Groups["vcenterName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -36224,8 +46299,8 @@ public partial class Migrate + resourceName + "/replicationFabrics/" + fabricName - + "/replicationStorageClassifications/" - + storageClassificationName + + "/replicationvCenters/" + + vcenterName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -36239,13 +46314,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationStorageClassificationsGet_Call(request,onOk,eventListener,sender); + await this.ReplicationvCentersGet_Call(request,onOk,eventListener,sender); } } - /// - /// Actual wire call for method. - /// + /// 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. @@ -36253,7 +46326,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -36271,7 +46344,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.StorageClassification.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.VCenterAutoGenerated.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -36291,19 +46364,19 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but - /// you will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. /// Fabric name. - /// Storage classification 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 ReplicationStorageClassificationsGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string storageClassificationName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationvCentersGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string vcenterName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -36311,11 +46384,11 @@ public partial class Migrate 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(vcenterName),vcenterName); } } - /// Lists the storage classifications in the vault. + /// 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. /// Azure Subscription Id in which migrate project was created. @@ -36325,7 +46398,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -36339,7 +46412,7 @@ public partial class Migrate + global::System.Uri.EscapeDataString(resourceGroupName) + "/providers/Microsoft.RecoveryServices/vaults/" + global::System.Uri.EscapeDataString(resourceName) - + "/replicationStorageClassifications" + + "/replicationvCenters" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -36353,22 +46426,22 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationStorageClassificationsList_Call(request,onOk,eventListener,sender); + await this.ReplicationvCentersList_Call(request,onOk,eventListener,sender); } } - /// Lists the storage classifications available in the specified fabric. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Site name of interest. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -36384,7 +46457,7 @@ public partial class Migrate + global::System.Uri.EscapeDataString(resourceName) + "/replicationFabrics/" + global::System.Uri.EscapeDataString(fabricName) - + "/replicationStorageClassifications" + + "/replicationvCenters" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -36398,11 +46471,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationStorageClassificationsListByReplicationFabrics_Call(request,onOk,eventListener,sender); + await this.ReplicationvCentersListByReplicationFabrics_Call(request,onOk,eventListener,sender); } } - /// Lists the storage classifications available in the specified fabric. + /// 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. @@ -36410,7 +46483,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -36418,10 +46491,10 @@ public partial class Migrate { // 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); + 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}/replicationStorageClassifications'"); + 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 @@ -36439,7 +46512,7 @@ public partial class Migrate + resourceName + "/replicationFabrics/" + fabricName - + "/replicationStorageClassifications" + + "/replicationvCenters" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -36453,12 +46526,12 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationStorageClassificationsListByReplicationFabrics_Call(request,onOk,eventListener,sender); + await this.ReplicationvCentersListByReplicationFabrics_Call(request,onOk,eventListener,sender); } } /// - /// Actual wire call for method. + /// Actual wire call for method. /// /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). @@ -36467,7 +46540,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -36485,7 +46558,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.StorageClassificationCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.VCenterCollectionAutoGenerated.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -36505,18 +46578,18 @@ public partial class Migrate } /// - /// Validation method for method. Call this like - /// the actual call, but you will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Site name of interest. + /// 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 ReplicationStorageClassificationsListByReplicationFabrics_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationvCentersListByReplicationFabrics_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -36527,169 +46600,7 @@ public partial class Migrate } } - /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - // generate request object - var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } - _response = await sendTask; - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.StorageClassificationCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - default: - { - throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); - } - } - } - finally - { - // finally statements - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. - /// Azure Subscription Id in which migrate project was created. - /// 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.Migrate.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. - /// Azure Subscription Id in which migrate project was created. - /// a delegate that is called when the remote service returns 200 (OK). - /// an instance that will receive events. - /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - // generate request object - var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + /// 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. @@ -36697,7 +46608,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -36705,10 +46616,10 @@ public partial class Migrate { // 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); + 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}/replicationVaultHealth'"); + 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 @@ -36723,7 +46634,7 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationVaultHealth" + + "/replicationvCenters" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -36737,11 +46648,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationVaultHealthGet_Call(request,onOk,eventListener,sender); + await this.ReplicationvCentersList_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -36749,7 +46660,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -36767,7 +46678,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.VaultHealthDetails.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.VCenterCollectionAutoGenerated.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -36787,7 +46698,7 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get + /// Validation method for method. Call this like the actual call, but you will get /// validation events back. /// /// The name of the recovery services vault. @@ -36797,7 +46708,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationvCentersList_Validate(string resourceName, string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { @@ -36807,17 +46718,20 @@ public partial class Migrate } } - /// Refreshes health summary of the vault. + /// 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. /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationvCentersUpdate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string vcenterName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IUpdateVCenterRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -36831,7 +46745,10 @@ public partial class Migrate + global::System.Uri.EscapeDataString(resourceGroupName) + "/providers/Microsoft.RecoveryServices/vaults/" + global::System.Uri.EscapeDataString(resourceName) - + "/replicationVaultHealth/default/refresh" + + "/replicationFabrics/" + + global::System.Uri.EscapeDataString(fabricName) + + "/replicationvCenters/" + + global::System.Uri.EscapeDataString(vcenterName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -36840,24 +46757,29 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationVaultHealthRefresh_Call(request,onOk,eventListener,sender); + await this.ReplicationvCentersUpdate_Call(request,onOk,eventListener,sender); } } - /// Refreshes health summary of the vault. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task ReplicationvCentersUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IUpdateVCenterRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2023-01-01"; // Constant Parameters @@ -36865,16 +46787,18 @@ public partial class Migrate { // 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); + 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}/replicationVaultHealth/default/refresh'"); + 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/" @@ -36883,7 +46807,10 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.RecoveryServices/vaults/" + resourceName - + "/replicationVaultHealth/default/refresh" + + "/replicationFabrics/" + + fabricName + + "/replicationvCenters/" + + vcenterName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -36892,16 +46819,20 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationVaultHealthRefresh_Call(request,onOk,eventListener,sender); + await this.ReplicationvCentersUpdate_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -36909,7 +46840,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -36923,7 +46854,6 @@ public partial class Migrate // 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 ) @@ -37006,10 +46936,10 @@ public partial class Migrate continue; } // we are done polling, do a request on final target? - if (!string.IsNullOrWhiteSpace(_finalUri)) + if (!string.IsNullOrWhiteSpace(_originalUri)) { // create a new request with the final uri - request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get); + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get); // drop the old response _response?.Dispose(); @@ -37027,7 +46957,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.VaultHealthDetails.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.VCenterAutoGenerated.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -37047,41 +46977,47 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will - /// get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. + /// 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 ReplicationVaultHealthRefresh_Validate(string resourceName, string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task ReplicationvCentersUpdate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string vcenterName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IUpdateVCenterRequest body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 configure vault setting. - /// The name of the recovery services vault. - /// The name of the resource group where the recovery services vault is present. - /// Azure Subscription Id in which migrate project was created. - /// Vault setting name. - /// Vault setting creation input. + /// Method to get run as account. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site name. + /// Run as account ARM 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IVaultSettingCreationInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task RunAsAccountsGet(string subscriptionId, string resourceGroupName, string siteName, string accountName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2020-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -37091,10 +47027,10 @@ public partial class Migrate + 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) + + "/providers/Microsoft.OffAzure/VMwareSites/" + + global::System.Uri.EscapeDataString(siteName) + + "/runAsAccounts/" + + global::System.Uri.EscapeDataString(accountName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -37103,57 +47039,52 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationVaultSettingCreate_Call(request,onOk,eventListener,sender); + await this.RunAsAccountsGet_Call(request,onOk,eventListener,sender); } } - /// The operation to configure vault setting. + /// Method to get run as account. /// - /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IVaultSettingCreationInput body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task RunAsAccountsGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2020-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); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/VMwareSites/(?[^/]+)/runAsAccounts/(?[^/]+)$", 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}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/VMwareSites/{siteName}/runAsAccounts/{accountName}'"); } // 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; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var siteName = _match.Groups["siteName"].Value; + var accountName = _match.Groups["accountName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.RecoveryServices/vaults/" - + resourceName - + "/replicationVaultSettings/" - + vaultSettingName + + "/providers/Microsoft.OffAzure/VMwareSites/" + + siteName + + "/runAsAccounts/" + + accountName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -37162,20 +47093,16 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationVaultSettingCreate_Call(request,onOk,eventListener,sender); + await this.RunAsAccountsGet_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -37183,7 +47110,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task RunAsAccountsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -37194,105 +47121,168 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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 ); + var _contentType = _response.Content.Headers.ContentType?.MediaType; - // 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"); + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.VMwareRunAsAccount.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; } - if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { - location = _response.GetFirstHeader(@"Location"); + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); } - 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.Migrate.Runtime.Method.Get); + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } - // 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; + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site name. + /// Run as account 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 RunAsAccountsGet_Validate(string subscriptionId, string resourceGroupName, string siteName, string accountName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(siteName),siteName); + await eventListener.AssertNotNull(nameof(accountName),accountName); + } + } - // check for cancellation - if( eventListener.Token.IsCancellationRequested ) { return; } + /// Method to get run as accounts. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site 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.Migrate.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task RunAsAccountsList(string subscriptionId, string resourceGroupName, string siteName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-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.OffAzure/VMwareSites/" + + global::System.Uri.EscapeDataString(siteName) + + "/runAsAccounts" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - // drop the old response - _response?.Dispose(); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - // make the polling call - _response = await sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); 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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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; - } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.RunAsAccountsList_Call(request,onOk,eventListener,sender); + } + } - switch( state?.ToString()?.ToLower() ) - { - case "failed": - error = true; - break; - case "succeeded": - case "canceled": - // we're done polling. - break; + /// Method to get run as accounts. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task RunAsAccountsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-01-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri - 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.Migrate.Runtime.UndeclaredResponseException(_response); - } - } + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/VMwareSites/(?[^/]+)/runAsAccounts$", 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.OffAzure/VMwareSites/{siteName}/runAsAccounts'"); + } - // 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.Migrate.Runtime.Method.Get); + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var siteName = _match.Groups["siteName"].Value; + // construct URL + var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( + "/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.OffAzure/VMwareSites/" + + siteName + + "/runAsAccounts" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - // drop the old response - _response?.Dispose(); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - // make the final call - _response = await sender.SendAsync(request, eventListener); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - break; - } - } + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.RunAsAccountsList_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.Migrate.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 RunAsAccountsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sendTask; + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -37300,7 +47290,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.VaultSetting.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.VMwareRunAsAccountCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -37320,45 +47310,41 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will - /// get validation events back. + /// 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. - /// Azure Subscription Id in which migrate project was created. - /// Vault setting name. - /// Vault setting creation input. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site 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 ReplicationVaultSettingCreate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string vaultSettingName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IVaultSettingCreationInput body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task RunAsAccountsList_Validate(string subscriptionId, string resourceGroupName, string siteName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(siteName),siteName); } } - /// 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. - /// Azure Subscription Id in which migrate project was created. - /// Vault setting name. + /// Method to create or update a site. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site name. + /// Body with site details. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task SitesCreateOrUpdate(string subscriptionId, string resourceGroupName, string siteName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVMwareSite body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2020-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -37368,10 +47354,8 @@ public partial class Migrate + 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) + + "/providers/Microsoft.OffAzure/VMwareSites/" + + global::System.Uri.EscapeDataString(siteName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -37380,52 +47364,55 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationVaultSettingGet_Call(request,onOk,eventListener,sender); + await this.SitesCreateOrUpdate_Call(request,onOk,onCreated,eventListener,sender); } } - /// Gets the vault setting. This includes the Migration Hub connection settings. + /// Method to create or update a site. /// + /// Body with site details. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task SitesCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVMwareSite body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2020-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); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/VMwareSites/(?[^/]+)$", 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}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/VMwareSites/{siteName}'"); } // 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; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var siteName = _match.Groups["siteName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.RecoveryServices/vaults/" - + resourceName - + "/replicationVaultSettings/" - + vaultSettingName + + "/providers/Microsoft.OffAzure/VMwareSites/" + + siteName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -37434,24 +47421,29 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationVaultSettingGet_Call(request,onOk,eventListener,sender); + await this.SitesCreateOrUpdate_Call(request,onOk,onCreated,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task SitesCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -37469,7 +47461,13 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.VaultSetting.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.VMwareSite.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + case global::System.Net.HttpStatusCode.Created: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onCreated(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.VMwareSite.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -37489,43 +47487,43 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get - /// validation events back. + /// 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. - /// Azure Subscription Id in which migrate project was created. - /// Vault setting name. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site name. + /// Body with site details. /// 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.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task SitesCreateOrUpdate_Validate(string subscriptionId, string resourceGroupName, string siteName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVMwareSite body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(siteName),siteName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// - /// 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. - /// Azure Subscription Id in which migrate project was created. + /// Method to delete a site. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site name. /// a delegate that is called when the remote service returns 200 (OK). + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task SitesDeleteSite(string subscriptionId, string resourceGroupName, string siteName, global::System.Func onOk, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2020-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -37535,9 +47533,8 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.RecoveryServices/vaults/" - + global::System.Uri.EscapeDataString(resourceName) - + "/replicationVaultSettings" + + "/providers/Microsoft.OffAzure/VMwareSites/" + + global::System.Uri.EscapeDataString(siteName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -37546,52 +47543,50 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationVaultSettingList_Call(request,onOk,eventListener,sender); + await this.SitesDeleteSite_Call(request,onOk,onNoContent,eventListener,sender); } } - /// - /// Gets the list of vault setting. This includes the Migration Hub connection settings. - /// + /// Method to delete a site. /// /// a delegate that is called when the remote service returns 200 (OK). + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task SitesDeleteSiteViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2020-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); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/VMwareSites/(?[^/]+)$", 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'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/VMwareSites/{siteName}'"); } // 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 resourceGroupName = _match.Groups["resourceGroupName"].Value; + var siteName = _match.Groups["siteName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId - + "/resourceGroups/" - + resourceGroupName - + "/providers/Microsoft.RecoveryServices/vaults/" - + resourceName - + "/replicationVaultSettings" + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.OffAzure/VMwareSites/" + + siteName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -37600,24 +47595,25 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationVaultSettingList_Call(request,onOk,eventListener,sender); + await this.SitesDeleteSite_Call(request,onOk,onNoContent,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). + /// 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.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task SitesDeleteSite_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -37635,7 +47631,13 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.VaultSettingCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response); + break; + } + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); break; } default: @@ -37655,42 +47657,39 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will - /// get validation events back. + /// 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. - /// Azure Subscription Id in which migrate project was created. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site 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 ReplicationVaultSettingList_Validate(string resourceName, string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task SitesDeleteSite_Validate(string subscriptionId, string resourceGroupName, string siteName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(siteName),siteName); } } - /// 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. - /// Azure Subscription Id in which migrate project was created. - /// Fabric name. - /// vcenter name. - /// The input to the add vCenter operation. + /// Method to get a site. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IAddVCenterRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task SitesGet(string subscriptionId, string resourceGroupName, string siteName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2020-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -37700,12 +47699,8 @@ public partial class Migrate + 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) + + "/providers/Microsoft.OffAzure/VMwareSites/" + + global::System.Uri.EscapeDataString(siteName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -37714,60 +47709,92 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationvCentersCreate_Call(request,onOk,eventListener,sender); + await this.SitesGet_Call(request,onOk,eventListener,sender); } } - /// The operation to create a vCenter object.. + /// Method to get site health summary. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site 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.Migrate.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task SitesGet1(string subscriptionId, string resourceGroupName, string siteName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-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.OffAzure/VMwareSites/" + + global::System.Uri.EscapeDataString(siteName) + + "/healthSummary" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.SitesGet1_Call(request,onOk,eventListener,sender); + } + } + + /// Method to get site health summary. /// - /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IAddVCenterRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task SitesGet1ViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2020-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); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/VMwareSites/(?[^/]+)/healthSummary$", 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}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/VMwareSites/{siteName}/healthSummary'"); } // 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; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var siteName = _match.Groups["siteName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.RecoveryServices/vaults/" - + resourceName - + "/replicationFabrics/" - + fabricName - + "/replicationvCenters/" - + vcenterName + + "/providers/Microsoft.OffAzure/VMwareSites/" + + siteName + + "/healthSummary" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -37776,20 +47803,16 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationvCentersCreate_Call(request,onOk,eventListener,sender); + await this.SitesGet1_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -37797,7 +47820,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task SitesGet1_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -37808,105 +47831,6 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - break; - } - } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -37914,7 +47838,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.VCenterAutoGenerated.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.SiteHealthSummaryCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -37934,48 +47858,39 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get - /// validation events back. + /// 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. - /// Azure Subscription Id in which migrate project was created. - /// Fabric name. - /// vcenter name. - /// The input to the add vCenter operation. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site 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 ReplicationvCentersCreate_Validate(string resourceName, string resourceGroupName, string subscriptionId, string fabricName, string vcenterName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IAddVCenterRequest body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task SitesGet1_Validate(string subscriptionId, string resourceGroupName, string siteName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(siteName),siteName); } } - /// 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. - /// Azure Subscription Id in which migrate project was created. - /// Fabric name. - /// vcenter name. - /// a delegate that is called when the remote service returns 204 (NoContent). + /// Method to get site usage/summary. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task SitesGet2(string subscriptionId, string resourceGroupName, string siteName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2020-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -37985,12 +47900,9 @@ public partial class Migrate + 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) + + "/providers/Microsoft.OffAzure/VMwareSites/" + + global::System.Uri.EscapeDataString(siteName) + + "/summary" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -37999,55 +47911,50 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationvCentersDelete_Call(request,onNoContent,eventListener,sender); + await this.SitesGet2_Call(request,onOk,eventListener,sender); } } - /// The operation to remove(unregister) a registered vCenter server from the vault. + /// Method to get site usage/summary. /// - /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task SitesGet2ViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2020-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); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/VMwareSites/(?[^/]+)/summary$", 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}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/VMwareSites/{siteName}/summary'"); } // 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; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var siteName = _match.Groups["siteName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.RecoveryServices/vaults/" - + resourceName - + "/replicationFabrics/" - + fabricName - + "/replicationvCenters/" - + vcenterName + + "/providers/Microsoft.OffAzure/VMwareSites/" + + siteName + + "/summary" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -38056,24 +47963,24 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationvCentersDelete_Call(request,onNoContent,eventListener,sender); + await this.SitesGet2_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task SitesGet2_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -38084,114 +47991,14 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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: + case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onNoContent(_response); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.VMwareSiteUsage.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -38209,80 +48016,29 @@ public partial class Migrate } } } - - /// - /// 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. - /// Azure Subscription Id in which migrate project was created. - /// 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.Migrate.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. - /// Azure Subscription Id in which migrate project was created. - /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - // generate request object - var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } - // make the call - await this.ReplicationvCentersGet_Call(request,onOk,eventListener,sender); + + /// + /// Validation method for method. Call this like the actual call, but you will get validation events + /// back. + /// + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site 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 SitesGet2_Validate(string subscriptionId, string resourceGroupName, string siteName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(siteName),siteName); } } - /// Gets the details of a registered vCenter server(Add vCenter server). + /// Method to get a site. /// /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. @@ -38290,38 +48046,32 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task SitesGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2020-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); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/VMwareSites/(?[^/]+)$", 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}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/VMwareSites/{siteName}'"); } // 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; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var siteName = _match.Groups["siteName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.RecoveryServices/vaults/" - + resourceName - + "/replicationFabrics/" - + fabricName - + "/replicationvCenters/" - + vcenterName + + "/providers/Microsoft.OffAzure/VMwareSites/" + + siteName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -38335,11 +48085,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationvCentersGet_Call(request,onOk,eventListener,sender); + await this.SitesGet_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -38347,7 +48097,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task SitesGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -38365,7 +48115,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.VCenterAutoGenerated.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.VMwareSite.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -38385,86 +48135,39 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation - /// events back. + /// 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. - /// Azure Subscription Id in which migrate project was created. - /// Fabric name. - /// vcenter name. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site 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.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task SitesGet_Validate(string subscriptionId, string resourceGroupName, string siteName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. - /// Azure Subscription Id in which migrate project was created. - /// a delegate that is called when the remote service returns 200 (OK). - /// an instance that will receive events. - /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - // generate request object - var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } - // make the call - await this.ReplicationvCentersList_Call(request,onOk,eventListener,sender); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(siteName),siteName); } } - /// 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. - /// Azure Subscription Id in which migrate project was created. - /// Fabric name. - /// a delegate that is called when the remote service returns 200 (OK). + /// Method to refresh a site. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site name. + /// a delegate that is called when the remote service returns 202 (Accepted). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task SitesRefresh(string subscriptionId, string resourceGroupName, string siteName, global::System.Func onAccepted, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2020-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -38474,11 +48177,9 @@ public partial class Migrate + 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" + + "/providers/Microsoft.OffAzure/VMwareSites/" + + global::System.Uri.EscapeDataString(siteName) + + "/refresh" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -38487,53 +48188,50 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationvCentersListByReplicationFabrics_Call(request,onOk,eventListener,sender); + await this.SitesRefresh_Call(request,onAccepted,eventListener,sender); } } - /// Lists the vCenter servers registered in a fabric. + /// Method to refresh a site. /// - /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 202 (Accepted). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task SitesRefreshViaIdentity(global::System.String viaIdentity, global::System.Func onAccepted, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2020-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); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/VMwareSites/(?[^/]+)/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}/replicationFabrics/{fabricName}/replicationvCenters'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/VMwareSites/{siteName}/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; - var fabricName = _match.Groups["fabricName"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var siteName = _match.Groups["siteName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.RecoveryServices/vaults/" - + resourceName - + "/replicationFabrics/" - + fabricName - + "/replicationvCenters" + + "/providers/Microsoft.OffAzure/VMwareSites/" + + siteName + + "/refresh" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -38542,26 +48240,24 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationvCentersListByReplicationFabrics_Call(request,onOk,eventListener,sender); + await this.SitesRefresh_Call(request,onAccepted,eventListener,sender); } } - /// - /// Actual wire call for method. - /// + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 202 (Accepted). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task SitesRefresh_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onAccepted, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -38576,10 +48272,10 @@ public partial class Migrate switch ( _response.StatusCode ) { - case global::System.Net.HttpStatusCode.OK: + case global::System.Net.HttpStatusCode.Accepted: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.VCenterCollectionAutoGenerated.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onAccepted(_response); break; } default: @@ -38599,63 +48295,109 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, - /// but you will get validation events back. + /// 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. - /// Azure Subscription Id in which migrate project was created. - /// Fabric name. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site 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.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task SitesRefresh_Validate(string subscriptionId, string resourceGroupName, string siteName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(siteName),siteName); } } - /// Lists the vCenter servers registered in the vault. + /// Method to update an existing site. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site name. + /// Body with site details. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task SitesUpdate(string subscriptionId, string resourceGroupName, string siteName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVMwareSite body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-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.OffAzure/VMwareSites/" + + global::System.Uri.EscapeDataString(siteName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.SitesUpdate_Call(request,onOk,onCreated,eventListener,sender); + } + } + + /// Method to update an existing site. /// + /// Body with site details. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task SitesUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVMwareSite body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2020-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); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/VMwareSites/(?[^/]+)$", 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'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/VMwareSites/{siteName}'"); } // 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 resourceGroupName = _match.Groups["resourceGroupName"].Value; + var siteName = _match.Groups["siteName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.RecoveryServices/vaults/" - + resourceName - + "/replicationvCenters" + + "/providers/Microsoft.OffAzure/VMwareSites/" + + siteName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -38664,24 +48406,29 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationvCentersList_Call(request,onOk,eventListener,sender); + await this.SitesUpdate_Call(request,onOk,onCreated,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task SitesUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -38699,7 +48446,13 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.VCenterCollectionAutoGenerated.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.VMwareSite.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + case global::System.Net.HttpStatusCode.Created: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onCreated(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.VMwareSite.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -38719,42 +48472,43 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get - /// validation events back. + /// 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. - /// Azure Subscription Id in which migrate project was created. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site name. + /// Body with site details. /// 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.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task SitesUpdate_Validate(string subscriptionId, string resourceGroupName, string siteName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVMwareSite body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(siteName),siteName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// 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. + /// Cleanup the solution data in the migrate project. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. - /// vcenter name. - /// The input to the update vCenter operation. + /// Name of the Azure Resource Group that migrate project is part of. + /// Name of the Azure Migrate project. + /// Unique name of a migration solution within a migrate project. /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IUpdateVCenterRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task SolutionsCleanupSolutionData(string subscriptionId, string resourceGroupName, string migrateProjectName, string solutionName, global::System.Func onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2018-09-01-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -38764,12 +48518,11 @@ public partial class Migrate + 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) + + "/providers/Microsoft.Migrate/migrateProjects/" + + global::System.Uri.EscapeDataString(migrateProjectName) + + "/solutions/" + + global::System.Uri.EscapeDataString(solutionName) + + "/cleanupData" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -38778,60 +48531,53 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationvCentersUpdate_Call(request,onOk,eventListener,sender); + await this.SolutionsCleanupSolutionData_Call(request,onOk,eventListener,sender); } } - /// The operation to update a registered vCenter. + /// Cleanup the solution data in the migrate project. /// - /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Models.Api202301.IUpdateVCenterRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task SolutionsCleanupSolutionDataViaIdentity(global::System.String viaIdentity, global::System.Func onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2018-09-01-preview"; // 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); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Migrate/migrateProjects/(?[^/]+)/solutions/(?[^/]+)/cleanupData$", 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}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/migrateProjects/{migrateProjectName}/solutions/{solutionName}/cleanupData'"); } // 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; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var migrateProjectName = _match.Groups["migrateProjectName"].Value; + var solutionName = _match.Groups["solutionName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.RecoveryServices/vaults/" - + resourceName - + "/replicationFabrics/" - + fabricName - + "/replicationvCenters/" - + vcenterName + + "/providers/Microsoft.Migrate/migrateProjects/" + + migrateProjectName + + "/solutions/" + + solutionName + + "/cleanupData" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -38840,20 +48586,16 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.ReplicationvCentersUpdate_Call(request,onOk,eventListener,sender); + await this.SolutionsCleanupSolutionData_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -38861,7 +48603,7 @@ public partial class Migrate /// /// 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task SolutionsCleanupSolutionData_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -38872,105 +48614,6 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - break; - } - } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -38978,7 +48621,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.VCenterAutoGenerated.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response); break; } default: @@ -38998,47 +48641,43 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get - /// validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. - /// vcenter name. - /// The input to the update vCenter operation. + /// Name of the Azure Resource Group that migrate project is part of. + /// Name of the Azure Migrate project. + /// Unique name of a migration solution within a migrate project. /// 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.Migrate.Models.Api202301.IUpdateVCenterRequest body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task SolutionsCleanupSolutionData_Validate(string subscriptionId, string resourceGroupName, string migrateProjectName, string solutionName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(migrateProjectName),migrateProjectName); + await eventListener.AssertNotNull(nameof(solutionName),solutionName); } - } - - /// Method to get run as account. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// Site name. - /// Run as account ARM name. + } + + /// Delete the solution. Deleting non-existent project is a no-operation. + /// Azure Subscription Id in which migrate project was created. + /// Name of the Azure Resource Group that migrate project is part of. + /// Name of the Azure Migrate project. + /// Unique name of a migration solution within a migrate project. + /// Standard request header. Used by service to respond to client in appropriate language. /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task RunAsAccountsGet(string subscriptionId, string resourceGroupName, string siteName, string accountName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task SolutionsDeleteSolution(string subscriptionId, string resourceGroupName, string migrateProjectName, string solutionName, string acceptLanguage, global::System.Func onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2018-09-01-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -39048,10 +48687,10 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.OffAzure/VMwareSites/" - + global::System.Uri.EscapeDataString(siteName) - + "/runAsAccounts/" - + global::System.Uri.EscapeDataString(accountName) + + "/providers/Microsoft.Migrate/migrateProjects/" + + global::System.Uri.EscapeDataString(migrateProjectName) + + "/solutions/" + + global::System.Uri.EscapeDataString(solutionName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -39060,52 +48699,59 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + // add headers parameters + if (null != acceptLanguage) + { + request.Headers.Add("Accept-Language",acceptLanguage); + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.RunAsAccountsGet_Call(request,onOk,eventListener,sender); + await this.SolutionsDeleteSolution_Call(request,onOk,eventListener,sender); } } - /// Method to get run as account. + /// Delete the solution. Deleting non-existent project is a no-operation. /// + /// Standard request header. Used by service to respond to client in appropriate language. /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task RunAsAccountsGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task SolutionsDeleteSolutionViaIdentity(global::System.String viaIdentity, string acceptLanguage, global::System.Func onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2018-09-01-preview"; // 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.OffAzure/VMwareSites/(?[^/]+)/runAsAccounts/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Migrate/migrateProjects/(?[^/]+)/solutions/(?[^/]+)$", 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.OffAzure/VMwareSites/{siteName}/runAsAccounts/{accountName}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/migrateProjects/{migrateProjectName}/solutions/{solutionName}'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var siteName = _match.Groups["siteName"].Value; - var accountName = _match.Groups["accountName"].Value; + var migrateProjectName = _match.Groups["migrateProjectName"].Value; + var solutionName = _match.Groups["solutionName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.OffAzure/VMwareSites/" - + siteName - + "/runAsAccounts/" - + accountName + + "/providers/Microsoft.Migrate/migrateProjects/" + + migrateProjectName + + "/solutions/" + + solutionName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -39114,16 +48760,22 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + // add headers parameters + if (null != acceptLanguage) + { + request.Headers.Add("Accept-Language",acceptLanguage); + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.RunAsAccountsGet_Call(request,onOk,eventListener,sender); + await this.SolutionsDeleteSolution_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -39131,7 +48783,7 @@ public partial class Migrate /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task RunAsAccountsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task SolutionsDeleteSolution_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -39149,7 +48801,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.VMwareRunAsAccount.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response); break; } default: @@ -39169,41 +48821,44 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation - /// events back. + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. /// - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// Site name. - /// Run as account ARM name. + /// Azure Subscription Id in which migrate project was created. + /// Name of the Azure Resource Group that migrate project is part of. + /// Name of the Azure Migrate project. + /// Unique name of a migration solution within a migrate project. + /// Standard request header. Used by service to respond to client in appropriate language. /// 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 RunAsAccountsGet_Validate(string subscriptionId, string resourceGroupName, string siteName, string accountName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task SolutionsDeleteSolution_Validate(string subscriptionId, string resourceGroupName, string migrateProjectName, string solutionName, string acceptLanguage, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(siteName),siteName); - await eventListener.AssertNotNull(nameof(accountName),accountName); + await eventListener.AssertNotNull(nameof(migrateProjectName),migrateProjectName); + await eventListener.AssertNotNull(nameof(solutionName),solutionName); + await eventListener.AssertNotNull(nameof(acceptLanguage),acceptLanguage); } } - /// Method to get run as accounts. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// Site name. + /// Gets the config for the solution in the migrate project. + /// Azure Subscription Id in which migrate project was created. + /// Name of the Azure Resource Group that migrate project is part of. + /// Name of the Azure Migrate project. + /// Unique name of a migration solution within a migrate project. /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task RunAsAccountsList(string subscriptionId, string resourceGroupName, string siteName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task SolutionsGetConfig(string subscriptionId, string resourceGroupName, string migrateProjectName, string solutionName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2018-09-01-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -39213,9 +48868,11 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.OffAzure/VMwareSites/" - + global::System.Uri.EscapeDataString(siteName) - + "/runAsAccounts" + + "/providers/Microsoft.Migrate/migrateProjects/" + + global::System.Uri.EscapeDataString(migrateProjectName) + + "/solutions/" + + global::System.Uri.EscapeDataString(solutionName) + + "/getConfig" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -39224,16 +48881,16 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.RunAsAccountsList_Call(request,onOk,eventListener,sender); + await this.SolutionsGetConfig_Call(request,onOk,eventListener,sender); } } - /// Method to get run as accounts. + /// Gets the config for the solution in the migrate project. /// /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. @@ -39241,33 +48898,36 @@ public partial class Migrate /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task RunAsAccountsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task SolutionsGetConfigViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2018-09-01-preview"; // 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.OffAzure/VMwareSites/(?[^/]+)/runAsAccounts$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Migrate/migrateProjects/(?[^/]+)/solutions/(?[^/]+)/getConfig$", 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.OffAzure/VMwareSites/{siteName}/runAsAccounts'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/migrateProjects/{migrateProjectName}/solutions/{solutionName}/getConfig'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var siteName = _match.Groups["siteName"].Value; + var migrateProjectName = _match.Groups["migrateProjectName"].Value; + var solutionName = _match.Groups["solutionName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.OffAzure/VMwareSites/" - + siteName - + "/runAsAccounts" + + "/providers/Microsoft.Migrate/migrateProjects/" + + migrateProjectName + + "/solutions/" + + solutionName + + "/getConfig" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -39276,16 +48936,16 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.RunAsAccountsList_Call(request,onOk,eventListener,sender); + await this.SolutionsGetConfig_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -39293,7 +48953,7 @@ public partial class Migrate /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task RunAsAccountsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task SolutionsGetConfig_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -39311,7 +48971,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.VMwareRunAsAccountCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.SolutionConfig.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -39331,41 +48991,42 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation + /// Validation method for method. Call this like the actual call, but you will get validation /// events back. /// - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// Site name. + /// Azure Subscription Id in which migrate project was created. + /// Name of the Azure Resource Group that migrate project is part of. + /// Name of the Azure Migrate project. + /// Unique name of a migration solution within a migrate project. /// 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 RunAsAccountsList_Validate(string subscriptionId, string resourceGroupName, string siteName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task SolutionsGetConfig_Validate(string subscriptionId, string resourceGroupName, string migrateProjectName, string solutionName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(siteName),siteName); + await eventListener.AssertNotNull(nameof(migrateProjectName),migrateProjectName); + await eventListener.AssertNotNull(nameof(solutionName),solutionName); } } - /// Method to create or update a site. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// Site name. - /// Body with site details. + /// Gets a solution in the migrate project. + /// Azure Subscription Id in which migrate project was created. + /// Name of the Azure Resource Group that migrate project is part of. + /// Name of the Azure Migrate project. + /// Unique name of a migration solution within a migrate project. /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns 201 (Created). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task SitesCreateOrUpdate(string subscriptionId, string resourceGroupName, string siteName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVMwareSite body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task SolutionsGetSolution(string subscriptionId, string resourceGroupName, string migrateProjectName, string solutionName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2018-09-01-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -39375,8 +49036,10 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.OffAzure/VMwareSites/" - + global::System.Uri.EscapeDataString(siteName) + + "/providers/Microsoft.Migrate/migrateProjects/" + + global::System.Uri.EscapeDataString(migrateProjectName) + + "/solutions/" + + global::System.Uri.EscapeDataString(solutionName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -39385,55 +49048,52 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.SitesCreateOrUpdate_Call(request,onOk,onCreated,eventListener,sender); + await this.SolutionsGetSolution_Call(request,onOk,eventListener,sender); } } - /// Method to create or update a site. + /// Gets a solution in the migrate project. /// - /// Body with site details. /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns 201 (Created). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task SitesCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVMwareSite body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task SolutionsGetSolutionViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2018-09-01-preview"; // 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.OffAzure/VMwareSites/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Migrate/migrateProjects/(?[^/]+)/solutions/(?[^/]+)$", 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.OffAzure/VMwareSites/{siteName}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/migrateProjects/{migrateProjectName}/solutions/{solutionName}'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var siteName = _match.Groups["siteName"].Value; + var migrateProjectName = _match.Groups["migrateProjectName"].Value; + var solutionName = _match.Groups["solutionName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.OffAzure/VMwareSites/" - + siteName + + "/providers/Microsoft.Migrate/migrateProjects/" + + migrateProjectName + + "/solutions/" + + solutionName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -39442,29 +49102,24 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.SitesCreateOrUpdate_Call(request,onOk,onCreated,eventListener,sender); + await this.SolutionsGetSolution_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns 201 (Created). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 SitesCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task SolutionsGetSolution_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -39482,13 +49137,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.VMwareSite.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - case global::System.Net.HttpStatusCode.Created: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onCreated(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.VMwareSite.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.Solution.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -39508,43 +49157,41 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation + /// Validation method for method. Call this like the actual call, but you will get validation /// events back. /// - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// Site name. - /// Body with site details. + /// Azure Subscription Id in which migrate project was created. + /// Name of the Azure Resource Group that migrate project is part of. + /// Name of the Azure Migrate project. + /// Unique name of a migration solution within a migrate project. /// 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 SitesCreateOrUpdate_Validate(string subscriptionId, string resourceGroupName, string siteName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVMwareSite body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task SolutionsGetSolution_Validate(string subscriptionId, string resourceGroupName, string migrateProjectName, string solutionName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(siteName),siteName); - await eventListener.AssertNotNull(nameof(body), body); - await eventListener.AssertObjectIsValid(nameof(body), body); + await eventListener.AssertNotNull(nameof(migrateProjectName),migrateProjectName); + await eventListener.AssertNotNull(nameof(solutionName),solutionName); } } - /// Method to delete a site. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// Site name. + /// Gets the list of solutions in the migrate project. + /// Azure Subscription Id in which migrate project was created. + /// Name of the Azure Resource Group that migrate project is part of. + /// Name of the Azure Migrate project. /// a delegate that is called when the remote service returns 200 (OK). - /// 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.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task SitesDeleteSite(string subscriptionId, string resourceGroupName, string siteName, global::System.Func onOk, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task SolutionsList(string subscriptionId, string resourceGroupName, string migrateProjectName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2018-09-01-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -39554,8 +49201,9 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.OffAzure/VMwareSites/" - + global::System.Uri.EscapeDataString(siteName) + + "/providers/Microsoft.Migrate/migrateProjects/" + + global::System.Uri.EscapeDataString(migrateProjectName) + + "/solutions" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -39564,50 +49212,50 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.SitesDeleteSite_Call(request,onOk,onNoContent,eventListener,sender); + await this.SolutionsList_Call(request,onOk,eventListener,sender); } } - /// Method to delete a site. + /// Gets the list of solutions in the migrate project. /// /// a delegate that is called when the remote service returns 200 (OK). - /// 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.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task SitesDeleteSiteViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task SolutionsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2018-09-01-preview"; // 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.OffAzure/VMwareSites/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Migrate/migrateProjects/(?[^/]+)/solutions$", 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.OffAzure/VMwareSites/{siteName}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/migrateProjects/{migrateProjectName}/solutions'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var siteName = _match.Groups["siteName"].Value; + var migrateProjectName = _match.Groups["migrateProjectName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.OffAzure/VMwareSites/" - + siteName + + "/providers/Microsoft.Migrate/migrateProjects/" + + migrateProjectName + + "/solutions" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -39616,25 +49264,24 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.SitesDeleteSite_Call(request,onOk,onNoContent,eventListener,sender); + await this.SolutionsList_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). - /// 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.Migrate.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 SitesDeleteSite_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task SolutionsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -39652,13 +49299,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response); - break; - } - case global::System.Net.HttpStatusCode.NoContent: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onNoContent(_response); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.SolutionsCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -39678,80 +49319,43 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation + /// Validation method for method. Call this like the actual call, but you will get validation /// events back. /// - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// Site name. + /// Azure Subscription Id in which migrate project was created. + /// Name of the Azure Resource Group that migrate project is part of. + /// Name of the Azure Migrate project. /// 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 SitesDeleteSite_Validate(string subscriptionId, string resourceGroupName, string siteName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task SolutionsList_Validate(string subscriptionId, string resourceGroupName, string migrateProjectName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(siteName),siteName); - } - } - - /// Method to get a site. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// Site 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.Migrate.Runtime.ISendAsync pipeline to use to make the request. - /// - /// A that will be complete when handling of the response is completed. - /// - public async global::System.Threading.Tasks.Task SitesGet(string subscriptionId, string resourceGroupName, string siteName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) - { - var apiVersion = @"2020-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.OffAzure/VMwareSites/" - + global::System.Uri.EscapeDataString(siteName) - + "?" - + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) - ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - // generate request object - var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } - // make the call - await this.SitesGet_Call(request,onOk,eventListener,sender); + await eventListener.AssertNotNull(nameof(migrateProjectName),migrateProjectName); } } - /// Method to get site health summary. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// Site name. + /// + /// Update a solution with specified name. Supports partial updates, for example only tags can be provided. + /// + /// Azure Subscription Id in which migrate project was created. + /// Name of the Azure Resource Group that migrate project is part of. + /// Name of the Azure Migrate project. + /// Unique name of a migration solution within a migrate project. + /// The input for the solution. /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task SitesGet1(string subscriptionId, string resourceGroupName, string siteName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task SolutionsPatchSolution(string subscriptionId, string resourceGroupName, string migrateProjectName, string solutionName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.ISolution body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2018-09-01-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -39761,9 +49365,10 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.OffAzure/VMwareSites/" - + global::System.Uri.EscapeDataString(siteName) - + "/healthSummary" + + "/providers/Microsoft.Migrate/migrateProjects/" + + global::System.Uri.EscapeDataString(migrateProjectName) + + "/solutions/" + + global::System.Uri.EscapeDataString(solutionName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -39772,50 +49377,59 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.SitesGet1_Call(request,onOk,eventListener,sender); + await this.SolutionsPatchSolution_Call(request,onOk,eventListener,sender); } } - /// Method to get site health summary. + /// + /// Update a solution with specified name. Supports partial updates, for example only tags can be provided. + /// /// + /// The input for the solution. /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task SitesGet1ViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task SolutionsPatchSolutionViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.ISolution body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2018-09-01-preview"; // 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.OffAzure/VMwareSites/(?[^/]+)/healthSummary$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Migrate/migrateProjects/(?[^/]+)/solutions/(?[^/]+)$", 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.OffAzure/VMwareSites/{siteName}/healthSummary'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/migrateProjects/{migrateProjectName}/solutions/{solutionName}'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var siteName = _match.Groups["siteName"].Value; + var migrateProjectName = _match.Groups["migrateProjectName"].Value; + var solutionName = _match.Groups["solutionName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.OffAzure/VMwareSites/" - + siteName - + "/healthSummary" + + "/providers/Microsoft.Migrate/migrateProjects/" + + migrateProjectName + + "/solutions/" + + solutionName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -39824,16 +49438,20 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.SitesGet1_Call(request,onOk,eventListener,sender); + await this.SolutionsPatchSolution_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -39841,7 +49459,7 @@ public partial class Migrate /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task SitesGet1_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task SolutionsPatchSolution_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -39859,7 +49477,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.SiteHealthSummaryCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.Solution.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -39879,39 +49497,47 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation events - /// back. + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. /// - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// Site name. + /// Azure Subscription Id in which migrate project was created. + /// Name of the Azure Resource Group that migrate project is part of. + /// Name of the Azure Migrate project. + /// Unique name of a migration solution within a migrate project. + /// The input for the solution. /// 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 SitesGet1_Validate(string subscriptionId, string resourceGroupName, string siteName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task SolutionsPatchSolution_Validate(string subscriptionId, string resourceGroupName, string migrateProjectName, string solutionName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.ISolution body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(siteName),siteName); + await eventListener.AssertNotNull(nameof(migrateProjectName),migrateProjectName); + await eventListener.AssertNotNull(nameof(solutionName),solutionName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// Method to get site usage/summary. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// Site name. + /// Creates a solution in the migrate project. + /// Azure Subscription Id in which migrate project was created. + /// Name of the Azure Resource Group that migrate project is part of. + /// Name of the Azure Migrate project. + /// Unique name of a migration solution within a migrate project. + /// The input for the solution. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task SitesGet2(string subscriptionId, string resourceGroupName, string siteName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task SolutionsPutSolution(string subscriptionId, string resourceGroupName, string migrateProjectName, string solutionName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.ISolution body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2018-09-01-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -39921,9 +49547,10 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.OffAzure/VMwareSites/" - + global::System.Uri.EscapeDataString(siteName) - + "/summary" + + "/providers/Microsoft.Migrate/migrateProjects/" + + global::System.Uri.EscapeDataString(migrateProjectName) + + "/solutions/" + + global::System.Uri.EscapeDataString(solutionName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -39932,50 +49559,58 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.SitesGet2_Call(request,onOk,eventListener,sender); + await this.SolutionsPutSolution_Call(request,onOk,onCreated,eventListener,sender); } } - /// Method to get site usage/summary. + /// Creates a solution in the migrate project. /// + /// The input for the solution. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task SitesGet2ViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task SolutionsPutSolutionViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.ISolution body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2018-09-01-preview"; // 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.OffAzure/VMwareSites/(?[^/]+)/summary$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Migrate/migrateProjects/(?[^/]+)/solutions/(?[^/]+)$", 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.OffAzure/VMwareSites/{siteName}/summary'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/migrateProjects/{migrateProjectName}/solutions/{solutionName}'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var siteName = _match.Groups["siteName"].Value; + var migrateProjectName = _match.Groups["migrateProjectName"].Value; + var solutionName = _match.Groups["solutionName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.OffAzure/VMwareSites/" - + siteName - + "/summary" + + "/providers/Microsoft.Migrate/migrateProjects/" + + migrateProjectName + + "/solutions/" + + solutionName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -39984,24 +49619,29 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.SitesGet2_Call(request,onOk,eventListener,sender); + await this.SolutionsPutSolution_Call(request,onOk,onCreated,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 SitesGet2_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task SolutionsPutSolution_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -40019,7 +49659,13 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.VMwareSiteUsage.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.Solution.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + case global::System.Net.HttpStatusCode.Created: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onCreated(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.Solution.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -40039,62 +49685,116 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation events - /// back. + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. /// - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// Site name. + /// Azure Subscription Id in which migrate project was created. + /// Name of the Azure Resource Group that migrate project is part of. + /// Name of the Azure Migrate project. + /// Unique name of a migration solution within a migrate project. + /// The input for the solution. /// 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 SitesGet2_Validate(string subscriptionId, string resourceGroupName, string siteName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task SolutionsPutSolution_Validate(string subscriptionId, string resourceGroupName, string migrateProjectName, string solutionName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.ISolution body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(siteName),siteName); + await eventListener.AssertNotNull(nameof(migrateProjectName),migrateProjectName); + await eventListener.AssertNotNull(nameof(solutionName),solutionName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// Method to get a site. + /// 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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task SitesGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + 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.OffAzure/VMwareSites/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + 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.OffAzure/VMwareSites/{siteName}'"); + 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 subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceName = _match.Groups["resourceName"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var siteName = _match.Groups["siteName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.OffAzure/VMwareSites/" - + siteName + + "/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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -40106,11 +49806,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.SitesGet_Call(request,onOk,eventListener,sender); + await this.SupportedOperatingSystemsGet_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -40118,7 +49818,7 @@ public partial class Migrate /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task SitesGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -40136,7 +49836,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.VMwareSite.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.SupportedOperatingSystems.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -40156,39 +49856,44 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation events - /// back. + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. /// - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// Site name. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// Azure Subscription Id in which migrate project was created. + /// 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 SitesGet_Validate(string subscriptionId, string resourceGroupName, string siteName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task SupportedOperatingSystemsGet_Validate(string resourceName, string resourceGroupName, string subscriptionId, string instanceType, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { - await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceName),resourceName); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(siteName),siteName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(instanceType),instanceType); } } - /// Method to refresh a site. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// Site name. - /// a delegate that is called when the remote service returns 202 (Accepted). + /// 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. + /// Azure Subscription Id in which migrate project was created. + /// 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.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task SitesRefresh(string subscriptionId, string resourceGroupName, string siteName, global::System.Func onAccepted, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2023-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -40198,9 +49903,15 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.OffAzure/VMwareSites/" - + global::System.Uri.EscapeDataString(siteName) - + "/refresh" + + "/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"); @@ -40209,50 +49920,59 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.SitesRefresh_Call(request,onAccepted,eventListener,sender); + await this.TargetComputeSizesListByReplicationProtectedItems_Call(request,onOk,eventListener,sender); } } - /// Method to refresh a site. + /// Lists the available target compute sizes for a replication protected item. /// - /// a delegate that is called when the remote service returns 202 (Accepted). + /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task SitesRefreshViaIdentity(global::System.String viaIdentity, global::System.Func onAccepted, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + 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.OffAzure/VMwareSites/(?[^/]+)/refresh$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + 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.OffAzure/VMwareSites/{siteName}/refresh'"); + 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 subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceName = _match.Groups["resourceName"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var siteName = _match.Groups["siteName"].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.OffAzure/VMwareSites/" - + siteName - + "/refresh" + + "/providers/Microsoft.RecoveryServices/vaults/" + + resourceName + + "/replicationFabrics/" + + fabricName + + "/replicationProtectionContainers/" + + protectionContainerName + + "/replicationProtectedItems/" + + replicatedProtectedItemName + + "/targetComputeSizes" + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -40261,24 +49981,26 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.SitesRefresh_Call(request,onAccepted,eventListener,sender); + await this.TargetComputeSizesListByReplicationProtectedItems_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// + /// Actual wire call for method. + /// /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 202 (Accepted). + /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 SitesRefresh_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onAccepted, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -40293,10 +50015,10 @@ public partial class Migrate switch ( _response.StatusCode ) { - case global::System.Net.HttpStatusCode.Accepted: + case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onAccepted(_response); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.TargetComputeSizeCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -40316,39 +50038,45 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation - /// events back. + /// Validation method for method. Call this like the actual + /// call, but you will get validation events back. /// - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// Site name. + /// The name of the recovery services vault. + /// The name of the resource group where the recovery services vault is present. + /// Azure Subscription Id in which migrate project was created. + /// 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 SitesRefresh_Validate(string subscriptionId, string resourceGroupName, string siteName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + 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.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { - await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceName),resourceName); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(siteName),siteName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(fabricName),fabricName); + await eventListener.AssertNotNull(nameof(protectionContainerName),protectionContainerName); + await eventListener.AssertNotNull(nameof(replicatedProtectedItemName),replicatedProtectedItemName); } } - /// Method to update an existing site. + /// Method to create or update a vCenter in site. /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Site name. - /// Body with site details. - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns 201 (Created). + /// VCenter ARM name. + /// Put vCenter body. + /// a delegate that is called when the remote service returns 202 (Accepted). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task SitesUpdate(string subscriptionId, string resourceGroupName, string siteName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVMwareSite body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task VCenterCreateOrUpdate(string subscriptionId, string resourceGroupName, string siteName, string vcenterName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVCenter body, global::System.Func onAccepted, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2020-01-01"; // Constant Parameters @@ -40362,6 +50090,8 @@ public partial class Migrate + global::System.Uri.EscapeDataString(resourceGroupName) + "/providers/Microsoft.OffAzure/VMwareSites/" + global::System.Uri.EscapeDataString(siteName) + + "/vCenters/" + + global::System.Uri.EscapeDataString(vcenterName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -40370,7 +50100,7 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -40379,21 +50109,20 @@ public partial class Migrate request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.SitesUpdate_Call(request,onOk,onCreated,eventListener,sender); + await this.VCenterCreateOrUpdate_Call(request,onAccepted,eventListener,sender); } } - /// Method to update an existing site. + /// Method to create or update a vCenter in site. /// - /// Body with site details. - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns 201 (Created). + /// Put vCenter body. + /// a delegate that is called when the remote service returns 202 (Accepted). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task SitesUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVMwareSite body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task VCenterCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVCenter body, global::System.Func onAccepted, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { var apiVersion = @"2020-01-01"; // Constant Parameters @@ -40401,16 +50130,17 @@ public partial class Migrate { // verify that Identity format is an exact match for uri - var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/VMwareSites/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/VMwareSites/(?[^/]+)/vCenters/(?[^/]+)$", 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.OffAzure/VMwareSites/{siteName}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/VMwareSites/{siteName}/vCenters/{vcenterName}'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; var siteName = _match.Groups["siteName"].Value; + var vcenterName = _match.Groups["vcenterName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" @@ -40419,6 +50149,8 @@ public partial class Migrate + resourceGroupName + "/providers/Microsoft.OffAzure/VMwareSites/" + siteName + + "/vCenters/" + + vcenterName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -40427,7 +50159,7 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -40436,20 +50168,19 @@ public partial class Migrate request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.SitesUpdate_Call(request,onOk,onCreated,eventListener,sender); + await this.VCenterCreateOrUpdate_Call(request,onAccepted,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns 201 (Created). + /// a delegate that is called when the remote service returns 202 (Accepted). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 SitesUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task VCenterCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onAccepted, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -40464,16 +50195,10 @@ public partial class Migrate switch ( _response.StatusCode ) { - case global::System.Net.HttpStatusCode.OK: - { - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.VMwareSite.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); - break; - } - case global::System.Net.HttpStatusCode.Created: + case global::System.Net.HttpStatusCode.Accepted: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onCreated(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.VMwareSite.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onAccepted(_response); break; } default: @@ -40493,43 +50218,46 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation events - /// back. + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. /// /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Site name. - /// Body with site details. + /// VCenter ARM name. + /// Put vCenter body. /// 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 SitesUpdate_Validate(string subscriptionId, string resourceGroupName, string siteName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVMwareSite body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task VCenterCreateOrUpdate_Validate(string subscriptionId, string resourceGroupName, string siteName, string vcenterName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVCenter body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); await eventListener.AssertNotNull(nameof(siteName),siteName); + await eventListener.AssertNotNull(nameof(vcenterName),vcenterName); await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// Cleanup the solution data in the migrate project. - /// Azure Subscription Id in which migrate project was created. - /// Name of the Azure Resource Group that migrate project is part of. - /// Name of the Azure Migrate project. - /// Unique name of a migration solution within a migrate project. + /// Method to delete vCenter in site. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site name. + /// VCenter ARM name. /// a delegate that is called when the remote service returns 200 (OK). + /// 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.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task SolutionsCleanupSolutionData(string subscriptionId, string resourceGroupName, string migrateProjectName, string solutionName, global::System.Func onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task VCenterDeleteVcenter(string subscriptionId, string resourceGroupName, string siteName, string vcenterName, global::System.Func onOk, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2018-09-01-preview"; + var apiVersion = @"2020-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -40539,11 +50267,10 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.Migrate/migrateProjects/" - + global::System.Uri.EscapeDataString(migrateProjectName) - + "/solutions/" - + global::System.Uri.EscapeDataString(solutionName) - + "/cleanupData" + + "/providers/Microsoft.OffAzure/VMwareSites/" + + global::System.Uri.EscapeDataString(siteName) + + "/vCenters/" + + global::System.Uri.EscapeDataString(vcenterName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -40552,53 +50279,53 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.SolutionsCleanupSolutionData_Call(request,onOk,eventListener,sender); + await this.VCenterDeleteVcenter_Call(request,onOk,onNoContent,eventListener,sender); } } - /// Cleanup the solution data in the migrate project. + /// Method to delete vCenter in site. /// /// a delegate that is called when the remote service returns 200 (OK). + /// 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.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task SolutionsCleanupSolutionDataViaIdentity(global::System.String viaIdentity, global::System.Func onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task VCenterDeleteVcenterViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2018-09-01-preview"; + var apiVersion = @"2020-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.Migrate/migrateProjects/(?[^/]+)/solutions/(?[^/]+)/cleanupData$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/VMwareSites/(?[^/]+)/vCenters/(?[^/]+)$", 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.Migrate/migrateProjects/{migrateProjectName}/solutions/{solutionName}/cleanupData'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/VMwareSites/{siteName}/vCenters/{vcenterName}'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var migrateProjectName = _match.Groups["migrateProjectName"].Value; - var solutionName = _match.Groups["solutionName"].Value; + var siteName = _match.Groups["siteName"].Value; + var vcenterName = _match.Groups["vcenterName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.Migrate/migrateProjects/" - + migrateProjectName - + "/solutions/" - + solutionName - + "/cleanupData" + + "/providers/Microsoft.OffAzure/VMwareSites/" + + siteName + + "/vCenters/" + + vcenterName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -40607,24 +50334,25 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.SolutionsCleanupSolutionData_Call(request,onOk,eventListener,sender); + await this.VCenterDeleteVcenter_Call(request,onOk,onNoContent,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). + /// 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.Migrate.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 SolutionsCleanupSolutionData_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task VCenterDeleteVcenter_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -40645,6 +50373,12 @@ public partial class Migrate await onOk(_response); break; } + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } default: { throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); @@ -40662,43 +50396,42 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will - /// get validation events back. + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. /// - /// Azure Subscription Id in which migrate project was created. - /// Name of the Azure Resource Group that migrate project is part of. - /// Name of the Azure Migrate project. - /// Unique name of a migration solution within a migrate project. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site name. + /// VCenter 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 SolutionsCleanupSolutionData_Validate(string subscriptionId, string resourceGroupName, string migrateProjectName, string solutionName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task VCenterDeleteVcenter_Validate(string subscriptionId, string resourceGroupName, string siteName, string vcenterName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(migrateProjectName),migrateProjectName); - await eventListener.AssertNotNull(nameof(solutionName),solutionName); + await eventListener.AssertNotNull(nameof(siteName),siteName); + await eventListener.AssertNotNull(nameof(vcenterName),vcenterName); } } - /// Delete the solution. Deleting non-existent project is a no-operation. - /// Azure Subscription Id in which migrate project was created. - /// Name of the Azure Resource Group that migrate project is part of. - /// Name of the Azure Migrate project. - /// Unique name of a migration solution within a migrate project. - /// Standard request header. Used by service to respond to client in appropriate language. + /// Method to get a vCenter. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site name. + /// VCenter ARM 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.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task SolutionsDeleteSolution(string subscriptionId, string resourceGroupName, string migrateProjectName, string solutionName, string acceptLanguage, global::System.Func onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task VCenterGet(string subscriptionId, string resourceGroupName, string siteName, string vcenterName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2018-09-01-preview"; + var apiVersion = @"2020-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -40708,10 +50441,10 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.Migrate/migrateProjects/" - + global::System.Uri.EscapeDataString(migrateProjectName) - + "/solutions/" - + global::System.Uri.EscapeDataString(solutionName) + + "/providers/Microsoft.OffAzure/VMwareSites/" + + global::System.Uri.EscapeDataString(siteName) + + "/vCenters/" + + global::System.Uri.EscapeDataString(vcenterName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -40720,59 +50453,52 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - // add headers parameters - if (null != acceptLanguage) - { - request.Headers.Add("Accept-Language",acceptLanguage); - } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.SolutionsDeleteSolution_Call(request,onOk,eventListener,sender); + await this.VCenterGet_Call(request,onOk,eventListener,sender); } } - /// Delete the solution. Deleting non-existent project is a no-operation. + /// Method to get a vCenter. /// - /// Standard request header. Used by service to respond to client in appropriate language. /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task SolutionsDeleteSolutionViaIdentity(global::System.String viaIdentity, string acceptLanguage, global::System.Func onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task VCenterGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2018-09-01-preview"; + var apiVersion = @"2020-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.Migrate/migrateProjects/(?[^/]+)/solutions/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/VMwareSites/(?[^/]+)/vCenters/(?[^/]+)$", 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.Migrate/migrateProjects/{migrateProjectName}/solutions/{solutionName}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/VMwareSites/{siteName}/vCenters/{vcenterName}'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var migrateProjectName = _match.Groups["migrateProjectName"].Value; - var solutionName = _match.Groups["solutionName"].Value; + var siteName = _match.Groups["siteName"].Value; + var vcenterName = _match.Groups["vcenterName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.Migrate/migrateProjects/" - + migrateProjectName - + "/solutions/" - + solutionName + + "/providers/Microsoft.OffAzure/VMwareSites/" + + siteName + + "/vCenters/" + + vcenterName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -40781,22 +50507,16 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - // add headers parameters - if (null != acceptLanguage) - { - request.Headers.Add("Accept-Language",acceptLanguage); - } - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.SolutionsDeleteSolution_Call(request,onOk,eventListener,sender); + await this.VCenterGet_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -40804,7 +50524,7 @@ public partial class Migrate /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task SolutionsDeleteSolution_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task VCenterGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -40822,7 +50542,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.VCenter.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -40842,44 +50562,42 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get - /// validation events back. + /// Validation method for method. Call this like the actual call, but you will get validation events + /// back. /// - /// Azure Subscription Id in which migrate project was created. - /// Name of the Azure Resource Group that migrate project is part of. - /// Name of the Azure Migrate project. - /// Unique name of a migration solution within a migrate project. - /// Standard request header. Used by service to respond to client in appropriate language. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site name. + /// VCenter 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 SolutionsDeleteSolution_Validate(string subscriptionId, string resourceGroupName, string migrateProjectName, string solutionName, string acceptLanguage, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task VCenterGet_Validate(string subscriptionId, string resourceGroupName, string siteName, string vcenterName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(migrateProjectName),migrateProjectName); - await eventListener.AssertNotNull(nameof(solutionName),solutionName); - await eventListener.AssertNotNull(nameof(acceptLanguage),acceptLanguage); + await eventListener.AssertNotNull(nameof(siteName),siteName); + await eventListener.AssertNotNull(nameof(vcenterName),vcenterName); } } - /// Gets the config for the solution in the migrate project. - /// Azure Subscription Id in which migrate project was created. - /// Name of the Azure Resource Group that migrate project is part of. - /// Name of the Azure Migrate project. - /// Unique name of a migration solution within a migrate project. + /// Method to get all vCenters in a site. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site 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.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task SolutionsGetConfig(string subscriptionId, string resourceGroupName, string migrateProjectName, string solutionName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task VCenterList(string subscriptionId, string resourceGroupName, string siteName, string Filter, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2018-09-01-preview"; + var apiVersion = @"2020-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -40889,84 +50607,84 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.Migrate/migrateProjects/" - + global::System.Uri.EscapeDataString(migrateProjectName) - + "/solutions/" - + global::System.Uri.EscapeDataString(solutionName) - + "/getConfig" + + "/providers/Microsoft.OffAzure/VMwareSites/" + + global::System.Uri.EscapeDataString(siteName) + + "/vCenters" + "?" + "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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.SolutionsGetConfig_Call(request,onOk,eventListener,sender); + await this.VCenterList_Call(request,onOk,eventListener,sender); } } - /// Gets the config for the solution in the migrate project. + /// Method to get all vCenters in a site. /// + /// /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task SolutionsGetConfigViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task VCenterListViaIdentity(global::System.String viaIdentity, string Filter, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2018-09-01-preview"; + var apiVersion = @"2020-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.Migrate/migrateProjects/(?[^/]+)/solutions/(?[^/]+)/getConfig$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/VMwareSites/(?[^/]+)/vCenters$", 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.Migrate/migrateProjects/{migrateProjectName}/solutions/{solutionName}/getConfig'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/VMwareSites/{siteName}/vCenters'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var migrateProjectName = _match.Groups["migrateProjectName"].Value; - var solutionName = _match.Groups["solutionName"].Value; + var siteName = _match.Groups["siteName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.Migrate/migrateProjects/" - + migrateProjectName - + "/solutions/" - + solutionName - + "/getConfig" + + "/providers/Microsoft.OffAzure/VMwareSites/" + + siteName + + "/vCenters" + "?" + "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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Post, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.SolutionsGetConfig_Call(request,onOk,eventListener,sender); + await this.VCenterList_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -40974,7 +50692,7 @@ public partial class Migrate /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task SolutionsGetConfig_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task VCenterList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -40992,7 +50710,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.SolutionConfig.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.VCenterCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -41012,42 +50730,42 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation - /// events back. + /// Validation method for method. Call this like the actual call, but you will get validation events + /// back. /// - /// Azure Subscription Id in which migrate project was created. - /// Name of the Azure Resource Group that migrate project is part of. - /// Name of the Azure Migrate project. - /// Unique name of a migration solution within a migrate project. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site 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 SolutionsGetConfig_Validate(string subscriptionId, string resourceGroupName, string migrateProjectName, string solutionName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task VCenterList_Validate(string subscriptionId, string resourceGroupName, string siteName, string Filter, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(migrateProjectName),migrateProjectName); - await eventListener.AssertNotNull(nameof(solutionName),solutionName); + await eventListener.AssertNotNull(nameof(siteName),siteName); + await eventListener.AssertNotNull(nameof(Filter),Filter); } } - /// Gets a solution in the migrate project. - /// Azure Subscription Id in which migrate project was created. - /// Name of the Azure Resource Group that migrate project is part of. - /// Name of the Azure Migrate project. - /// Unique name of a migration solution within a migrate project. + /// Method to get operation status. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site name. + /// Operation status ARM 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.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task SolutionsGetSolution(string subscriptionId, string resourceGroupName, string migrateProjectName, string solutionName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task VMwareOperationsStatusGet(string subscriptionId, string resourceGroupName, string siteName, string operationStatusName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2018-09-01-preview"; + var apiVersion = @"2020-01-01"; // Constant Parameters using( NoSynchronizationContext ) { @@ -41057,10 +50775,10 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.Migrate/migrateProjects/" - + global::System.Uri.EscapeDataString(migrateProjectName) - + "/solutions/" - + global::System.Uri.EscapeDataString(solutionName) + + "/providers/Microsoft.OffAzure/VMwareSites/" + + global::System.Uri.EscapeDataString(siteName) + + "/operationsStatus/" + + global::System.Uri.EscapeDataString(operationStatusName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -41074,11 +50792,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.SolutionsGetSolution_Call(request,onOk,eventListener,sender); + await this.VMwareOperationsStatusGet_Call(request,onOk,eventListener,sender); } } - /// Gets a solution in the migrate project. + /// Method to get operation status. /// /// a delegate that is called when the remote service returns 200 (OK). /// an instance that will receive events. @@ -41086,35 +50804,35 @@ public partial class Migrate /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task SolutionsGetSolutionViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task VMwareOperationsStatusGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2018-09-01-preview"; + var apiVersion = @"2020-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.Migrate/migrateProjects/(?[^/]+)/solutions/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.OffAzure/VMwareSites/(?[^/]+)/operationsStatus/(?[^/]+)$", 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.Migrate/migrateProjects/{migrateProjectName}/solutions/{solutionName}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/VMwareSites/{siteName}/operationsStatus/{operationStatusName}'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var migrateProjectName = _match.Groups["migrateProjectName"].Value; - var solutionName = _match.Groups["solutionName"].Value; + var siteName = _match.Groups["siteName"].Value; + var operationStatusName = _match.Groups["operationStatusName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.Migrate/migrateProjects/" - + migrateProjectName - + "/solutions/" - + solutionName + + "/providers/Microsoft.OffAzure/VMwareSites/" + + siteName + + "/operationsStatus/" + + operationStatusName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -41128,11 +50846,11 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.SolutionsGetSolution_Call(request,onOk,eventListener,sender); + await this.VMwareOperationsStatusGet_Call(request,onOk,eventListener,sender); } } - /// Actual wire call for method. + /// 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. @@ -41140,7 +50858,7 @@ public partial class Migrate /// /// A that will be complete when handling of the response is completed. /// - internal async global::System.Threading.Tasks.Task SolutionsGetSolution_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task VMwareOperationsStatusGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -41158,7 +50876,7 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.Solution.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.OperationStatus.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: @@ -41178,41 +50896,44 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation - /// events back. + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. /// - /// Azure Subscription Id in which migrate project was created. - /// Name of the Azure Resource Group that migrate project is part of. - /// Name of the Azure Migrate project. - /// Unique name of a migration solution within a migrate project. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Site name. + /// Operation status 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 SolutionsGetSolution_Validate(string subscriptionId, string resourceGroupName, string migrateProjectName, string solutionName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task VMwareOperationsStatusGet_Validate(string subscriptionId, string resourceGroupName, string siteName, string operationStatusName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(migrateProjectName),migrateProjectName); - await eventListener.AssertNotNull(nameof(solutionName),solutionName); + await eventListener.AssertNotNull(nameof(siteName),siteName); + await eventListener.AssertNotNull(nameof(operationStatusName),operationStatusName); } } - /// Gets the list of solutions in the migrate project. + /// Creates the vault. /// Azure Subscription Id in which migrate project was created. - /// Name of the Azure Resource Group that migrate project is part of. - /// Name of the Azure Migrate project. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// Vault properties. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task SolutionsList(string subscriptionId, string resourceGroupName, string migrateProjectName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task VaultCreate(string subscriptionId, string resourceGroupName, string vaultName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModel body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2018-09-01-preview"; + var apiVersion = @"2021-02-16-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -41222,9 +50943,8 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.Migrate/migrateProjects/" - + global::System.Uri.EscapeDataString(migrateProjectName) - + "/solutions" + + "/providers/Microsoft.DataReplication/replicationVaults/" + + global::System.Uri.EscapeDataString(vaultName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -41233,50 +50953,56 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.SolutionsList_Call(request,onOk,eventListener,sender); + await this.VaultCreate_Call(request,onOk,onDefault,eventListener,sender); } } - /// Gets the list of solutions in the migrate project. + /// Creates the vault. /// + /// Vault properties. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task SolutionsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task VaultCreateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModel body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2018-09-01-preview"; + var apiVersion = @"2021-02-16-preview"; // 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.Migrate/migrateProjects/(?[^/]+)/solutions$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataReplication/replicationVaults/(?[^/]+)$", 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.Migrate/migrateProjects/{migrateProjectName}/solutions'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var migrateProjectName = _match.Groups["migrateProjectName"].Value; + var vaultName = _match.Groups["vaultName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.Migrate/migrateProjects/" - + migrateProjectName - + "/solutions" + + "/providers/Microsoft.DataReplication/replicationVaults/" + + vaultName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -41285,24 +51011,30 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.SolutionsList_Call(request,onOk,eventListener,sender); + await this.VaultCreate_Call(request,onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 SolutionsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task VaultCreate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -41313,6 +51045,103 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -41320,12 +51149,14 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.SolutionsCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VaultModel.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { - throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; } } } @@ -41340,43 +51171,47 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation - /// events back. + /// Validation method for method. Call this like the actual call, but you will get validation events + /// back. /// /// Azure Subscription Id in which migrate project was created. - /// Name of the Azure Resource Group that migrate project is part of. - /// Name of the Azure Migrate project. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// Vault properties. /// 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 SolutionsList_Validate(string subscriptionId, string resourceGroupName, string migrateProjectName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task VaultCreate_Validate(string subscriptionId, string resourceGroupName, string vaultName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModel body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(migrateProjectName),migrateProjectName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(vaultName),vaultName); + await eventListener.AssertRegEx(nameof(vaultName),vaultName,@"^[a-zA-Z0-9]*$"); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// - /// Update a solution with specified name. Supports partial updates, for example only tags can be provided. - /// + /// Removes the vault. /// Azure Subscription Id in which migrate project was created. - /// Name of the Azure Resource Group that migrate project is part of. - /// Name of the Azure Migrate project. - /// Unique name of a migration solution within a migrate project. - /// The input for the solution. - /// a delegate that is called when the remote service returns 200 (OK). + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task SolutionsPatchSolution(string subscriptionId, string resourceGroupName, string migrateProjectName, string solutionName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.ISolution body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task VaultDelete(string subscriptionId, string resourceGroupName, string vaultName, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2018-09-01-preview"; + var apiVersion = @"2021-02-16-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -41386,10 +51221,8 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.Migrate/migrateProjects/" - + global::System.Uri.EscapeDataString(migrateProjectName) - + "/solutions/" - + global::System.Uri.EscapeDataString(solutionName) + + "/providers/Microsoft.DataReplication/replicationVaults/" + + global::System.Uri.EscapeDataString(vaultName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -41398,59 +51231,51 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.SolutionsPatchSolution_Call(request,onOk,eventListener,sender); + await this.VaultDelete_Call(request,onNoContent,onDefault,eventListener,sender); } } - /// - /// Update a solution with specified name. Supports partial updates, for example only tags can be provided. - /// + /// Removes the vault. /// - /// The input for the solution. - /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task SolutionsPatchSolutionViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.ISolution body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task VaultDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2018-09-01-preview"; + var apiVersion = @"2021-02-16-preview"; // 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.Migrate/migrateProjects/(?[^/]+)/solutions/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataReplication/replicationVaults/(?[^/]+)$", 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.Migrate/migrateProjects/{migrateProjectName}/solutions/{solutionName}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var migrateProjectName = _match.Groups["migrateProjectName"].Value; - var solutionName = _match.Groups["solutionName"].Value; + var vaultName = _match.Groups["vaultName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.Migrate/migrateProjects/" - + migrateProjectName - + "/solutions/" - + solutionName + + "/providers/Microsoft.DataReplication/replicationVaults/" + + vaultName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -41459,28 +51284,26 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.SolutionsPatchSolution_Call(request,onOk,eventListener,sender); + await this.VaultDelete_Call(request,onNoContent,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 SolutionsPatchSolution_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task VaultDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -41491,19 +51314,118 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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: + case global::System.Net.HttpStatusCode.NoContent: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.Solution.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onNoContent(_response); break; } default: { - throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; } } } @@ -41518,47 +51440,44 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation - /// events back. + /// Validation method for method. Call this like the actual call, but you will get validation events + /// back. /// /// Azure Subscription Id in which migrate project was created. - /// Name of the Azure Resource Group that migrate project is part of. - /// Name of the Azure Migrate project. - /// Unique name of a migration solution within a migrate project. - /// The input for the solution. + /// The name of the resource group. The name is case insensitive. + /// The vault 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 SolutionsPatchSolution_Validate(string subscriptionId, string resourceGroupName, string migrateProjectName, string solutionName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.ISolution body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task VaultDelete_Validate(string subscriptionId, string resourceGroupName, string vaultName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(migrateProjectName),migrateProjectName); - await eventListener.AssertNotNull(nameof(solutionName),solutionName); - await eventListener.AssertNotNull(nameof(body), body); - await eventListener.AssertObjectIsValid(nameof(body), body); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(vaultName),vaultName); + await eventListener.AssertRegEx(nameof(vaultName),vaultName,@"^[a-zA-Z0-9]*$"); } } - /// Creates a solution in the migrate project. + /// Gets the details of the vault. /// Azure Subscription Id in which migrate project was created. - /// Name of the Azure Resource Group that migrate project is part of. - /// Name of the Azure Migrate project. - /// Unique name of a migration solution within a migrate project. - /// The input for the solution. + /// The name of the resource group. The name is case insensitive. + /// The vault name. /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns 201 (Created). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task SolutionsPutSolution(string subscriptionId, string resourceGroupName, string migrateProjectName, string solutionName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.ISolution body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task VaultGet(string subscriptionId, string resourceGroupName, string vaultName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2018-09-01-preview"; + var apiVersion = @"2021-02-16-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -41568,10 +51487,8 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.Migrate/migrateProjects/" - + global::System.Uri.EscapeDataString(migrateProjectName) - + "/solutions/" - + global::System.Uri.EscapeDataString(solutionName) + + "/providers/Microsoft.DataReplication/replicationVaults/" + + global::System.Uri.EscapeDataString(vaultName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -41580,58 +51497,51 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.SolutionsPutSolution_Call(request,onOk,onCreated,eventListener,sender); + await this.VaultGet_Call(request,onOk,onDefault,eventListener,sender); } } - /// Creates a solution in the migrate project. + /// Gets the details of the vault. /// - /// The input for the solution. /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns 201 (Created). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task SolutionsPutSolutionViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.ISolution body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task VaultGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2018-09-01-preview"; + var apiVersion = @"2021-02-16-preview"; // 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.Migrate/migrateProjects/(?[^/]+)/solutions/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataReplication/replicationVaults/(?[^/]+)$", 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.Migrate/migrateProjects/{migrateProjectName}/solutions/{solutionName}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var migrateProjectName = _match.Groups["migrateProjectName"].Value; - var solutionName = _match.Groups["solutionName"].Value; + var vaultName = _match.Groups["vaultName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.Migrate/migrateProjects/" - + migrateProjectName - + "/solutions/" - + solutionName + + "/providers/Microsoft.DataReplication/replicationVaults/" + + vaultName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -41640,29 +51550,26 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.SolutionsPutSolution_Call(request,onOk,onCreated,eventListener,sender); + await this.VaultGet_Call(request,onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns 201 (Created). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 SolutionsPutSolution_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task VaultGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -41680,19 +51587,15 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.Solution.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VaultModel.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } - case global::System.Net.HttpStatusCode.Created: + default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onCreated(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.Solution.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } - default: - { - throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); - } } } finally @@ -41706,45 +51609,87 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation - /// events back. + /// Validation method for method. Call this like the actual call, but you will get validation events + /// back. /// /// Azure Subscription Id in which migrate project was created. - /// Name of the Azure Resource Group that migrate project is part of. - /// Name of the Azure Migrate project. - /// Unique name of a migration solution within a migrate project. - /// The input for the solution. + /// The name of the resource group. The name is case insensitive. + /// The vault 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 SolutionsPutSolution_Validate(string subscriptionId, string resourceGroupName, string migrateProjectName, string solutionName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.ISolution body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task VaultGet_Validate(string subscriptionId, string resourceGroupName, string vaultName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(migrateProjectName),migrateProjectName); - await eventListener.AssertNotNull(nameof(solutionName),solutionName); - await eventListener.AssertNotNull(nameof(body), body); - await eventListener.AssertObjectIsValid(nameof(body), body); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(vaultName),vaultName); + await eventListener.AssertRegEx(nameof(vaultName),vaultName,@"^[a-zA-Z0-9]*$"); } } - /// 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. + /// Gets the list of vaults in the given subscription and resource group. + /// Azure Subscription Id in which migrate project was created. + /// The name of the resource group. The name is case insensitive. + /// Continuation token from the previous call. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VaultList(string subscriptionId, string resourceGroupName, string continuationToken, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + { + var apiVersion = @"2021-02-16-preview"; + // 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.DataReplication/replicationVaults" + + "?" + + (string.IsNullOrEmpty(continuationToken) ? global::System.String.Empty : "continuationToken=" + global::System.Uri.EscapeDataString(continuationToken)) + + "&" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VaultList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Gets the list of vaults in the given subscription. /// Azure Subscription Id in which migrate project was created. - /// The instance type. + /// Continuation token from the previous call. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task VaultListBySubscription(string subscriptionId, string continuationToken, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2021-02-16-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -41752,15 +51697,11 @@ public partial class Migrate 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" + + "/providers/Microsoft.DataReplication/replicationVaults" + "?" - + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + (string.IsNullOrEmpty(continuationToken) ? global::System.String.Empty : "continuationToken=" + global::System.Uri.EscapeDataString(continuationToken)) + "&" - + (string.IsNullOrEmpty(instanceType) ? global::System.String.Empty : "instanceType=" + global::System.Uri.EscapeDataString(instanceType)) + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -41772,50 +51713,46 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.SupportedOperatingSystemsGet_Call(request,onOk,eventListener,sender); + await this.VaultListBySubscription_Call(request,onOk,onDefault,eventListener,sender); } } - /// Gets the data of supported operating systems by SRS. + /// Gets the list of vaults in the given subscription. /// - /// The instance type. + /// Continuation token from the previous call. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task VaultListBySubscriptionViaIdentity(global::System.String viaIdentity, string continuationToken, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2021-02-16-preview"; // 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); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.DataReplication/replicationVaults$", 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'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/replicationVaults'"); } // 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" + + "/providers/Microsoft.DataReplication/replicationVaults" + "?" - + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + + (string.IsNullOrEmpty(continuationToken) ? global::System.String.Empty : "continuationToken=" + global::System.Uri.EscapeDataString(continuationToken)) + "&" - + (string.IsNullOrEmpty(instanceType) ? global::System.String.Empty : "instanceType=" + global::System.Uri.EscapeDataString(instanceType)) + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -41827,19 +51764,21 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.SupportedOperatingSystemsGet_Call(request,onOk,eventListener,sender); + await this.VaultListBySubscription_Call(request,onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task VaultListBySubscription_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -41857,12 +51796,14 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.SupportedOperatingSystems.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VaultModelCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { - throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; } } } @@ -41877,124 +51818,62 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will - /// get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// The instance type. + /// Continuation token from the previous call. /// 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.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task VaultListBySubscription_Validate(string subscriptionId, string continuationToken, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. - /// Azure Subscription Id in which migrate project was created. - /// 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.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - // generate request object - var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } - - await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } - // make the call - await this.TargetComputeSizesListByReplicationProtectedItems_Call(request,onOk,eventListener,sender); + await eventListener.AssertNotNull(nameof(continuationToken),continuationToken); } } - /// Lists the available target compute sizes for a replication protected item. + /// Gets the list of vaults in the given subscription and resource group. /// + /// Continuation token from the previous call. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to 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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task VaultListViaIdentity(global::System.String viaIdentity, string continuationToken, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2023-01-01"; + var apiVersion = @"2021-02-16-preview"; // 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); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataReplication/replicationVaults$", 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'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults'"); } // 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 resourceGroupName = _match.Groups["resourceGroupName"].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" + + "/providers/Microsoft.DataReplication/replicationVaults" + "?" + + (string.IsNullOrEmpty(continuationToken) ? global::System.String.Empty : "continuationToken=" + global::System.Uri.EscapeDataString(continuationToken)) + + "&" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -42007,21 +51886,21 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.TargetComputeSizesListByReplicationProtectedItems_Call(request,onOk,eventListener,sender); + await this.VaultList_Call(request,onOk,onDefault,eventListener,sender); } } - /// - /// Actual wire call for method. - /// + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task VaultList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -42039,12 +51918,14 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.TargetComputeSizeCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VaultModelCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { - throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; } } } @@ -42059,47 +51940,44 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual - /// call, but you will get validation events back. + /// 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. /// Azure Subscription Id in which migrate project was created. - /// Fabric name. - /// protection container name. - /// Replication protected item name. + /// The name of the resource group. The name is case insensitive. + /// Continuation token from the previous call. /// 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.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task VaultList_Validate(string subscriptionId, string resourceGroupName, string continuationToken, Microsoft.Azure.PowerShell.Cmdlets.Migrate.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(resourceGroupName),resourceGroupName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(continuationToken),continuationToken); } } - /// Method to create or update a vCenter in site. - /// The ID of the target subscription. + /// Tracks the results of an asynchronous operation on the vault. + /// Azure Subscription Id in which migrate project was created. /// The name of the resource group. The name is case insensitive. - /// Site name. - /// VCenter ARM name. - /// Put vCenter body. - /// a delegate that is called when the remote service returns 202 (Accepted). + /// The vault name. + /// The ID of an ongoing async operation. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task VCenterCreateOrUpdate(string subscriptionId, string resourceGroupName, string siteName, string vcenterName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVCenter body, global::System.Func onAccepted, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task VaultOperationStatusGet(string subscriptionId, string resourceGroupName, string vaultName, string operationId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2021-02-16-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -42109,10 +51987,10 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.OffAzure/VMwareSites/" - + global::System.Uri.EscapeDataString(siteName) - + "/vCenters/" - + global::System.Uri.EscapeDataString(vcenterName) + + "/providers/Microsoft.DataReplication/replicationVaults/" + + global::System.Uri.EscapeDataString(vaultName) + + "/operations/" + + global::System.Uri.EscapeDataString(operationId) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -42121,57 +51999,54 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.VCenterCreateOrUpdate_Call(request,onAccepted,eventListener,sender); + await this.VaultOperationStatusGet_Call(request,onOk,onDefault,eventListener,sender); } } - /// Method to create or update a vCenter in site. + /// Tracks the results of an asynchronous operation on the vault. /// - /// Put vCenter body. - /// a delegate that is called when the remote service returns 202 (Accepted). + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task VCenterCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVCenter body, global::System.Func onAccepted, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task VaultOperationStatusGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2021-02-16-preview"; // 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.OffAzure/VMwareSites/(?[^/]+)/vCenters/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataReplication/replicationVaults/(?[^/]+)/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.OffAzure/VMwareSites/{siteName}/vCenters/{vcenterName}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/operations/{operationId}'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var siteName = _match.Groups["siteName"].Value; - var vcenterName = _match.Groups["vcenterName"].Value; + var vaultName = _match.Groups["vaultName"].Value; + var operationId = _match.Groups["operationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.OffAzure/VMwareSites/" - + siteName - + "/vCenters/" - + vcenterName + + "/providers/Microsoft.DataReplication/replicationVaults/" + + vaultName + + "/operations/" + + operationId + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -42180,28 +52055,26 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Put, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Get, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.VCenterCreateOrUpdate_Call(request,onAccepted,eventListener,sender); + await this.VaultOperationStatusGet_Call(request,onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. - /// a delegate that is called when the remote service returns 202 (Accepted). + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 VCenterCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onAccepted, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task VaultOperationStatusGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -42216,15 +52089,17 @@ public partial class Migrate switch ( _response.StatusCode ) { - case global::System.Net.HttpStatusCode.Accepted: + case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onAccepted(_response); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.OperationStatusAutoGenerated.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { - throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; } } } @@ -42239,46 +52114,48 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation - /// events back. + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. /// - /// The ID of the target subscription. + /// Azure Subscription Id in which migrate project was created. /// The name of the resource group. The name is case insensitive. - /// Site name. - /// VCenter ARM name. - /// Put vCenter body. + /// The vault name. + /// The ID of an ongoing async 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 VCenterCreateOrUpdate_Validate(string subscriptionId, string resourceGroupName, string siteName, string vcenterName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVCenter body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task VaultOperationStatusGet_Validate(string subscriptionId, string resourceGroupName, string vaultName, string operationId, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(siteName),siteName); - await eventListener.AssertNotNull(nameof(vcenterName),vcenterName); - await eventListener.AssertNotNull(nameof(body), body); - await eventListener.AssertObjectIsValid(nameof(body), body); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(vaultName),vaultName); + await eventListener.AssertRegEx(nameof(vaultName),vaultName,@"^[a-zA-Z0-9]*$"); + await eventListener.AssertNotNull(nameof(operationId),operationId); + await eventListener.AssertMinimumLength(nameof(operationId),operationId,1); } } - /// Method to delete vCenter in site. - /// The ID of the target subscription. + /// Performs update on the vault. + /// Azure Subscription Id in which migrate project was created. /// The name of the resource group. The name is case insensitive. - /// Site name. - /// VCenter ARM name. + /// The vault name. + /// Vault properties. /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task VCenterDeleteVcenter(string subscriptionId, string resourceGroupName, string siteName, string vcenterName, global::System.Func onOk, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task VaultUpdate(string subscriptionId, string resourceGroupName, string vaultName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdate body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2021-02-16-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -42288,10 +52165,8 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.OffAzure/VMwareSites/" - + global::System.Uri.EscapeDataString(siteName) - + "/vCenters/" - + global::System.Uri.EscapeDataString(vcenterName) + + "/providers/Microsoft.DataReplication/replicationVaults/" + + global::System.Uri.EscapeDataString(vaultName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -42300,53 +52175,56 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.VCenterDeleteVcenter_Call(request,onOk,onNoContent,eventListener,sender); + await this.VaultUpdate_Call(request,onOk,onDefault,eventListener,sender); } } - /// Method to delete vCenter in site. + /// Performs update on the vault. /// + /// Vault properties. /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task VCenterDeleteVcenterViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task VaultUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdate body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2021-02-16-preview"; // 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.OffAzure/VMwareSites/(?[^/]+)/vCenters/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataReplication/replicationVaults/(?[^/]+)$", 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.OffAzure/VMwareSites/{siteName}/vCenters/{vcenterName}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var siteName = _match.Groups["siteName"].Value; - var vcenterName = _match.Groups["vcenterName"].Value; + var vaultName = _match.Groups["vaultName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.OffAzure/VMwareSites/" - + siteName - + "/vCenters/" - + vcenterName + + "/providers/Microsoft.DataReplication/replicationVaults/" + + vaultName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -42355,25 +52233,30 @@ public partial class Migrate // generate request object var _url = new global::System.Uri($"https://management.azure.com{pathAndQuery}"); - var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Delete, _url); + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Method.Patch, _url); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.VCenterDeleteVcenter_Call(request,onOk,onNoContent,eventListener,sender); + await this.VaultUpdate_Call(request,onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). - /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 VCenterDeleteVcenter_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task VaultUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -42384,6 +52267,103 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Runtime.Events.Polling, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + break; + } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) @@ -42391,19 +52371,15 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VaultModel.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } - case global::System.Net.HttpStatusCode.NoContent: + default: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onNoContent(_response); + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } - default: - { - throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); - } } } finally @@ -42417,42 +52393,48 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation - /// events back. + /// Validation method for method. Call this like the actual call, but you will get validation events + /// back. /// - /// The ID of the target subscription. + /// Azure Subscription Id in which migrate project was created. /// The name of the resource group. The name is case insensitive. - /// Site name. - /// VCenter ARM name. + /// The vault name. + /// Vault properties. /// 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 VCenterDeleteVcenter_Validate(string subscriptionId, string resourceGroupName, string siteName, string vcenterName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task VaultUpdate_Validate(string subscriptionId, string resourceGroupName, string vaultName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdate body, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(siteName),siteName); - await eventListener.AssertNotNull(nameof(vcenterName),vcenterName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(vaultName),vaultName); + await eventListener.AssertRegEx(nameof(vaultName),vaultName,@"^[a-zA-Z0-9]*$"); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); } } - /// Method to get a vCenter. - /// The ID of the target subscription. + /// Gets the details of the job. + /// Azure Subscription Id in which migrate project was created. /// The name of the resource group. The name is case insensitive. - /// Site name. - /// VCenter ARM name. + /// The vault name. + /// The job (workflow) name. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task VCenterGet(string subscriptionId, string resourceGroupName, string siteName, string vcenterName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task WorkflowGet(string subscriptionId, string resourceGroupName, string vaultName, string jobName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2021-02-16-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -42462,10 +52444,10 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.OffAzure/VMwareSites/" - + global::System.Uri.EscapeDataString(siteName) - + "/vCenters/" - + global::System.Uri.EscapeDataString(vcenterName) + + "/providers/Microsoft.DataReplication/replicationVaults/" + + global::System.Uri.EscapeDataString(vaultName) + + "/jobs/" + + global::System.Uri.EscapeDataString(jobName) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -42479,47 +52461,49 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.VCenterGet_Call(request,onOk,eventListener,sender); + await this.WorkflowGet_Call(request,onOk,onDefault,eventListener,sender); } } - /// Method to get a vCenter. + /// Gets the details of the job. /// /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task VCenterGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task WorkflowGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2021-02-16-preview"; // 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.OffAzure/VMwareSites/(?[^/]+)/vCenters/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataReplication/replicationVaults/(?[^/]+)/jobs/(?[^/]+)$", 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.OffAzure/VMwareSites/{siteName}/vCenters/{vcenterName}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/jobs/{jobName}'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var siteName = _match.Groups["siteName"].Value; - var vcenterName = _match.Groups["vcenterName"].Value; + var vaultName = _match.Groups["vaultName"].Value; + var jobName = _match.Groups["jobName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.OffAzure/VMwareSites/" - + siteName - + "/vCenters/" - + vcenterName + + "/providers/Microsoft.DataReplication/replicationVaults/" + + vaultName + + "/jobs/" + + jobName + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -42533,19 +52517,21 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.VCenterGet_Call(request,onOk,eventListener,sender); + await this.WorkflowGet_Call(request,onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 VCenterGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task WorkflowGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -42563,12 +52549,14 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.VCenter.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModel.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { - throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; } } } @@ -42583,42 +52571,49 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation events + /// Validation method for method. Call this like the actual call, but you will get validation events /// back. /// - /// The ID of the target subscription. + /// Azure Subscription Id in which migrate project was created. /// The name of the resource group. The name is case insensitive. - /// Site name. - /// VCenter ARM name. + /// The vault name. + /// The job (workflow) 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 VCenterGet_Validate(string subscriptionId, string resourceGroupName, string siteName, string vcenterName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task WorkflowGet_Validate(string subscriptionId, string resourceGroupName, string vaultName, string jobName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(siteName),siteName); - await eventListener.AssertNotNull(nameof(vcenterName),vcenterName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(vaultName),vaultName); + await eventListener.AssertRegEx(nameof(vaultName),vaultName,@"^[a-zA-Z0-9]*$"); + await eventListener.AssertNotNull(nameof(jobName),jobName); + await eventListener.AssertRegEx(nameof(jobName),jobName,@"^[a-zA-Z0-9]*$"); } } - /// Method to get all vCenters in a site. - /// The ID of the target subscription. + /// Gets the list of jobs in the given vault. + /// Azure Subscription Id in which migrate project was created. /// The name of the resource group. The name is case insensitive. - /// Site name. - /// + /// The vault name. + /// Filter string. + /// Continuation token. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task VCenterList(string subscriptionId, string resourceGroupName, string siteName, string Filter, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task WorkflowList(string subscriptionId, string resourceGroupName, string vaultName, string Filter, string continuationToken, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2021-02-16-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -42628,13 +52623,15 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.OffAzure/VMwareSites/" - + global::System.Uri.EscapeDataString(siteName) - + "/vCenters" + + "/providers/Microsoft.DataReplication/replicationVaults/" + + global::System.Uri.EscapeDataString(vaultName) + + "/jobs" + "?" - + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) - + "&" + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter)) + + "&" + + (string.IsNullOrEmpty(continuationToken) ? global::System.String.Empty : "continuationToken=" + global::System.Uri.EscapeDataString(continuationToken)) + + "&" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -42646,50 +52643,55 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.VCenterList_Call(request,onOk,eventListener,sender); + await this.WorkflowList_Call(request,onOk,onDefault,eventListener,sender); } } - /// Method to get all vCenters in a site. + /// Gets the list of jobs in the given vault. /// - /// + /// Filter string. + /// Continuation token. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task VCenterListViaIdentity(global::System.String viaIdentity, string Filter, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task WorkflowListViaIdentity(global::System.String viaIdentity, string Filter, string continuationToken, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2021-02-16-preview"; // 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.OffAzure/VMwareSites/(?[^/]+)/vCenters$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataReplication/replicationVaults/(?[^/]+)/jobs$", 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.OffAzure/VMwareSites/{siteName}/vCenters'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/jobs'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var siteName = _match.Groups["siteName"].Value; + var vaultName = _match.Groups["vaultName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.OffAzure/VMwareSites/" - + siteName - + "/vCenters" + + "/providers/Microsoft.DataReplication/replicationVaults/" + + vaultName + + "/jobs" + "?" - + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) - + "&" + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter)) + + "&" + + (string.IsNullOrEmpty(continuationToken) ? global::System.String.Empty : "continuationToken=" + global::System.Uri.EscapeDataString(continuationToken)) + + "&" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } @@ -42701,19 +52703,21 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.VCenterList_Call(request,onOk,eventListener,sender); + await this.WorkflowList_Call(request,onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 VCenterList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task WorkflowList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -42731,12 +52735,14 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.VCenterCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { - throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; } } } @@ -42751,42 +52757,50 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get validation events - /// back. + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. /// - /// The ID of the target subscription. + /// Azure Subscription Id in which migrate project was created. /// The name of the resource group. The name is case insensitive. - /// Site name. - /// + /// The vault name. + /// Filter string. + /// Continuation token. /// 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 VCenterList_Validate(string subscriptionId, string resourceGroupName, string siteName, string Filter, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task WorkflowList_Validate(string subscriptionId, string resourceGroupName, string vaultName, string Filter, string continuationToken, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(siteName),siteName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(vaultName),vaultName); + await eventListener.AssertRegEx(nameof(vaultName),vaultName,@"^[a-zA-Z0-9]*$"); await eventListener.AssertNotNull(nameof(Filter),Filter); + await eventListener.AssertNotNull(nameof(continuationToken),continuationToken); } } - /// Method to get operation status. - /// The ID of the target subscription. + /// Tracks the results of an asynchronous operation on the job. + /// Azure Subscription Id in which migrate project was created. /// The name of the resource group. The name is case insensitive. - /// Site name. - /// Operation status ARM name. + /// The vault name. + /// The job (workflow) name. + /// The ID of an ongoing async operation. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task VMwareOperationsStatusGet(string subscriptionId, string resourceGroupName, string siteName, string operationStatusName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task WorkflowOperationStatusGet(string subscriptionId, string resourceGroupName, string vaultName, string jobName, string operationId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2021-02-16-preview"; // Constant Parameters using( NoSynchronizationContext ) { @@ -42796,10 +52810,12 @@ public partial class Migrate + global::System.Uri.EscapeDataString(subscriptionId) + "/resourceGroups/" + global::System.Uri.EscapeDataString(resourceGroupName) - + "/providers/Microsoft.OffAzure/VMwareSites/" - + global::System.Uri.EscapeDataString(siteName) - + "/operationsStatus/" - + global::System.Uri.EscapeDataString(operationStatusName) + + "/providers/Microsoft.DataReplication/replicationVaults/" + + global::System.Uri.EscapeDataString(vaultName) + + "/jobs/" + + global::System.Uri.EscapeDataString(jobName) + + "/operations/" + + global::System.Uri.EscapeDataString(operationId) + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -42813,47 +52829,52 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.VMwareOperationsStatusGet_Call(request,onOk,eventListener,sender); + await this.WorkflowOperationStatusGet_Call(request,onOk,onDefault,eventListener,sender); } } - /// Method to get operation status. + /// Tracks the results of an asynchronous operation on the job. /// /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync pipeline to use to make the request. /// /// A that will be complete when handling of the response is completed. /// - public async global::System.Threading.Tasks.Task VMwareOperationsStatusGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + public async global::System.Threading.Tasks.Task WorkflowOperationStatusGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { - var apiVersion = @"2020-01-01"; + var apiVersion = @"2021-02-16-preview"; // 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.OffAzure/VMwareSites/(?[^/]+)/operationsStatus/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.DataReplication/replicationVaults/(?[^/]+)/jobs/(?[^/]+)/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.OffAzure/VMwareSites/{siteName}/operationsStatus/{operationStatusName}'"); + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/jobs/{jobName}/operations/{operationId}'"); } // replace URI parameters with values from identity var subscriptionId = _match.Groups["subscriptionId"].Value; var resourceGroupName = _match.Groups["resourceGroupName"].Value; - var siteName = _match.Groups["siteName"].Value; - var operationStatusName = _match.Groups["operationStatusName"].Value; + var vaultName = _match.Groups["vaultName"].Value; + var jobName = _match.Groups["jobName"].Value; + var operationId = _match.Groups["operationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName - + "/providers/Microsoft.OffAzure/VMwareSites/" - + siteName - + "/operationsStatus/" - + operationStatusName + + "/providers/Microsoft.DataReplication/replicationVaults/" + + vaultName + + "/jobs/" + + jobName + + "/operations/" + + operationId + "?" + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); @@ -42867,19 +52888,21 @@ public partial class Migrate await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call - await this.VMwareOperationsStatusGet_Call(request,onOk,eventListener,sender); + await this.WorkflowOperationStatusGet_Call(request,onOk,onDefault,eventListener,sender); } } - /// Actual wire call for method. + /// Actual wire call for method. /// the prepared HttpRequestMessage to send. /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). /// an instance that will receive events. /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 VMwareOperationsStatusGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) + internal async global::System.Threading.Tasks.Task WorkflowOperationStatusGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { @@ -42897,12 +52920,14 @@ public partial class Migrate case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } - await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.OperationStatus.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.OperationStatusAutoGenerated.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { - throw new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException(_response); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; } } } @@ -42917,25 +52942,32 @@ public partial class Migrate } /// - /// Validation method for method. Call this like the actual call, but you will get + /// Validation method for method. Call this like the actual call, but you will get /// validation events back. /// - /// The ID of the target subscription. + /// Azure Subscription Id in which migrate project was created. /// The name of the resource group. The name is case insensitive. - /// Site name. - /// Operation status ARM name. + /// The vault name. + /// The job (workflow) name. + /// The ID of an ongoing async 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 VMwareOperationsStatusGet_Validate(string subscriptionId, string resourceGroupName, string siteName, string operationStatusName, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) + internal async global::System.Threading.Tasks.Task WorkflowOperationStatusGet_Validate(string subscriptionId, string resourceGroupName, string vaultName, string jobName, string operationId, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); - await eventListener.AssertNotNull(nameof(siteName),siteName); - await eventListener.AssertNotNull(nameof(operationStatusName),operationStatusName); + await eventListener.AssertMinimumLength(nameof(resourceGroupName),resourceGroupName,1); + await eventListener.AssertMaximumLength(nameof(resourceGroupName),resourceGroupName,90); + await eventListener.AssertNotNull(nameof(vaultName),vaultName); + await eventListener.AssertRegEx(nameof(vaultName),vaultName,@"^[a-zA-Z0-9]*$"); + await eventListener.AssertNotNull(nameof(jobName),jobName); + await eventListener.AssertRegEx(nameof(jobName),jobName,@"^[a-zA-Z0-9]*$"); + await eventListener.AssertNotNull(nameof(operationId),operationId); + await eventListener.AssertMinimumLength(nameof(operationId),operationId,1); } } } diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/AzStackHciClusterProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/AzStackHciClusterProperties.PowerShell.cs new file mode 100644 index 000000000000..48b0d1ee587f --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/AzStackHciClusterProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// AzStackHCI cluster properties. + [System.ComponentModel.TypeConverter(typeof(AzStackHciClusterPropertiesTypeConverter))] + public partial class AzStackHciClusterProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should 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 AzStackHciClusterProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ClusterName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciClusterPropertiesInternal)this).ClusterName = (string) content.GetValueForProperty("ClusterName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciClusterPropertiesInternal)this).ClusterName, global::System.Convert.ToString); + } + if (content.Contains("ResourceName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciClusterPropertiesInternal)this).ResourceName = (string) content.GetValueForProperty("ResourceName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciClusterPropertiesInternal)this).ResourceName, global::System.Convert.ToString); + } + if (content.Contains("StorageAccountName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciClusterPropertiesInternal)this).StorageAccountName = (string) content.GetValueForProperty("StorageAccountName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciClusterPropertiesInternal)this).StorageAccountName, global::System.Convert.ToString); + } + if (content.Contains("StorageContainer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciClusterPropertiesInternal)this).StorageContainer = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IStorageContainerProperties[]) content.GetValueForProperty("StorageContainer",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciClusterPropertiesInternal)this).StorageContainer, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.StorageContainerPropertiesTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal AzStackHciClusterProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ClusterName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciClusterPropertiesInternal)this).ClusterName = (string) content.GetValueForProperty("ClusterName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciClusterPropertiesInternal)this).ClusterName, global::System.Convert.ToString); + } + if (content.Contains("ResourceName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciClusterPropertiesInternal)this).ResourceName = (string) content.GetValueForProperty("ResourceName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciClusterPropertiesInternal)this).ResourceName, global::System.Convert.ToString); + } + if (content.Contains("StorageAccountName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciClusterPropertiesInternal)this).StorageAccountName = (string) content.GetValueForProperty("StorageAccountName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciClusterPropertiesInternal)this).StorageAccountName, global::System.Convert.ToString); + } + if (content.Contains("StorageContainer")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciClusterPropertiesInternal)this).StorageContainer = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IStorageContainerProperties[]) content.GetValueForProperty("StorageContainer",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciClusterPropertiesInternal)this).StorageContainer, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.StorageContainerPropertiesTypeConverter.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.Migrate.Models.Api20210216Preview.IAzStackHciClusterProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AzStackHciClusterProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciClusterProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AzStackHciClusterProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciClusterProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// AzStackHCI cluster properties. + [System.ComponentModel.TypeConverter(typeof(AzStackHciClusterPropertiesTypeConverter))] + public partial interface IAzStackHciClusterProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/AzStackHciClusterProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/AzStackHciClusterProperties.TypeConverter.cs new file mode 100644 index 000000000000..885fa4501bca --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/AzStackHciClusterProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AzStackHciClusterPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciClusterProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciClusterProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AzStackHciClusterProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AzStackHciClusterProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AzStackHciClusterProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/AzStackHciClusterProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/AzStackHciClusterProperties.cs new file mode 100644 index 000000000000..87432a07eadb --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/AzStackHciClusterProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// AzStackHCI cluster properties. + public partial class AzStackHciClusterProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciClusterProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciClusterPropertiesInternal + { + + /// Backing field for property. + private string _clusterName; + + /// Gets or sets the AzStackHCICluster FQDN name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string ClusterName { get => this._clusterName; set => this._clusterName = value; } + + /// Backing field for property. + private string _resourceName; + + /// Gets or sets the AzStackHCICluster resource name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string ResourceName { get => this._resourceName; set => this._resourceName = value; } + + /// Backing field for property. + private string _storageAccountName; + + /// Gets or sets the Storage account name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string StorageAccountName { get => this._storageAccountName; set => this._storageAccountName = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IStorageContainerProperties[] _storageContainer; + + /// Gets or sets the list of AzStackHCICluster Storage Container. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IStorageContainerProperties[] StorageContainer { get => this._storageContainer; set => this._storageContainer = value; } + + /// Creates an new instance. + public AzStackHciClusterProperties() + { + + } + } + /// AzStackHCI cluster properties. + public partial interface IAzStackHciClusterProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the AzStackHCICluster FQDN name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the AzStackHCICluster FQDN name.", + SerializedName = @"clusterName", + PossibleTypes = new [] { typeof(string) })] + string ClusterName { get; set; } + /// Gets or sets the AzStackHCICluster resource name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the AzStackHCICluster resource name.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + string ResourceName { get; set; } + /// Gets or sets the Storage account name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the Storage account name.", + SerializedName = @"storageAccountName", + PossibleTypes = new [] { typeof(string) })] + string StorageAccountName { get; set; } + /// Gets or sets the list of AzStackHCICluster Storage Container. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the list of AzStackHCICluster Storage Container.", + SerializedName = @"storageContainers", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IStorageContainerProperties) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IStorageContainerProperties[] StorageContainer { get; set; } + + } + /// AzStackHCI cluster properties. + internal partial interface IAzStackHciClusterPropertiesInternal + + { + /// Gets or sets the AzStackHCICluster FQDN name. + string ClusterName { get; set; } + /// Gets or sets the AzStackHCICluster resource name. + string ResourceName { get; set; } + /// Gets or sets the Storage account name. + string StorageAccountName { get; set; } + /// Gets or sets the list of AzStackHCICluster Storage Container. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IStorageContainerProperties[] StorageContainer { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/AzStackHciClusterProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/AzStackHciClusterProperties.json.cs new file mode 100644 index 000000000000..0b47ec7c7d01 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/AzStackHciClusterProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// AzStackHCI cluster properties. + public partial class AzStackHciClusterProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal AzStackHciClusterProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_clusterName = If( json?.PropertyT("clusterName"), out var __jsonClusterName) ? (string)__jsonClusterName : (string)ClusterName;} + {_resourceName = If( json?.PropertyT("resourceName"), out var __jsonResourceName) ? (string)__jsonResourceName : (string)ResourceName;} + {_storageAccountName = If( json?.PropertyT("storageAccountName"), out var __jsonStorageAccountName) ? (string)__jsonStorageAccountName : (string)StorageAccountName;} + {_storageContainer = If( json?.PropertyT("storageContainers"), out var __jsonStorageContainers) ? If( __jsonStorageContainers as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api20210216Preview.IStorageContainerProperties) (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.StorageContainerProperties.FromJson(__u) )) ))() : null : StorageContainer;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciClusterProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciClusterProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciClusterProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new AzStackHciClusterProperties(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._clusterName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._clusterName.ToString()) : null, "clusterName" ,container.Add ); + AddIf( null != (((object)this._resourceName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._resourceName.ToString()) : null, "resourceName" ,container.Add ); + AddIf( null != (((object)this._storageAccountName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._storageAccountName.ToString()) : null, "storageAccountName" ,container.Add ); + if (null != this._storageContainer) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.XNodeArray(); + foreach( var __x in this._storageContainer ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("storageContainers",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/AzStackHciFabricModelCustomProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/AzStackHciFabricModelCustomProperties.PowerShell.cs new file mode 100644 index 000000000000..3b8ac5f6496b --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/AzStackHciFabricModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// AzStackHCI fabric model custom properties. + [System.ComponentModel.TypeConverter(typeof(AzStackHciFabricModelCustomPropertiesTypeConverter))] + public partial class AzStackHciFabricModelCustomProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should 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 AzStackHciFabricModelCustomProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AzStackHciSiteId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciFabricModelCustomPropertiesInternal)this).AzStackHciSiteId = (string) content.GetValueForProperty("AzStackHciSiteId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciFabricModelCustomPropertiesInternal)this).AzStackHciSiteId, global::System.Convert.ToString); + } + if (content.Contains("ApplianceName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciFabricModelCustomPropertiesInternal)this).ApplianceName = (string[]) content.GetValueForProperty("ApplianceName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciFabricModelCustomPropertiesInternal)this).ApplianceName, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("Cluster")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciFabricModelCustomPropertiesInternal)this).Cluster = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciClusterProperties) content.GetValueForProperty("Cluster",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciFabricModelCustomPropertiesInternal)this).Cluster, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHciClusterPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("FabricResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciFabricModelCustomPropertiesInternal)this).FabricResourceId = (string) content.GetValueForProperty("FabricResourceId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciFabricModelCustomPropertiesInternal)this).FabricResourceId, global::System.Convert.ToString); + } + if (content.Contains("FabricContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciFabricModelCustomPropertiesInternal)this).FabricContainerId = (string) content.GetValueForProperty("FabricContainerId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciFabricModelCustomPropertiesInternal)this).FabricContainerId, global::System.Convert.ToString); + } + if (content.Contains("MigrationSolutionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciFabricModelCustomPropertiesInternal)this).MigrationSolutionId = (string) content.GetValueForProperty("MigrationSolutionId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciFabricModelCustomPropertiesInternal)this).MigrationSolutionId, global::System.Convert.ToString); + } + if (content.Contains("MigrationHubUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciFabricModelCustomPropertiesInternal)this).MigrationHubUri = (string) content.GetValueForProperty("MigrationHubUri",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciFabricModelCustomPropertiesInternal)this).MigrationHubUri, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCustomPropertiesInternal)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 AzStackHciFabricModelCustomProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AzStackHciSiteId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciFabricModelCustomPropertiesInternal)this).AzStackHciSiteId = (string) content.GetValueForProperty("AzStackHciSiteId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciFabricModelCustomPropertiesInternal)this).AzStackHciSiteId, global::System.Convert.ToString); + } + if (content.Contains("ApplianceName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciFabricModelCustomPropertiesInternal)this).ApplianceName = (string[]) content.GetValueForProperty("ApplianceName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciFabricModelCustomPropertiesInternal)this).ApplianceName, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("Cluster")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciFabricModelCustomPropertiesInternal)this).Cluster = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciClusterProperties) content.GetValueForProperty("Cluster",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciFabricModelCustomPropertiesInternal)this).Cluster, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHciClusterPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("FabricResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciFabricModelCustomPropertiesInternal)this).FabricResourceId = (string) content.GetValueForProperty("FabricResourceId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciFabricModelCustomPropertiesInternal)this).FabricResourceId, global::System.Convert.ToString); + } + if (content.Contains("FabricContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciFabricModelCustomPropertiesInternal)this).FabricContainerId = (string) content.GetValueForProperty("FabricContainerId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciFabricModelCustomPropertiesInternal)this).FabricContainerId, global::System.Convert.ToString); + } + if (content.Contains("MigrationSolutionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciFabricModelCustomPropertiesInternal)this).MigrationSolutionId = (string) content.GetValueForProperty("MigrationSolutionId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciFabricModelCustomPropertiesInternal)this).MigrationSolutionId, global::System.Convert.ToString); + } + if (content.Contains("MigrationHubUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciFabricModelCustomPropertiesInternal)this).MigrationHubUri = (string) content.GetValueForProperty("MigrationHubUri",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciFabricModelCustomPropertiesInternal)this).MigrationHubUri, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCustomPropertiesInternal)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.Migrate.Models.Api20210216Preview.IAzStackHciFabricModelCustomProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new AzStackHciFabricModelCustomProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciFabricModelCustomProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new AzStackHciFabricModelCustomProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciFabricModelCustomProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// AzStackHCI fabric model custom properties. + [System.ComponentModel.TypeConverter(typeof(AzStackHciFabricModelCustomPropertiesTypeConverter))] + public partial interface IAzStackHciFabricModelCustomProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/AzStackHciFabricModelCustomProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/AzStackHciFabricModelCustomProperties.TypeConverter.cs new file mode 100644 index 000000000000..f4c112a646d8 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/AzStackHciFabricModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class AzStackHciFabricModelCustomPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciFabricModelCustomProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciFabricModelCustomProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AzStackHciFabricModelCustomProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return AzStackHciFabricModelCustomProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return AzStackHciFabricModelCustomProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/AzStackHciFabricModelCustomProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/AzStackHciFabricModelCustomProperties.cs new file mode 100644 index 000000000000..6b6406c40406 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/AzStackHciFabricModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// AzStackHCI fabric model custom properties. + public partial class AzStackHciFabricModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciFabricModelCustomProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciFabricModelCustomPropertiesInternal, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCustomProperties __fabricModelCustomProperties = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelCustomProperties(); + + /// Backing field for property. + private string[] _applianceName; + + /// Gets or sets the Appliance name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string[] ApplianceName { get => this._applianceName; } + + /// Backing field for property. + private string _azStackHciSiteId; + + /// Gets or sets the ARM Id of the AzStackHCI site. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string AzStackHciSiteId { get => this._azStackHciSiteId; set => this._azStackHciSiteId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciClusterProperties _cluster; + + /// AzStackHCI cluster properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciClusterProperties Cluster { get => (this._cluster = this._cluster ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHciClusterProperties()); set => this._cluster = value; } + + /// Backing field for property. + private string _fabricContainerId; + + /// Gets or sets the fabric container Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string FabricContainerId { get => this._fabricContainerId; } + + /// Backing field for property. + private string _fabricResourceId; + + /// Gets or sets the fabric resource Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string FabricResourceId { get => this._fabricResourceId; } + + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCustomPropertiesInternal)__fabricModelCustomProperties).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCustomPropertiesInternal)__fabricModelCustomProperties).InstanceType = value ; } + + /// Internal Acessors for ApplianceName + string[] Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciFabricModelCustomPropertiesInternal.ApplianceName { get => this._applianceName; set { {_applianceName = value;} } } + + /// Internal Acessors for FabricContainerId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciFabricModelCustomPropertiesInternal.FabricContainerId { get => this._fabricContainerId; set { {_fabricContainerId = value;} } } + + /// Internal Acessors for FabricResourceId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciFabricModelCustomPropertiesInternal.FabricResourceId { get => this._fabricResourceId; set { {_fabricResourceId = value;} } } + + /// Internal Acessors for MigrationHubUri + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciFabricModelCustomPropertiesInternal.MigrationHubUri { get => this._migrationHubUri; set { {_migrationHubUri = value;} } } + + /// Backing field for property. + private string _migrationHubUri; + + /// Gets or sets the migration hub Uri. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string MigrationHubUri { get => this._migrationHubUri; } + + /// Backing field for property. + private string _migrationSolutionId; + + /// Gets or sets the Migration solution ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string MigrationSolutionId { get => this._migrationSolutionId; set => this._migrationSolutionId = value; } + + /// Creates an new instance. + public AzStackHciFabricModelCustomProperties() + { + + } + + /// 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.Migrate.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__fabricModelCustomProperties), __fabricModelCustomProperties); + await eventListener.AssertObjectIsValid(nameof(__fabricModelCustomProperties), __fabricModelCustomProperties); + } + } + /// AzStackHCI fabric model custom properties. + public partial interface IAzStackHciFabricModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCustomProperties + { + /// Gets or sets the Appliance name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the Appliance name.", + SerializedName = @"applianceName", + PossibleTypes = new [] { typeof(string) })] + string[] ApplianceName { get; } + /// Gets or sets the ARM Id of the AzStackHCI site. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the ARM Id of the AzStackHCI site.", + SerializedName = @"azStackHciSiteId", + PossibleTypes = new [] { typeof(string) })] + string AzStackHciSiteId { get; set; } + /// AzStackHCI cluster properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"AzStackHCI cluster properties.", + SerializedName = @"cluster", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciClusterProperties) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciClusterProperties Cluster { get; set; } + /// Gets or sets the fabric container Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the fabric container Id.", + SerializedName = @"fabricContainerId", + PossibleTypes = new [] { typeof(string) })] + string FabricContainerId { get; } + /// Gets or sets the fabric resource Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the fabric resource Id.", + SerializedName = @"fabricResourceId", + PossibleTypes = new [] { typeof(string) })] + string FabricResourceId { get; } + /// Gets or sets the migration hub Uri. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the migration hub Uri.", + SerializedName = @"migrationHubUri", + PossibleTypes = new [] { typeof(string) })] + string MigrationHubUri { get; } + /// Gets or sets the Migration solution ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the Migration solution ARM Id.", + SerializedName = @"migrationSolutionId", + PossibleTypes = new [] { typeof(string) })] + string MigrationSolutionId { get; set; } + + } + /// AzStackHCI fabric model custom properties. + internal partial interface IAzStackHciFabricModelCustomPropertiesInternal : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCustomPropertiesInternal + { + /// Gets or sets the Appliance name. + string[] ApplianceName { get; set; } + /// Gets or sets the ARM Id of the AzStackHCI site. + string AzStackHciSiteId { get; set; } + /// AzStackHCI cluster properties. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciClusterProperties Cluster { get; set; } + /// Gets or sets the fabric container Id. + string FabricContainerId { get; set; } + /// Gets or sets the fabric resource Id. + string FabricResourceId { get; set; } + /// Gets or sets the migration hub Uri. + string MigrationHubUri { get; set; } + /// Gets or sets the Migration solution ARM Id. + string MigrationSolutionId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/AzStackHciFabricModelCustomProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/AzStackHciFabricModelCustomProperties.json.cs new file mode 100644 index 000000000000..cd52807355cd --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/AzStackHciFabricModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// AzStackHCI fabric model custom properties. + public partial class AzStackHciFabricModelCustomProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal AzStackHciFabricModelCustomProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __fabricModelCustomProperties = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelCustomProperties(json); + {_azStackHciSiteId = If( json?.PropertyT("azStackHciSiteId"), out var __jsonAzStackHciSiteId) ? (string)__jsonAzStackHciSiteId : (string)AzStackHciSiteId;} + {_applianceName = If( json?.PropertyT("applianceName"), out var __jsonApplianceName) ? If( __jsonApplianceName as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : ApplianceName;} + {_cluster = If( json?.PropertyT("cluster"), out var __jsonCluster) ? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHciClusterProperties.FromJson(__jsonCluster) : Cluster;} + {_fabricResourceId = If( json?.PropertyT("fabricResourceId"), out var __jsonFabricResourceId) ? (string)__jsonFabricResourceId : (string)FabricResourceId;} + {_fabricContainerId = If( json?.PropertyT("fabricContainerId"), out var __jsonFabricContainerId) ? (string)__jsonFabricContainerId : (string)FabricContainerId;} + {_migrationSolutionId = If( json?.PropertyT("migrationSolutionId"), out var __jsonMigrationSolutionId) ? (string)__jsonMigrationSolutionId : (string)MigrationSolutionId;} + {_migrationHubUri = If( json?.PropertyT("migrationHubUri"), out var __jsonMigrationHubUri) ? (string)__jsonMigrationHubUri : (string)MigrationHubUri;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciFabricModelCustomProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciFabricModelCustomProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IAzStackHciFabricModelCustomProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new AzStackHciFabricModelCustomProperties(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __fabricModelCustomProperties?.ToJson(container, serializationMode); + AddIf( null != (((object)this._azStackHciSiteId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._azStackHciSiteId.ToString()) : null, "azStackHciSiteId" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._applianceName) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.XNodeArray(); + foreach( var __x in this._applianceName ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("applianceName",__w); + } + } + AddIf( null != this._cluster ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._cluster.ToJson(null,serializationMode) : null, "cluster" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._fabricResourceId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._fabricResourceId.ToString()) : null, "fabricResourceId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._fabricContainerId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._fabricContainerId.ToString()) : null, "fabricContainerId" ,container.Add ); + } + AddIf( null != (((object)this._migrationSolutionId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._migrationSolutionId.ToString()) : null, "migrationSolutionId" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._migrationHubUri)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._migrationHubUri.ToString()) : null, "migrationHubUri" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/CheckNameAvailabilityModel.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/CheckNameAvailabilityModel.PowerShell.cs new file mode 100644 index 000000000000..e6d75f03a9df --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/CheckNameAvailabilityModel.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Check name availability model. + [System.ComponentModel.TypeConverter(typeof(CheckNameAvailabilityModelTypeConverter))] + public partial class CheckNameAvailabilityModel + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should 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 CheckNameAvailabilityModel(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.Migrate.Models.Api20210216Preview.ICheckNameAvailabilityModelInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ICheckNameAvailabilityModelInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ICheckNameAvailabilityModelInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ICheckNameAvailabilityModelInternal)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 CheckNameAvailabilityModel(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.Migrate.Models.Api20210216Preview.ICheckNameAvailabilityModelInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ICheckNameAvailabilityModelInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ICheckNameAvailabilityModelInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ICheckNameAvailabilityModelInternal)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.Migrate.Models.Api20210216Preview.ICheckNameAvailabilityModel DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CheckNameAvailabilityModel(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ICheckNameAvailabilityModel DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CheckNameAvailabilityModel(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ICheckNameAvailabilityModel FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Check name availability model. + [System.ComponentModel.TypeConverter(typeof(CheckNameAvailabilityModelTypeConverter))] + public partial interface ICheckNameAvailabilityModel + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/CheckNameAvailabilityModel.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/CheckNameAvailabilityModel.TypeConverter.cs new file mode 100644 index 000000000000..9e0d0d53248e --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/CheckNameAvailabilityModel.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CheckNameAvailabilityModelTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ICheckNameAvailabilityModel ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ICheckNameAvailabilityModel).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CheckNameAvailabilityModel.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CheckNameAvailabilityModel.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CheckNameAvailabilityModel.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/CheckNameAvailabilityModel.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/CheckNameAvailabilityModel.cs new file mode 100644 index 000000000000..3cbea16a3017 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/CheckNameAvailabilityModel.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Check name availability model. + public partial class CheckNameAvailabilityModel : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ICheckNameAvailabilityModel, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ICheckNameAvailabilityModelInternal + { + + /// Backing field for property. + private string _name; + + /// Gets or sets the resource name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private string _type; + + /// Gets or sets the resource type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Type { get => this._type; set => this._type = value; } + + /// Creates an new instance. + public CheckNameAvailabilityModel() + { + + } + } + /// Check name availability model. + public partial interface ICheckNameAvailabilityModel : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the resource name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the resource name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + /// Gets or sets the resource type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the resource type.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; set; } + + } + /// Check name availability model. + internal partial interface ICheckNameAvailabilityModelInternal + + { + /// Gets or sets the resource name. + string Name { get; set; } + /// Gets or sets the resource type. + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/CheckNameAvailabilityModel.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/CheckNameAvailabilityModel.json.cs new file mode 100644 index 000000000000..2a1b5e1839db --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/CheckNameAvailabilityModel.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Check name availability model. + public partial class CheckNameAvailabilityModel + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal CheckNameAvailabilityModel(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api20210216Preview.ICheckNameAvailabilityModel. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ICheckNameAvailabilityModel. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ICheckNameAvailabilityModel FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new CheckNameAvailabilityModel(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/CheckNameAvailabilityResponseModel.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/CheckNameAvailabilityResponseModel.PowerShell.cs new file mode 100644 index 000000000000..6691a7df0889 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/CheckNameAvailabilityResponseModel.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Check name availability response model. + [System.ComponentModel.TypeConverter(typeof(CheckNameAvailabilityResponseModelTypeConverter))] + public partial class CheckNameAvailabilityResponseModel + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should 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 CheckNameAvailabilityResponseModel(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("NameAvailable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ICheckNameAvailabilityResponseModelInternal)this).NameAvailable = (bool?) content.GetValueForProperty("NameAvailable",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ICheckNameAvailabilityResponseModelInternal)this).NameAvailable, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("Reason")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ICheckNameAvailabilityResponseModelInternal)this).Reason = (string) content.GetValueForProperty("Reason",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ICheckNameAvailabilityResponseModelInternal)this).Reason, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ICheckNameAvailabilityResponseModelInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ICheckNameAvailabilityResponseModelInternal)this).Message, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal CheckNameAvailabilityResponseModel(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("NameAvailable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ICheckNameAvailabilityResponseModelInternal)this).NameAvailable = (bool?) content.GetValueForProperty("NameAvailable",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ICheckNameAvailabilityResponseModelInternal)this).NameAvailable, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("Reason")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ICheckNameAvailabilityResponseModelInternal)this).Reason = (string) content.GetValueForProperty("Reason",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ICheckNameAvailabilityResponseModelInternal)this).Reason, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ICheckNameAvailabilityResponseModelInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ICheckNameAvailabilityResponseModelInternal)this).Message, 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.Migrate.Models.Api20210216Preview.ICheckNameAvailabilityResponseModel DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new CheckNameAvailabilityResponseModel(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ICheckNameAvailabilityResponseModel DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new CheckNameAvailabilityResponseModel(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ICheckNameAvailabilityResponseModel FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Check name availability response model. + [System.ComponentModel.TypeConverter(typeof(CheckNameAvailabilityResponseModelTypeConverter))] + public partial interface ICheckNameAvailabilityResponseModel + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/CheckNameAvailabilityResponseModel.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/CheckNameAvailabilityResponseModel.TypeConverter.cs new file mode 100644 index 000000000000..0ee2f24cf3ed --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/CheckNameAvailabilityResponseModel.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class CheckNameAvailabilityResponseModelTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ICheckNameAvailabilityResponseModel ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ICheckNameAvailabilityResponseModel).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return CheckNameAvailabilityResponseModel.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return CheckNameAvailabilityResponseModel.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return CheckNameAvailabilityResponseModel.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/CheckNameAvailabilityResponseModel.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/CheckNameAvailabilityResponseModel.cs new file mode 100644 index 000000000000..740dcc3aa49a --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/CheckNameAvailabilityResponseModel.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Check name availability response model. + public partial class CheckNameAvailabilityResponseModel : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ICheckNameAvailabilityResponseModel, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ICheckNameAvailabilityResponseModelInternal + { + + /// Backing field for property. + private string _message; + + /// Gets or sets the message for resource name unavailability. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Message { get => this._message; set => this._message = value; } + + /// Backing field for property. + private bool? _nameAvailable; + + /// Gets or sets a value indicating whether resource name is available or not. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public bool? NameAvailable { get => this._nameAvailable; set => this._nameAvailable = value; } + + /// Backing field for property. + private string _reason; + + /// Gets or sets the reason for resource name unavailability. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Reason { get => this._reason; set => this._reason = value; } + + /// Creates an new instance. + public CheckNameAvailabilityResponseModel() + { + + } + } + /// Check name availability response model. + public partial interface ICheckNameAvailabilityResponseModel : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the message for resource name unavailability. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the message for resource name unavailability.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; set; } + /// Gets or sets a value indicating whether resource name is available or not. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets a value indicating whether resource name is available or not.", + SerializedName = @"nameAvailable", + PossibleTypes = new [] { typeof(bool) })] + bool? NameAvailable { get; set; } + /// Gets or sets the reason for resource name unavailability. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the reason for resource name unavailability.", + SerializedName = @"reason", + PossibleTypes = new [] { typeof(string) })] + string Reason { get; set; } + + } + /// Check name availability response model. + internal partial interface ICheckNameAvailabilityResponseModelInternal + + { + /// Gets or sets the message for resource name unavailability. + string Message { get; set; } + /// Gets or sets a value indicating whether resource name is available or not. + bool? NameAvailable { get; set; } + /// Gets or sets the reason for resource name unavailability. + string Reason { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/CheckNameAvailabilityResponseModel.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/CheckNameAvailabilityResponseModel.json.cs new file mode 100644 index 000000000000..922c196cc86f --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/CheckNameAvailabilityResponseModel.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Check name availability response model. + public partial class CheckNameAvailabilityResponseModel + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal CheckNameAvailabilityResponseModel(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_nameAvailable = If( json?.PropertyT("nameAvailable"), out var __jsonNameAvailable) ? (bool?)__jsonNameAvailable : NameAvailable;} + {_reason = If( json?.PropertyT("reason"), out var __jsonReason) ? (string)__jsonReason : (string)Reason;} + {_message = If( json?.PropertyT("message"), out var __jsonMessage) ? (string)__jsonMessage : (string)Message;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ICheckNameAvailabilityResponseModel. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ICheckNameAvailabilityResponseModel. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ICheckNameAvailabilityResponseModel FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new CheckNameAvailabilityResponseModel(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._nameAvailable ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonBoolean((bool)this._nameAvailable) : null, "nameAvailable" ,container.Add ); + AddIf( null != (((object)this._reason)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._reason.ToString()) : null, "reason" ,container.Add ); + AddIf( null != (((object)this._message)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._message.ToString()) : null, "message" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DeploymentPreflightModel.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DeploymentPreflightModel.PowerShell.cs new file mode 100644 index 000000000000..3ff96869a75a --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DeploymentPreflightModel.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Deployment preflight model. + [System.ComponentModel.TypeConverter(typeof(DeploymentPreflightModelTypeConverter))] + public partial class DeploymentPreflightModel + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should 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 DeploymentPreflightModel(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Resource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightModelInternal)this).Resource = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightResource[]) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightModelInternal)this).Resource, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.DeploymentPreflightResourceTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DeploymentPreflightModel(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Resource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightModelInternal)this).Resource = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightResource[]) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightModelInternal)this).Resource, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.DeploymentPreflightResourceTypeConverter.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.Migrate.Models.Api20210216Preview.IDeploymentPreflightModel DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DeploymentPreflightModel(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightModel DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DeploymentPreflightModel(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightModel FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Deployment preflight model. + [System.ComponentModel.TypeConverter(typeof(DeploymentPreflightModelTypeConverter))] + public partial interface IDeploymentPreflightModel + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DeploymentPreflightModel.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DeploymentPreflightModel.TypeConverter.cs new file mode 100644 index 000000000000..e95105dbfddc --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DeploymentPreflightModel.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DeploymentPreflightModelTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightModel ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightModel).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DeploymentPreflightModel.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DeploymentPreflightModel.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DeploymentPreflightModel.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DeploymentPreflightModel.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DeploymentPreflightModel.cs new file mode 100644 index 000000000000..8680a5432250 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DeploymentPreflightModel.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Deployment preflight model. + public partial class DeploymentPreflightModel : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightModel, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightModelInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightResource[] _resource; + + /// Gets or sets the list of resources. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightResource[] Resource { get => this._resource; set => this._resource = value; } + + /// Creates an new instance. + public DeploymentPreflightModel() + { + + } + } + /// Deployment preflight model. + public partial interface IDeploymentPreflightModel : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the list of resources. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the list of resources.", + SerializedName = @"resources", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightResource) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightResource[] Resource { get; set; } + + } + /// Deployment preflight model. + internal partial interface IDeploymentPreflightModelInternal + + { + /// Gets or sets the list of resources. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightResource[] Resource { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DeploymentPreflightModel.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DeploymentPreflightModel.json.cs new file mode 100644 index 000000000000..1c710ce7d350 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DeploymentPreflightModel.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Deployment preflight model. + public partial class DeploymentPreflightModel + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal DeploymentPreflightModel(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_resource = If( json?.PropertyT("resources"), out var __jsonResources) ? If( __jsonResources as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api20210216Preview.IDeploymentPreflightResource) (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.DeploymentPreflightResource.FromJson(__u) )) ))() : null : Resource;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightModel. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightModel. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightModel FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new DeploymentPreflightModel(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._resource) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.XNodeArray(); + foreach( var __x in this._resource ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("resources",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DeploymentPreflightResource.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DeploymentPreflightResource.PowerShell.cs new file mode 100644 index 000000000000..d04fa25e3aeb --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DeploymentPreflightResource.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Deployment preflight resource. + [System.ComponentModel.TypeConverter(typeof(DeploymentPreflightResourceTypeConverter))] + public partial class DeploymentPreflightResource + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should 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 DeploymentPreflightResource(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.Migrate.Models.Api20210216Preview.IDeploymentPreflightResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("ApiVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightResourceInternal)this).ApiVersion = (string) content.GetValueForProperty("ApiVersion",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightResourceInternal)this).ApiVersion, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DeploymentPreflightResource(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.Migrate.Models.Api20210216Preview.IDeploymentPreflightResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightResourceInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightResourceInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightResourceInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("ApiVersion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightResourceInternal)this).ApiVersion = (string) content.GetValueForProperty("ApiVersion",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightResourceInternal)this).ApiVersion, 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.Migrate.Models.Api20210216Preview.IDeploymentPreflightResource DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DeploymentPreflightResource(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightResource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DeploymentPreflightResource(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightResource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Deployment preflight resource. + [System.ComponentModel.TypeConverter(typeof(DeploymentPreflightResourceTypeConverter))] + public partial interface IDeploymentPreflightResource + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DeploymentPreflightResource.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DeploymentPreflightResource.TypeConverter.cs new file mode 100644 index 000000000000..f7034aac2915 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DeploymentPreflightResource.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DeploymentPreflightResourceTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightResource ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightResource).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DeploymentPreflightResource.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DeploymentPreflightResource.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DeploymentPreflightResource.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DeploymentPreflightResource.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DeploymentPreflightResource.cs new file mode 100644 index 000000000000..e044a7b7c398 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DeploymentPreflightResource.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Deployment preflight resource. + public partial class DeploymentPreflightResource : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightResource, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightResourceInternal + { + + /// Backing field for property. + private string _apiVersion; + + /// Gets or sets the Api version. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string ApiVersion { get => this._apiVersion; set => this._apiVersion = value; } + + /// Backing field for property. + private string _location; + + /// Gets or sets the location of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Location { get => this._location; set => this._location = value; } + + /// Backing field for property. + private string _name; + + /// Gets or sets the resource name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private string _type; + + /// Gets or sets the resource type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Type { get => this._type; set => this._type = value; } + + /// Creates an new instance. + public DeploymentPreflightResource() + { + + } + } + /// Deployment preflight resource. + public partial interface IDeploymentPreflightResource : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the Api version. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the Api version.", + SerializedName = @"apiVersion", + PossibleTypes = new [] { typeof(string) })] + string ApiVersion { get; set; } + /// Gets or sets the location of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the location of the resource.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + string Location { get; set; } + /// Gets or sets the resource name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the resource name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + /// Gets or sets the resource type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the resource type.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; set; } + + } + /// Deployment preflight resource. + internal partial interface IDeploymentPreflightResourceInternal + + { + /// Gets or sets the Api version. + string ApiVersion { get; set; } + /// Gets or sets the location of the resource. + string Location { get; set; } + /// Gets or sets the resource name. + string Name { get; set; } + /// Gets or sets the resource type. + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DeploymentPreflightResource.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DeploymentPreflightResource.json.cs new file mode 100644 index 000000000000..327788da92c9 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DeploymentPreflightResource.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Deployment preflight resource. + public partial class DeploymentPreflightResource + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal DeploymentPreflightResource(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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;} + {_location = If( json?.PropertyT("location"), out var __jsonLocation) ? (string)__jsonLocation : (string)Location;} + {_apiVersion = If( json?.PropertyT("apiVersion"), out var __jsonApiVersion) ? (string)__jsonApiVersion : (string)ApiVersion;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightResource. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightResource. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDeploymentPreflightResource FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new DeploymentPreflightResource(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + AddIf( null != (((object)this._location)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._location.ToString()) : null, "location" ,container.Add ); + AddIf( null != (((object)this._apiVersion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._apiVersion.ToString()) : null, "apiVersion" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModel.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModel.PowerShell.cs new file mode 100644 index 000000000000..18cdb6b541e0 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModel.PowerShell.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Dra model. + [System.ComponentModel.TypeConverter(typeof(DraModelTypeConverter))] + public partial class DraModel + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModel DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DraModel(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModel DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DraModel(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DraModel(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.Migrate.Models.Api20210216Preview.IDraModelInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.DraModelPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModelTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState.CreateFrom); + } + if (content.Contains("AuthenticationIdentity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).AuthenticationIdentity = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModel) content.GetValueForProperty("AuthenticationIdentity",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).AuthenticationIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IdentityModelTypeConverter.ConvertFrom); + } + if (content.Contains("ResourceAccessIdentity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).ResourceAccessIdentity = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModel) content.GetValueForProperty("ResourceAccessIdentity",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).ResourceAccessIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IdentityModelTypeConverter.ConvertFrom); + } + if (content.Contains("CustomProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).CustomProperty = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCustomProperties) content.GetValueForProperty("CustomProperty",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).CustomProperty, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.DraModelCustomPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("CorrelationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).CorrelationId = (string) content.GetValueForProperty("CorrelationId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).CorrelationId, global::System.Convert.ToString); + } + if (content.Contains("MachineId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).MachineId = (string) content.GetValueForProperty("MachineId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).MachineId, global::System.Convert.ToString); + } + if (content.Contains("MachineName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).MachineName = (string) content.GetValueForProperty("MachineName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).MachineName, global::System.Convert.ToString); + } + if (content.Contains("IsResponsive")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).IsResponsive = (bool?) content.GetValueForProperty("IsResponsive",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).IsResponsive, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LastHeartbeat")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).LastHeartbeat = (global::System.DateTime?) content.GetValueForProperty("LastHeartbeat",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)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("VersionNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).VersionNumber = (string) content.GetValueForProperty("VersionNumber",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).VersionNumber, global::System.Convert.ToString); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HealthErrorModelTypeConverter.ConvertFrom)); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("AuthenticationIdentityTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).AuthenticationIdentityTenantId = (string) content.GetValueForProperty("AuthenticationIdentityTenantId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).AuthenticationIdentityTenantId, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityApplicationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).AuthenticationIdentityApplicationId = (string) content.GetValueForProperty("AuthenticationIdentityApplicationId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).AuthenticationIdentityApplicationId, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).AuthenticationIdentityObjectId = (string) content.GetValueForProperty("AuthenticationIdentityObjectId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).AuthenticationIdentityObjectId, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityAudience")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).AuthenticationIdentityAudience = (string) content.GetValueForProperty("AuthenticationIdentityAudience",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).AuthenticationIdentityAudience, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityAadAuthority")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).AuthenticationIdentityAadAuthority = (string) content.GetValueForProperty("AuthenticationIdentityAadAuthority",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).AuthenticationIdentityAadAuthority, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).ResourceAccessIdentityTenantId = (string) content.GetValueForProperty("ResourceAccessIdentityTenantId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).ResourceAccessIdentityTenantId, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityApplicationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).ResourceAccessIdentityApplicationId = (string) content.GetValueForProperty("ResourceAccessIdentityApplicationId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).ResourceAccessIdentityApplicationId, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).ResourceAccessIdentityObjectId = (string) content.GetValueForProperty("ResourceAccessIdentityObjectId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).ResourceAccessIdentityObjectId, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityAudience")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).ResourceAccessIdentityAudience = (string) content.GetValueForProperty("ResourceAccessIdentityAudience",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).ResourceAccessIdentityAudience, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityAadAuthority")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).ResourceAccessIdentityAadAuthority = (string) content.GetValueForProperty("ResourceAccessIdentityAadAuthority",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).ResourceAccessIdentityAadAuthority, global::System.Convert.ToString); + } + if (content.Contains("CustomPropertyInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).CustomPropertyInstanceType = (string) content.GetValueForProperty("CustomPropertyInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).CustomPropertyInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DraModel(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.Migrate.Models.Api20210216Preview.IDraModelInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.DraModelPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModelTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState.CreateFrom); + } + if (content.Contains("AuthenticationIdentity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).AuthenticationIdentity = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModel) content.GetValueForProperty("AuthenticationIdentity",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).AuthenticationIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IdentityModelTypeConverter.ConvertFrom); + } + if (content.Contains("ResourceAccessIdentity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).ResourceAccessIdentity = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModel) content.GetValueForProperty("ResourceAccessIdentity",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).ResourceAccessIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IdentityModelTypeConverter.ConvertFrom); + } + if (content.Contains("CustomProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).CustomProperty = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCustomProperties) content.GetValueForProperty("CustomProperty",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).CustomProperty, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.DraModelCustomPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("CorrelationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).CorrelationId = (string) content.GetValueForProperty("CorrelationId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).CorrelationId, global::System.Convert.ToString); + } + if (content.Contains("MachineId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).MachineId = (string) content.GetValueForProperty("MachineId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).MachineId, global::System.Convert.ToString); + } + if (content.Contains("MachineName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).MachineName = (string) content.GetValueForProperty("MachineName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).MachineName, global::System.Convert.ToString); + } + if (content.Contains("IsResponsive")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).IsResponsive = (bool?) content.GetValueForProperty("IsResponsive",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).IsResponsive, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LastHeartbeat")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).LastHeartbeat = (global::System.DateTime?) content.GetValueForProperty("LastHeartbeat",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)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("VersionNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).VersionNumber = (string) content.GetValueForProperty("VersionNumber",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).VersionNumber, global::System.Convert.ToString); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HealthErrorModelTypeConverter.ConvertFrom)); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("AuthenticationIdentityTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).AuthenticationIdentityTenantId = (string) content.GetValueForProperty("AuthenticationIdentityTenantId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).AuthenticationIdentityTenantId, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityApplicationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).AuthenticationIdentityApplicationId = (string) content.GetValueForProperty("AuthenticationIdentityApplicationId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).AuthenticationIdentityApplicationId, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).AuthenticationIdentityObjectId = (string) content.GetValueForProperty("AuthenticationIdentityObjectId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).AuthenticationIdentityObjectId, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityAudience")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).AuthenticationIdentityAudience = (string) content.GetValueForProperty("AuthenticationIdentityAudience",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).AuthenticationIdentityAudience, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityAadAuthority")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).AuthenticationIdentityAadAuthority = (string) content.GetValueForProperty("AuthenticationIdentityAadAuthority",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).AuthenticationIdentityAadAuthority, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).ResourceAccessIdentityTenantId = (string) content.GetValueForProperty("ResourceAccessIdentityTenantId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).ResourceAccessIdentityTenantId, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityApplicationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).ResourceAccessIdentityApplicationId = (string) content.GetValueForProperty("ResourceAccessIdentityApplicationId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).ResourceAccessIdentityApplicationId, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).ResourceAccessIdentityObjectId = (string) content.GetValueForProperty("ResourceAccessIdentityObjectId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).ResourceAccessIdentityObjectId, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityAudience")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).ResourceAccessIdentityAudience = (string) content.GetValueForProperty("ResourceAccessIdentityAudience",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).ResourceAccessIdentityAudience, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityAadAuthority")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).ResourceAccessIdentityAadAuthority = (string) content.GetValueForProperty("ResourceAccessIdentityAadAuthority",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).ResourceAccessIdentityAadAuthority, global::System.Convert.ToString); + } + if (content.Contains("CustomPropertyInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).CustomPropertyInstanceType = (string) content.GetValueForProperty("CustomPropertyInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal)this).CustomPropertyInstanceType, 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.Migrate.Models.Api20210216Preview.IDraModel FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Dra model. + [System.ComponentModel.TypeConverter(typeof(DraModelTypeConverter))] + public partial interface IDraModel + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModel.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModel.TypeConverter.cs new file mode 100644 index 000000000000..e7d4929df9a5 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModel.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DraModelTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModel ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModel).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DraModel.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DraModel.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DraModel.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModel.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModel.cs new file mode 100644 index 000000000000..3f92c7cefe06 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModel.cs @@ -0,0 +1,541 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Dra model. + public partial class DraModel : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModel, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal + { + + /// Gets or sets the authority of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string AuthenticationIdentityAadAuthority { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).AuthenticationIdentityAadAuthority; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).AuthenticationIdentityAadAuthority = value ; } + + /// + /// Gets or sets the client/application Id of the SPN with which Dra communicates to + /// service. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string AuthenticationIdentityApplicationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).AuthenticationIdentityApplicationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).AuthenticationIdentityApplicationId = value ; } + + /// Gets or sets the audience of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string AuthenticationIdentityAudience { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).AuthenticationIdentityAudience; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).AuthenticationIdentityAudience = value ; } + + /// Gets or sets the object Id of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string AuthenticationIdentityObjectId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).AuthenticationIdentityObjectId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).AuthenticationIdentityObjectId = value ; } + + /// Gets or sets the tenant Id of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string AuthenticationIdentityTenantId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).AuthenticationIdentityTenantId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).AuthenticationIdentityTenantId = value ; } + + /// Gets or sets the Dra correlation Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string CorrelationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).CorrelationId; } + + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string CustomPropertyInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).CustomPropertyInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).CustomPropertyInstanceType = value ; } + + /// Gets or sets the list of health errors. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel[] HealthError { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).HealthError; } + + /// Backing field for property. + private string _id; + + /// Gets or sets the Id of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Id { get => this._id; } + + /// Gets or sets a value indicating whether Dra is responsive. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public bool? IsResponsive { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).IsResponsive; } + + /// Gets or sets the time when last heartbeat was sent by the Dra. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public global::System.DateTime? LastHeartbeat { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).LastHeartbeat; } + + /// Gets or sets the machine Id where Dra is running. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string MachineId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).MachineId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).MachineId = value ; } + + /// Gets or sets the machine name where Dra is running. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string MachineName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).MachineName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).MachineName = value ; } + + /// Internal Acessors for AuthenticationIdentity + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModel Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal.AuthenticationIdentity { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).AuthenticationIdentity; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).AuthenticationIdentity = value; } + + /// Internal Acessors for CorrelationId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal.CorrelationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).CorrelationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).CorrelationId = value; } + + /// Internal Acessors for CustomProperty + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCustomProperties Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal.CustomProperty { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).CustomProperty; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).CustomProperty = value; } + + /// Internal Acessors for HealthError + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel[] Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal.HealthError { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).HealthError; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).HealthError = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal.Id { get => this._id; set { {_id = value;} } } + + /// Internal Acessors for IsResponsive + bool? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal.IsResponsive { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).IsResponsive; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).IsResponsive = value; } + + /// Internal Acessors for LastHeartbeat + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal.LastHeartbeat { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).LastHeartbeat; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).LastHeartbeat = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal.Name { get => this._name; set { {_name = value;} } } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelProperties Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.DraModelProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal.ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).ProvisioningState = value; } + + /// Internal Acessors for ResourceAccessIdentity + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModel Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal.ResourceAccessIdentity { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).ResourceAccessIdentity; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).ResourceAccessIdentity = value; } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal.SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel()); set { {_systemData = value;} } } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal.Type { get => this._type; set { {_type = value;} } } + + /// Internal Acessors for VersionNumber + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelInternal.VersionNumber { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).VersionNumber; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).VersionNumber = value; } + + /// Backing field for property. + private string _name; + + /// Gets or sets the name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Name { get => this._name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelProperties _property; + + /// Dra model properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.DraModelProperties()); set => this._property = value; } + + /// Gets or sets the provisioning state of the Dra. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState? ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).ProvisioningState; } + + /// Gets or sets the authority of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string ResourceAccessIdentityAadAuthority { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).ResourceAccessIdentityAadAuthority; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).ResourceAccessIdentityAadAuthority = value ; } + + /// + /// Gets or sets the client/application Id of the SPN with which Dra communicates to + /// service. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string ResourceAccessIdentityApplicationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).ResourceAccessIdentityApplicationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).ResourceAccessIdentityApplicationId = value ; } + + /// Gets or sets the audience of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string ResourceAccessIdentityAudience { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).ResourceAccessIdentityAudience; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).ResourceAccessIdentityAudience = value ; } + + /// Gets or sets the object Id of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string ResourceAccessIdentityObjectId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).ResourceAccessIdentityObjectId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).ResourceAccessIdentityObjectId = value ; } + + /// Gets or sets the tenant Id of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string ResourceAccessIdentityTenantId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).ResourceAccessIdentityTenantId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).ResourceAccessIdentityTenantId = value ; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel _systemData; + + /// System data required to be defined for Azure resources. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel()); } + + /// Gets or sets the timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedByType = value ?? null; } + + /// Gets or sets the timestamp of resource last modification (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets the identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedByType = value ?? null; } + + /// Backing field for property. + private string _type; + + /// Gets or sets the type of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Type { get => this._type; } + + /// Gets or sets the Dra version. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string VersionNumber { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)Property).VersionNumber; } + + /// Creates an new instance. + public DraModel() + { + + } + } + /// Dra model. + public partial interface IDraModel : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the authority of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the authority of the SPN with which Dra communicates to service.", + SerializedName = @"aadAuthority", + PossibleTypes = new [] { typeof(string) })] + string AuthenticationIdentityAadAuthority { get; set; } + /// + /// Gets or sets the client/application Id of the SPN with which Dra communicates to + /// service. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the client/application Id of the SPN with which Dra communicates to + service.", + SerializedName = @"applicationId", + PossibleTypes = new [] { typeof(string) })] + string AuthenticationIdentityApplicationId { get; set; } + /// Gets or sets the audience of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the audience of the SPN with which Dra communicates to service.", + SerializedName = @"audience", + PossibleTypes = new [] { typeof(string) })] + string AuthenticationIdentityAudience { get; set; } + /// Gets or sets the object Id of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the object Id of the SPN with which Dra communicates to service.", + SerializedName = @"objectId", + PossibleTypes = new [] { typeof(string) })] + string AuthenticationIdentityObjectId { get; set; } + /// Gets or sets the tenant Id of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the tenant Id of the SPN with which Dra communicates to service.", + SerializedName = @"tenantId", + PossibleTypes = new [] { typeof(string) })] + string AuthenticationIdentityTenantId { get; set; } + /// Gets or sets the Dra correlation Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the Dra correlation Id.", + SerializedName = @"correlationId", + PossibleTypes = new [] { typeof(string) })] + string CorrelationId { get; } + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string CustomPropertyInstanceType { get; set; } + /// Gets or sets the list of health errors. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the list of health errors.", + SerializedName = @"healthErrors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel[] HealthError { get; } + /// Gets or sets the Id of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the Id of the resource.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; } + /// Gets or sets a value indicating whether Dra is responsive. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets a value indicating whether Dra is responsive.", + SerializedName = @"isResponsive", + PossibleTypes = new [] { typeof(bool) })] + bool? IsResponsive { get; } + /// Gets or sets the time when last heartbeat was sent by the Dra. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the time when last heartbeat was sent by the Dra.", + SerializedName = @"lastHeartbeat", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastHeartbeat { get; } + /// Gets or sets the machine Id where Dra is running. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the machine Id where Dra is running.", + SerializedName = @"machineId", + PossibleTypes = new [] { typeof(string) })] + string MachineId { get; set; } + /// Gets or sets the machine name where Dra is running. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the machine name where Dra is running.", + SerializedName = @"machineName", + PossibleTypes = new [] { typeof(string) })] + string MachineName { get; set; } + /// Gets or sets the name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the name of the resource.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; } + /// Gets or sets the provisioning state of the Dra. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the provisioning state of the Dra.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState? ProvisioningState { get; } + /// Gets or sets the authority of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the authority of the SPN with which Dra communicates to service.", + SerializedName = @"aadAuthority", + PossibleTypes = new [] { typeof(string) })] + string ResourceAccessIdentityAadAuthority { get; set; } + /// + /// Gets or sets the client/application Id of the SPN with which Dra communicates to + /// service. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the client/application Id of the SPN with which Dra communicates to + service.", + SerializedName = @"applicationId", + PossibleTypes = new [] { typeof(string) })] + string ResourceAccessIdentityApplicationId { get; set; } + /// Gets or sets the audience of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the audience of the SPN with which Dra communicates to service.", + SerializedName = @"audience", + PossibleTypes = new [] { typeof(string) })] + string ResourceAccessIdentityAudience { get; set; } + /// Gets or sets the object Id of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the object Id of the SPN with which Dra communicates to service.", + SerializedName = @"objectId", + PossibleTypes = new [] { typeof(string) })] + string ResourceAccessIdentityObjectId { get; set; } + /// Gets or sets the tenant Id of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the tenant Id of the SPN with which Dra communicates to service.", + SerializedName = @"tenantId", + PossibleTypes = new [] { typeof(string) })] + string ResourceAccessIdentityTenantId { get; set; } + /// Gets or sets the timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the timestamp of resource creation (UTC).", + SerializedName = @"createdAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataCreatedAt { get; set; } + /// Gets or sets identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets identity that created the resource.", + SerializedName = @"createdBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataCreatedBy { get; set; } + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the type of identity that created the resource: user, application, + managedIdentity.", + SerializedName = @"createdByType", + PossibleTypes = new [] { typeof(string) })] + string SystemDataCreatedByType { get; set; } + /// Gets or sets the timestamp of resource last modification (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the timestamp of resource last modification (UTC).", + SerializedName = @"lastModifiedAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataLastModifiedAt { get; set; } + /// Gets or sets the identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the identity that last modified the resource.", + SerializedName = @"lastModifiedBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataLastModifiedBy { get; set; } + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the type of identity that last modified the resource: user, application, + managedIdentity.", + SerializedName = @"lastModifiedByType", + PossibleTypes = new [] { typeof(string) })] + string SystemDataLastModifiedByType { get; set; } + /// Gets or sets the type of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the type of the resource.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; } + /// Gets or sets the Dra version. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the Dra version.", + SerializedName = @"versionNumber", + PossibleTypes = new [] { typeof(string) })] + string VersionNumber { get; } + + } + /// Dra model. + internal partial interface IDraModelInternal + + { + /// Identity model. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModel AuthenticationIdentity { get; set; } + /// Gets or sets the authority of the SPN with which Dra communicates to service. + string AuthenticationIdentityAadAuthority { get; set; } + /// + /// Gets or sets the client/application Id of the SPN with which Dra communicates to + /// service. + /// + string AuthenticationIdentityApplicationId { get; set; } + /// Gets or sets the audience of the SPN with which Dra communicates to service. + string AuthenticationIdentityAudience { get; set; } + /// Gets or sets the object Id of the SPN with which Dra communicates to service. + string AuthenticationIdentityObjectId { get; set; } + /// Gets or sets the tenant Id of the SPN with which Dra communicates to service. + string AuthenticationIdentityTenantId { get; set; } + /// Gets or sets the Dra correlation Id. + string CorrelationId { get; set; } + /// Dra model custom properties. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCustomProperties CustomProperty { get; set; } + /// Gets or sets the instance type. + string CustomPropertyInstanceType { get; set; } + /// Gets or sets the list of health errors. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel[] HealthError { get; set; } + /// Gets or sets the Id of the resource. + string Id { get; set; } + /// Gets or sets a value indicating whether Dra is responsive. + bool? IsResponsive { get; set; } + /// Gets or sets the time when last heartbeat was sent by the Dra. + global::System.DateTime? LastHeartbeat { get; set; } + /// Gets or sets the machine Id where Dra is running. + string MachineId { get; set; } + /// Gets or sets the machine name where Dra is running. + string MachineName { get; set; } + /// Gets or sets the name of the resource. + string Name { get; set; } + /// Dra model properties. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelProperties Property { get; set; } + /// Gets or sets the provisioning state of the Dra. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState? ProvisioningState { get; set; } + /// Identity model. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModel ResourceAccessIdentity { get; set; } + /// Gets or sets the authority of the SPN with which Dra communicates to service. + string ResourceAccessIdentityAadAuthority { get; set; } + /// + /// Gets or sets the client/application Id of the SPN with which Dra communicates to + /// service. + /// + string ResourceAccessIdentityApplicationId { get; set; } + /// Gets or sets the audience of the SPN with which Dra communicates to service. + string ResourceAccessIdentityAudience { get; set; } + /// Gets or sets the object Id of the SPN with which Dra communicates to service. + string ResourceAccessIdentityObjectId { get; set; } + /// Gets or sets the tenant Id of the SPN with which Dra communicates to service. + string ResourceAccessIdentityTenantId { get; set; } + /// System data required to be defined for Azure resources. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel SystemData { get; set; } + /// Gets or sets the timestamp of resource creation (UTC). + global::System.DateTime? SystemDataCreatedAt { get; set; } + /// Gets or sets identity that created the resource. + string SystemDataCreatedBy { get; set; } + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + string SystemDataCreatedByType { get; set; } + /// Gets or sets the timestamp of resource last modification (UTC). + global::System.DateTime? SystemDataLastModifiedAt { get; set; } + /// Gets or sets the identity that last modified the resource. + string SystemDataLastModifiedBy { get; set; } + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + string SystemDataLastModifiedByType { get; set; } + /// Gets or sets the type of the resource. + string Type { get; set; } + /// Gets or sets the Dra version. + string VersionNumber { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModel.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModel.json.cs new file mode 100644 index 000000000000..a6ea1896f22e --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModel.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Dra model. + public partial class DraModel + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal DraModel(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api20210216Preview.DraModelProperties.FromJson(__jsonProperties) : Property;} + {_systemData = If( json?.PropertyT("systemData"), out var __jsonSystemData) ? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel.FromJson(__jsonSystemData) : SystemData;} + {_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); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModel. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModel. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModel FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new DraModel(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._systemData ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._systemData.ToJson(null,serializationMode) : null, "systemData" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelCollection.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelCollection.PowerShell.cs new file mode 100644 index 000000000000..865744e69aaf --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelCollection.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Dra model collection. + [System.ComponentModel.TypeConverter(typeof(DraModelCollectionTypeConverter))] + public partial class DraModelCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DraModelCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DraModelCollection(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DraModelCollection(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.Migrate.Models.Api20210216Preview.IDraModelCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModel[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.DraModelTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCollectionInternal)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 DraModelCollection(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.Migrate.Models.Api20210216Preview.IDraModelCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModel[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.DraModelTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCollectionInternal)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.Migrate.Models.Api20210216Preview.IDraModelCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Dra model collection. + [System.ComponentModel.TypeConverter(typeof(DraModelCollectionTypeConverter))] + public partial interface IDraModelCollection + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelCollection.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelCollection.TypeConverter.cs new file mode 100644 index 000000000000..9f65ecc09294 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelCollection.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DraModelCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DraModelCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DraModelCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DraModelCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelCollection.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelCollection.cs new file mode 100644 index 000000000000..9fa200022c18 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelCollection.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Dra model collection. + public partial class DraModelCollection : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCollection, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// Gets or sets the value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModel[] _value; + + /// Gets or sets the list of Dras. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModel[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public DraModelCollection() + { + + } + } + /// Dra model collection. + public partial interface IDraModelCollection : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the value of next link.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// Gets or sets the list of Dras. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the list of Dras.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModel) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModel[] Value { get; set; } + + } + /// Dra model collection. + internal partial interface IDraModelCollectionInternal + + { + /// Gets or sets the value of next link. + string NextLink { get; set; } + /// Gets or sets the list of Dras. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModel[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelCollection.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelCollection.json.cs new file mode 100644 index 000000000000..32ec6d7a44dc --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelCollection.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Dra model collection. + public partial class DraModelCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal DraModelCollection(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Models.Api20210216Preview.IDraModel) (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.DraModel.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.Migrate.Models.Api20210216Preview.IDraModelCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new DraModelCollection(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelCustomProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelCustomProperties.PowerShell.cs new file mode 100644 index 000000000000..756ad9189305 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Dra model custom properties. + [System.ComponentModel.TypeConverter(typeof(DraModelCustomPropertiesTypeConverter))] + public partial class DraModelCustomProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCustomProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DraModelCustomProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCustomProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DraModelCustomProperties(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DraModelCustomProperties(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.Migrate.Models.Api20210216Preview.IDraModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCustomPropertiesInternal)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 DraModelCustomProperties(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.Migrate.Models.Api20210216Preview.IDraModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCustomPropertiesInternal)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.Migrate.Models.Api20210216Preview.IDraModelCustomProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Dra model custom properties. + [System.ComponentModel.TypeConverter(typeof(DraModelCustomPropertiesTypeConverter))] + public partial interface IDraModelCustomProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelCustomProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelCustomProperties.TypeConverter.cs new file mode 100644 index 000000000000..fec6c9337c7f --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelCustomProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DraModelCustomPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCustomProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCustomProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DraModelCustomProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DraModelCustomProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DraModelCustomProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelCustomProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelCustomProperties.cs new file mode 100644 index 000000000000..a0b5e21ff89a --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Dra model custom properties. + public partial class DraModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCustomProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCustomPropertiesInternal + { + + /// Backing field for property. + private string _instanceType; + + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Creates an new instance. + public DraModelCustomProperties() + { + + } + } + /// Dra model custom properties. + public partial interface IDraModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Dra model custom properties. + internal partial interface IDraModelCustomPropertiesInternal + + { + /// Gets or sets the instance type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelCustomProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelCustomProperties.json.cs new file mode 100644 index 000000000000..1f98b0b88c49 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Dra model custom properties. + public partial class DraModelCustomProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal DraModelCustomProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api20210216Preview.IDraModelCustomProperties. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCustomProperties 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.Migrate.Models.Api20210216Preview.IDraModelCustomProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCustomProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "VMware": + { + return new VMwareDraModelCustomProperties(json); + } + } + return new DraModelCustomProperties(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelProperties.PowerShell.cs new file mode 100644 index 000000000000..e2809308dfeb --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelProperties.PowerShell.cs @@ -0,0 +1,312 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Dra model properties. + [System.ComponentModel.TypeConverter(typeof(DraModelPropertiesTypeConverter))] + public partial class DraModelProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DraModelProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DraModelProperties(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DraModelProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AuthenticationIdentity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).AuthenticationIdentity = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModel) content.GetValueForProperty("AuthenticationIdentity",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).AuthenticationIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IdentityModelTypeConverter.ConvertFrom); + } + if (content.Contains("ResourceAccessIdentity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).ResourceAccessIdentity = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModel) content.GetValueForProperty("ResourceAccessIdentity",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).ResourceAccessIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IdentityModelTypeConverter.ConvertFrom); + } + if (content.Contains("CustomProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).CustomProperty = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCustomProperties) content.GetValueForProperty("CustomProperty",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).CustomProperty, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.DraModelCustomPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("CorrelationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).CorrelationId = (string) content.GetValueForProperty("CorrelationId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).CorrelationId, global::System.Convert.ToString); + } + if (content.Contains("MachineId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).MachineId = (string) content.GetValueForProperty("MachineId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).MachineId, global::System.Convert.ToString); + } + if (content.Contains("MachineName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).MachineName = (string) content.GetValueForProperty("MachineName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).MachineName, global::System.Convert.ToString); + } + if (content.Contains("IsResponsive")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).IsResponsive = (bool?) content.GetValueForProperty("IsResponsive",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).IsResponsive, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LastHeartbeat")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).LastHeartbeat = (global::System.DateTime?) content.GetValueForProperty("LastHeartbeat",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)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("VersionNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).VersionNumber = (string) content.GetValueForProperty("VersionNumber",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).VersionNumber, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState.CreateFrom); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HealthErrorModelTypeConverter.ConvertFrom)); + } + if (content.Contains("AuthenticationIdentityTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).AuthenticationIdentityTenantId = (string) content.GetValueForProperty("AuthenticationIdentityTenantId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).AuthenticationIdentityTenantId, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityApplicationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).AuthenticationIdentityApplicationId = (string) content.GetValueForProperty("AuthenticationIdentityApplicationId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).AuthenticationIdentityApplicationId, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).AuthenticationIdentityObjectId = (string) content.GetValueForProperty("AuthenticationIdentityObjectId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).AuthenticationIdentityObjectId, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityAudience")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).AuthenticationIdentityAudience = (string) content.GetValueForProperty("AuthenticationIdentityAudience",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).AuthenticationIdentityAudience, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityAadAuthority")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).AuthenticationIdentityAadAuthority = (string) content.GetValueForProperty("AuthenticationIdentityAadAuthority",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).AuthenticationIdentityAadAuthority, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).ResourceAccessIdentityTenantId = (string) content.GetValueForProperty("ResourceAccessIdentityTenantId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).ResourceAccessIdentityTenantId, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityApplicationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).ResourceAccessIdentityApplicationId = (string) content.GetValueForProperty("ResourceAccessIdentityApplicationId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).ResourceAccessIdentityApplicationId, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).ResourceAccessIdentityObjectId = (string) content.GetValueForProperty("ResourceAccessIdentityObjectId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).ResourceAccessIdentityObjectId, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityAudience")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).ResourceAccessIdentityAudience = (string) content.GetValueForProperty("ResourceAccessIdentityAudience",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).ResourceAccessIdentityAudience, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityAadAuthority")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).ResourceAccessIdentityAadAuthority = (string) content.GetValueForProperty("ResourceAccessIdentityAadAuthority",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).ResourceAccessIdentityAadAuthority, global::System.Convert.ToString); + } + if (content.Contains("CustomPropertyInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).CustomPropertyInstanceType = (string) content.GetValueForProperty("CustomPropertyInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).CustomPropertyInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DraModelProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AuthenticationIdentity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).AuthenticationIdentity = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModel) content.GetValueForProperty("AuthenticationIdentity",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).AuthenticationIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IdentityModelTypeConverter.ConvertFrom); + } + if (content.Contains("ResourceAccessIdentity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).ResourceAccessIdentity = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModel) content.GetValueForProperty("ResourceAccessIdentity",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).ResourceAccessIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IdentityModelTypeConverter.ConvertFrom); + } + if (content.Contains("CustomProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).CustomProperty = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCustomProperties) content.GetValueForProperty("CustomProperty",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).CustomProperty, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.DraModelCustomPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("CorrelationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).CorrelationId = (string) content.GetValueForProperty("CorrelationId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).CorrelationId, global::System.Convert.ToString); + } + if (content.Contains("MachineId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).MachineId = (string) content.GetValueForProperty("MachineId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).MachineId, global::System.Convert.ToString); + } + if (content.Contains("MachineName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).MachineName = (string) content.GetValueForProperty("MachineName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).MachineName, global::System.Convert.ToString); + } + if (content.Contains("IsResponsive")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).IsResponsive = (bool?) content.GetValueForProperty("IsResponsive",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).IsResponsive, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LastHeartbeat")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).LastHeartbeat = (global::System.DateTime?) content.GetValueForProperty("LastHeartbeat",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)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("VersionNumber")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).VersionNumber = (string) content.GetValueForProperty("VersionNumber",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).VersionNumber, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState.CreateFrom); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HealthErrorModelTypeConverter.ConvertFrom)); + } + if (content.Contains("AuthenticationIdentityTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).AuthenticationIdentityTenantId = (string) content.GetValueForProperty("AuthenticationIdentityTenantId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).AuthenticationIdentityTenantId, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityApplicationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).AuthenticationIdentityApplicationId = (string) content.GetValueForProperty("AuthenticationIdentityApplicationId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).AuthenticationIdentityApplicationId, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).AuthenticationIdentityObjectId = (string) content.GetValueForProperty("AuthenticationIdentityObjectId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).AuthenticationIdentityObjectId, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityAudience")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).AuthenticationIdentityAudience = (string) content.GetValueForProperty("AuthenticationIdentityAudience",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).AuthenticationIdentityAudience, global::System.Convert.ToString); + } + if (content.Contains("AuthenticationIdentityAadAuthority")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).AuthenticationIdentityAadAuthority = (string) content.GetValueForProperty("AuthenticationIdentityAadAuthority",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).AuthenticationIdentityAadAuthority, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).ResourceAccessIdentityTenantId = (string) content.GetValueForProperty("ResourceAccessIdentityTenantId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).ResourceAccessIdentityTenantId, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityApplicationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).ResourceAccessIdentityApplicationId = (string) content.GetValueForProperty("ResourceAccessIdentityApplicationId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).ResourceAccessIdentityApplicationId, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).ResourceAccessIdentityObjectId = (string) content.GetValueForProperty("ResourceAccessIdentityObjectId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).ResourceAccessIdentityObjectId, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityAudience")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).ResourceAccessIdentityAudience = (string) content.GetValueForProperty("ResourceAccessIdentityAudience",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).ResourceAccessIdentityAudience, global::System.Convert.ToString); + } + if (content.Contains("ResourceAccessIdentityAadAuthority")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).ResourceAccessIdentityAadAuthority = (string) content.GetValueForProperty("ResourceAccessIdentityAadAuthority",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).ResourceAccessIdentityAadAuthority, global::System.Convert.ToString); + } + if (content.Contains("CustomPropertyInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).CustomPropertyInstanceType = (string) content.GetValueForProperty("CustomPropertyInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal)this).CustomPropertyInstanceType, 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.Migrate.Models.Api20210216Preview.IDraModelProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Dra model properties. + [System.ComponentModel.TypeConverter(typeof(DraModelPropertiesTypeConverter))] + public partial interface IDraModelProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelProperties.TypeConverter.cs new file mode 100644 index 000000000000..d7a1cd1efa9b --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DraModelPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DraModelProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DraModelProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DraModelProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelProperties.cs new file mode 100644 index 000000000000..0dfb30a97ed8 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Dra model properties. + public partial class DraModelProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModel _authenticationIdentity; + + /// Identity model. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModel AuthenticationIdentity { get => (this._authenticationIdentity = this._authenticationIdentity ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IdentityModel()); set => this._authenticationIdentity = value; } + + /// Gets or sets the authority of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string AuthenticationIdentityAadAuthority { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)AuthenticationIdentity).AadAuthority; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)AuthenticationIdentity).AadAuthority = value ; } + + /// + /// Gets or sets the client/application Id of the SPN with which Dra communicates to + /// service. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string AuthenticationIdentityApplicationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)AuthenticationIdentity).ApplicationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)AuthenticationIdentity).ApplicationId = value ; } + + /// Gets or sets the audience of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string AuthenticationIdentityAudience { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)AuthenticationIdentity).Audience; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)AuthenticationIdentity).Audience = value ; } + + /// Gets or sets the object Id of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string AuthenticationIdentityObjectId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)AuthenticationIdentity).ObjectId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)AuthenticationIdentity).ObjectId = value ; } + + /// Gets or sets the tenant Id of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string AuthenticationIdentityTenantId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)AuthenticationIdentity).TenantId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)AuthenticationIdentity).TenantId = value ; } + + /// Backing field for property. + private string _correlationId; + + /// Gets or sets the Dra correlation Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string CorrelationId { get => this._correlationId; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCustomProperties _customProperty; + + /// Dra model custom properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCustomProperties CustomProperty { get => (this._customProperty = this._customProperty ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.DraModelCustomProperties()); set => this._customProperty = value; } + + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string CustomPropertyInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCustomPropertiesInternal)CustomProperty).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCustomPropertiesInternal)CustomProperty).InstanceType = value ; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel[] _healthError; + + /// Gets or sets the list of health errors. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel[] HealthError { get => this._healthError; } + + /// Backing field for property. + private bool? _isResponsive; + + /// Gets or sets a value indicating whether Dra is responsive. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public bool? IsResponsive { get => this._isResponsive; } + + /// Backing field for property. + private global::System.DateTime? _lastHeartbeat; + + /// Gets or sets the time when last heartbeat was sent by the Dra. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public global::System.DateTime? LastHeartbeat { get => this._lastHeartbeat; } + + /// Backing field for property. + private string _machineId; + + /// Gets or sets the machine Id where Dra is running. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string MachineId { get => this._machineId; set => this._machineId = value; } + + /// Backing field for property. + private string _machineName; + + /// Gets or sets the machine name where Dra is running. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string MachineName { get => this._machineName; set => this._machineName = value; } + + /// Internal Acessors for AuthenticationIdentity + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModel Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal.AuthenticationIdentity { get => (this._authenticationIdentity = this._authenticationIdentity ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IdentityModel()); set { {_authenticationIdentity = value;} } } + + /// Internal Acessors for CorrelationId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal.CorrelationId { get => this._correlationId; set { {_correlationId = value;} } } + + /// Internal Acessors for CustomProperty + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCustomProperties Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal.CustomProperty { get => (this._customProperty = this._customProperty ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.DraModelCustomProperties()); set { {_customProperty = value;} } } + + /// Internal Acessors for HealthError + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel[] Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal.HealthError { get => this._healthError; set { {_healthError = value;} } } + + /// Internal Acessors for IsResponsive + bool? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal.IsResponsive { get => this._isResponsive; set { {_isResponsive = value;} } } + + /// Internal Acessors for LastHeartbeat + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal.LastHeartbeat { get => this._lastHeartbeat; set { {_lastHeartbeat = value;} } } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal.ProvisioningState { get => this._provisioningState; set { {_provisioningState = value;} } } + + /// Internal Acessors for ResourceAccessIdentity + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModel Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal.ResourceAccessIdentity { get => (this._resourceAccessIdentity = this._resourceAccessIdentity ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IdentityModel()); set { {_resourceAccessIdentity = value;} } } + + /// Internal Acessors for VersionNumber + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelPropertiesInternal.VersionNumber { get => this._versionNumber; set { {_versionNumber = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState? _provisioningState; + + /// Gets or sets the provisioning state of the Dra. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState? ProvisioningState { get => this._provisioningState; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModel _resourceAccessIdentity; + + /// Identity model. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModel ResourceAccessIdentity { get => (this._resourceAccessIdentity = this._resourceAccessIdentity ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IdentityModel()); set => this._resourceAccessIdentity = value; } + + /// Gets or sets the authority of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string ResourceAccessIdentityAadAuthority { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)ResourceAccessIdentity).AadAuthority; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)ResourceAccessIdentity).AadAuthority = value ; } + + /// + /// Gets or sets the client/application Id of the SPN with which Dra communicates to + /// service. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string ResourceAccessIdentityApplicationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)ResourceAccessIdentity).ApplicationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)ResourceAccessIdentity).ApplicationId = value ; } + + /// Gets or sets the audience of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string ResourceAccessIdentityAudience { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)ResourceAccessIdentity).Audience; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)ResourceAccessIdentity).Audience = value ; } + + /// Gets or sets the object Id of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string ResourceAccessIdentityObjectId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)ResourceAccessIdentity).ObjectId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)ResourceAccessIdentity).ObjectId = value ; } + + /// Gets or sets the tenant Id of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string ResourceAccessIdentityTenantId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)ResourceAccessIdentity).TenantId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)ResourceAccessIdentity).TenantId = value ; } + + /// Backing field for property. + private string _versionNumber; + + /// Gets or sets the Dra version. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string VersionNumber { get => this._versionNumber; } + + /// Creates an new instance. + public DraModelProperties() + { + + } + } + /// Dra model properties. + public partial interface IDraModelProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the authority of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the authority of the SPN with which Dra communicates to service.", + SerializedName = @"aadAuthority", + PossibleTypes = new [] { typeof(string) })] + string AuthenticationIdentityAadAuthority { get; set; } + /// + /// Gets or sets the client/application Id of the SPN with which Dra communicates to + /// service. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the client/application Id of the SPN with which Dra communicates to + service.", + SerializedName = @"applicationId", + PossibleTypes = new [] { typeof(string) })] + string AuthenticationIdentityApplicationId { get; set; } + /// Gets or sets the audience of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the audience of the SPN with which Dra communicates to service.", + SerializedName = @"audience", + PossibleTypes = new [] { typeof(string) })] + string AuthenticationIdentityAudience { get; set; } + /// Gets or sets the object Id of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the object Id of the SPN with which Dra communicates to service.", + SerializedName = @"objectId", + PossibleTypes = new [] { typeof(string) })] + string AuthenticationIdentityObjectId { get; set; } + /// Gets or sets the tenant Id of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the tenant Id of the SPN with which Dra communicates to service.", + SerializedName = @"tenantId", + PossibleTypes = new [] { typeof(string) })] + string AuthenticationIdentityTenantId { get; set; } + /// Gets or sets the Dra correlation Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the Dra correlation Id.", + SerializedName = @"correlationId", + PossibleTypes = new [] { typeof(string) })] + string CorrelationId { get; } + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string CustomPropertyInstanceType { get; set; } + /// Gets or sets the list of health errors. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the list of health errors.", + SerializedName = @"healthErrors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel[] HealthError { get; } + /// Gets or sets a value indicating whether Dra is responsive. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets a value indicating whether Dra is responsive.", + SerializedName = @"isResponsive", + PossibleTypes = new [] { typeof(bool) })] + bool? IsResponsive { get; } + /// Gets or sets the time when last heartbeat was sent by the Dra. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the time when last heartbeat was sent by the Dra.", + SerializedName = @"lastHeartbeat", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastHeartbeat { get; } + /// Gets or sets the machine Id where Dra is running. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the machine Id where Dra is running.", + SerializedName = @"machineId", + PossibleTypes = new [] { typeof(string) })] + string MachineId { get; set; } + /// Gets or sets the machine name where Dra is running. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the machine name where Dra is running.", + SerializedName = @"machineName", + PossibleTypes = new [] { typeof(string) })] + string MachineName { get; set; } + /// Gets or sets the provisioning state of the Dra. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the provisioning state of the Dra.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState? ProvisioningState { get; } + /// Gets or sets the authority of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the authority of the SPN with which Dra communicates to service.", + SerializedName = @"aadAuthority", + PossibleTypes = new [] { typeof(string) })] + string ResourceAccessIdentityAadAuthority { get; set; } + /// + /// Gets or sets the client/application Id of the SPN with which Dra communicates to + /// service. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the client/application Id of the SPN with which Dra communicates to + service.", + SerializedName = @"applicationId", + PossibleTypes = new [] { typeof(string) })] + string ResourceAccessIdentityApplicationId { get; set; } + /// Gets or sets the audience of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the audience of the SPN with which Dra communicates to service.", + SerializedName = @"audience", + PossibleTypes = new [] { typeof(string) })] + string ResourceAccessIdentityAudience { get; set; } + /// Gets or sets the object Id of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the object Id of the SPN with which Dra communicates to service.", + SerializedName = @"objectId", + PossibleTypes = new [] { typeof(string) })] + string ResourceAccessIdentityObjectId { get; set; } + /// Gets or sets the tenant Id of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the tenant Id of the SPN with which Dra communicates to service.", + SerializedName = @"tenantId", + PossibleTypes = new [] { typeof(string) })] + string ResourceAccessIdentityTenantId { get; set; } + /// Gets or sets the Dra version. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the Dra version.", + SerializedName = @"versionNumber", + PossibleTypes = new [] { typeof(string) })] + string VersionNumber { get; } + + } + /// Dra model properties. + internal partial interface IDraModelPropertiesInternal + + { + /// Identity model. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModel AuthenticationIdentity { get; set; } + /// Gets or sets the authority of the SPN with which Dra communicates to service. + string AuthenticationIdentityAadAuthority { get; set; } + /// + /// Gets or sets the client/application Id of the SPN with which Dra communicates to + /// service. + /// + string AuthenticationIdentityApplicationId { get; set; } + /// Gets or sets the audience of the SPN with which Dra communicates to service. + string AuthenticationIdentityAudience { get; set; } + /// Gets or sets the object Id of the SPN with which Dra communicates to service. + string AuthenticationIdentityObjectId { get; set; } + /// Gets or sets the tenant Id of the SPN with which Dra communicates to service. + string AuthenticationIdentityTenantId { get; set; } + /// Gets or sets the Dra correlation Id. + string CorrelationId { get; set; } + /// Dra model custom properties. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCustomProperties CustomProperty { get; set; } + /// Gets or sets the instance type. + string CustomPropertyInstanceType { get; set; } + /// Gets or sets the list of health errors. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel[] HealthError { get; set; } + /// Gets or sets a value indicating whether Dra is responsive. + bool? IsResponsive { get; set; } + /// Gets or sets the time when last heartbeat was sent by the Dra. + global::System.DateTime? LastHeartbeat { get; set; } + /// Gets or sets the machine Id where Dra is running. + string MachineId { get; set; } + /// Gets or sets the machine name where Dra is running. + string MachineName { get; set; } + /// Gets or sets the provisioning state of the Dra. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState? ProvisioningState { get; set; } + /// Identity model. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModel ResourceAccessIdentity { get; set; } + /// Gets or sets the authority of the SPN with which Dra communicates to service. + string ResourceAccessIdentityAadAuthority { get; set; } + /// + /// Gets or sets the client/application Id of the SPN with which Dra communicates to + /// service. + /// + string ResourceAccessIdentityApplicationId { get; set; } + /// Gets or sets the audience of the SPN with which Dra communicates to service. + string ResourceAccessIdentityAudience { get; set; } + /// Gets or sets the object Id of the SPN with which Dra communicates to service. + string ResourceAccessIdentityObjectId { get; set; } + /// Gets or sets the tenant Id of the SPN with which Dra communicates to service. + string ResourceAccessIdentityTenantId { get; set; } + /// Gets or sets the Dra version. + string VersionNumber { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelProperties.json.cs new file mode 100644 index 000000000000..38b4ba8065b5 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelProperties.json.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Dra model properties. + public partial class DraModelProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal DraModelProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_authenticationIdentity = If( json?.PropertyT("authenticationIdentity"), out var __jsonAuthenticationIdentity) ? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IdentityModel.FromJson(__jsonAuthenticationIdentity) : AuthenticationIdentity;} + {_resourceAccessIdentity = If( json?.PropertyT("resourceAccessIdentity"), out var __jsonResourceAccessIdentity) ? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IdentityModel.FromJson(__jsonResourceAccessIdentity) : ResourceAccessIdentity;} + {_customProperty = If( json?.PropertyT("customProperties"), out var __jsonCustomProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.DraModelCustomProperties.FromJson(__jsonCustomProperties) : CustomProperty;} + {_correlationId = If( json?.PropertyT("correlationId"), out var __jsonCorrelationId) ? (string)__jsonCorrelationId : (string)CorrelationId;} + {_machineId = If( json?.PropertyT("machineId"), out var __jsonMachineId) ? (string)__jsonMachineId : (string)MachineId;} + {_machineName = If( json?.PropertyT("machineName"), out var __jsonMachineName) ? (string)__jsonMachineName : (string)MachineName;} + {_isResponsive = If( json?.PropertyT("isResponsive"), out var __jsonIsResponsive) ? (bool?)__jsonIsResponsive : IsResponsive;} + {_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;} + {_versionNumber = If( json?.PropertyT("versionNumber"), out var __jsonVersionNumber) ? (string)__jsonVersionNumber : (string)VersionNumber;} + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)ProvisioningState;} + {_healthError = If( json?.PropertyT("healthErrors"), out var __jsonHealthErrors) ? If( __jsonHealthErrors as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api20210216Preview.IHealthErrorModel) (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HealthErrorModel.FromJson(__u) )) ))() : null : HealthError;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new DraModelProperties(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._authenticationIdentity ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._authenticationIdentity.ToJson(null,serializationMode) : null, "authenticationIdentity" ,container.Add ); + AddIf( null != this._resourceAccessIdentity ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._resourceAccessIdentity.ToJson(null,serializationMode) : null, "resourceAccessIdentity" ,container.Add ); + AddIf( null != this._customProperty ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._customProperty.ToJson(null,serializationMode) : null, "customProperties" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._correlationId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._correlationId.ToString()) : null, "correlationId" ,container.Add ); + } + AddIf( null != (((object)this._machineId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._machineId.ToString()) : null, "machineId" ,container.Add ); + AddIf( null != (((object)this._machineName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._machineName.ToString()) : null, "machineName" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._isResponsive ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonBoolean((bool)this._isResponsive) : null, "isResponsive" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._lastHeartbeat ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._lastHeartbeat?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastHeartbeat" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._versionNumber)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._versionNumber.ToString()) : null, "versionNumber" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._healthError) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelSystemData.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelSystemData.PowerShell.cs new file mode 100644 index 000000000000..c631c4270662 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelSystemData.PowerShell.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(DraModelSystemDataTypeConverter))] + public partial class DraModelSystemData + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelSystemData DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DraModelSystemData(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelSystemData DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DraModelSystemData(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DraModelSystemData(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy, global::System.Convert.ToString); + } + if (content.Contains("CreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType = (string) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType, global::System.Convert.ToString); + } + if (content.Contains("CreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType = (string) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt, (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 DraModelSystemData(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy, global::System.Convert.ToString); + } + if (content.Contains("CreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType = (string) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType, global::System.Convert.ToString); + } + if (content.Contains("CreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType = (string) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt, (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.Migrate.Models.Api20210216Preview.IDraModelSystemData FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + [System.ComponentModel.TypeConverter(typeof(DraModelSystemDataTypeConverter))] + public partial interface IDraModelSystemData + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelSystemData.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelSystemData.TypeConverter.cs new file mode 100644 index 000000000000..106935b26e70 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelSystemData.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DraModelSystemDataTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelSystemData ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelSystemData).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DraModelSystemData.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DraModelSystemData.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DraModelSystemData.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelSystemData.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelSystemData.cs new file mode 100644 index 000000000000..5ba97a9ae876 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelSystemData.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + public partial class DraModelSystemData : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelSystemData, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelSystemDataInternal, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel __systemDataModel = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel(); + + /// Gets or sets the timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public global::System.DateTime? CreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string CreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string CreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedByType = value ?? null; } + + /// Gets or sets the timestamp of resource last modification (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public global::System.DateTime? LastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets the identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string LastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string LastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedByType = value ?? null; } + + /// Creates an new instance. + public DraModelSystemData() + { + + } + + /// 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.Migrate.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__systemDataModel), __systemDataModel); + await eventListener.AssertObjectIsValid(nameof(__systemDataModel), __systemDataModel); + } + } + public partial interface IDraModelSystemData : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel + { + + } + internal partial interface IDraModelSystemDataInternal : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelSystemData.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelSystemData.json.cs new file mode 100644 index 000000000000..fd2e9d58834c --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/DraModelSystemData.json.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + public partial class DraModelSystemData + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal DraModelSystemData(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __systemDataModel = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel(json); + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelSystemData. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelSystemData. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelSystemData FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new DraModelSystemData(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __systemDataModel?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModel.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModel.PowerShell.cs new file mode 100644 index 000000000000..29b4ac9e6b41 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModel.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Email configuration model. + [System.ComponentModel.TypeConverter(typeof(EmailConfigurationModelTypeConverter))] + public partial class EmailConfigurationModel + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModel DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new EmailConfigurationModel(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModel DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new EmailConfigurationModel(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal EmailConfigurationModel(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.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EmailConfigurationModelPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModelTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("SendToOwner")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).SendToOwner = (bool) content.GetValueForProperty("SendToOwner",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).SendToOwner, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("CustomEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).CustomEmailAddress = (string[]) content.GetValueForProperty("CustomEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).CustomEmailAddress, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("Locale")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).Locale = (string) content.GetValueForProperty("Locale",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).Locale, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).SystemDataLastModifiedAt, (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 EmailConfigurationModel(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.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EmailConfigurationModelPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModelTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("SendToOwner")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).SendToOwner = (bool) content.GetValueForProperty("SendToOwner",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).SendToOwner, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("CustomEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).CustomEmailAddress = (string[]) content.GetValueForProperty("CustomEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).CustomEmailAddress, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("Locale")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).Locale = (string) content.GetValueForProperty("Locale",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).Locale, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal)this).SystemDataLastModifiedAt, (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.Migrate.Models.Api20210216Preview.IEmailConfigurationModel FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Email configuration model. + [System.ComponentModel.TypeConverter(typeof(EmailConfigurationModelTypeConverter))] + public partial interface IEmailConfigurationModel + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModel.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModel.TypeConverter.cs new file mode 100644 index 000000000000..c793bb481545 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModel.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class EmailConfigurationModelTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModel ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModel).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return EmailConfigurationModel.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return EmailConfigurationModel.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return EmailConfigurationModel.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModel.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModel.cs new file mode 100644 index 000000000000..8cc58900e411 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModel.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Email configuration model. + public partial class EmailConfigurationModel : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModel, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal + { + + /// Gets or sets the custom email address for sending emails. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string[] CustomEmailAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelPropertiesInternal)Property).CustomEmailAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelPropertiesInternal)Property).CustomEmailAddress = value ?? null /* arrayOf */; } + + /// Backing field for property. + private string _id; + + /// Gets or sets the Id of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Id { get => this._id; } + + /// Gets or sets the locale for the email notification. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string Locale { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelPropertiesInternal)Property).Locale; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelPropertiesInternal)Property).Locale = value ?? null; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal.Id { get => this._id; set { {_id = value;} } } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal.Name { get => this._name; set { {_name = value;} } } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelProperties Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EmailConfigurationModelProperties()); set { {_property = value;} } } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal.SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel()); set { {_systemData = value;} } } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelInternal.Type { get => this._type; set { {_type = value;} } } + + /// Backing field for property. + private string _name; + + /// Gets or sets the name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Name { get => this._name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelProperties _property; + + /// Email configuration model properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EmailConfigurationModelProperties()); set => this._property = value; } + + /// + /// Gets or sets a value indicating whether to send email to subscription administrator. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public bool SendToOwner { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelPropertiesInternal)Property).SendToOwner; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelPropertiesInternal)Property).SendToOwner = value ; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel _systemData; + + /// System data required to be defined for Azure resources. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel()); } + + /// Gets or sets the timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedByType = value ?? null; } + + /// Gets or sets the timestamp of resource last modification (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets the identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedByType = value ?? null; } + + /// Backing field for property. + private string _type; + + /// Gets or sets the type of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Type { get => this._type; } + + /// Creates an new instance. + public EmailConfigurationModel() + { + + } + } + /// Email configuration model. + public partial interface IEmailConfigurationModel : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the custom email address for sending emails. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the custom email address for sending emails.", + SerializedName = @"customEmailAddresses", + PossibleTypes = new [] { typeof(string) })] + string[] CustomEmailAddress { get; set; } + /// Gets or sets the Id of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the Id of the resource.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; } + /// Gets or sets the locale for the email notification. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the locale for the email notification.", + SerializedName = @"locale", + PossibleTypes = new [] { typeof(string) })] + string Locale { get; set; } + /// Gets or sets the name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the name of the resource.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; } + /// + /// Gets or sets a value indicating whether to send email to subscription administrator. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets a value indicating whether to send email to subscription administrator.", + SerializedName = @"sendToOwners", + PossibleTypes = new [] { typeof(bool) })] + bool SendToOwner { get; set; } + /// Gets or sets the timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the timestamp of resource creation (UTC).", + SerializedName = @"createdAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataCreatedAt { get; set; } + /// Gets or sets identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets identity that created the resource.", + SerializedName = @"createdBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataCreatedBy { get; set; } + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the type of identity that created the resource: user, application, + managedIdentity.", + SerializedName = @"createdByType", + PossibleTypes = new [] { typeof(string) })] + string SystemDataCreatedByType { get; set; } + /// Gets or sets the timestamp of resource last modification (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the timestamp of resource last modification (UTC).", + SerializedName = @"lastModifiedAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataLastModifiedAt { get; set; } + /// Gets or sets the identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the identity that last modified the resource.", + SerializedName = @"lastModifiedBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataLastModifiedBy { get; set; } + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the type of identity that last modified the resource: user, application, + managedIdentity.", + SerializedName = @"lastModifiedByType", + PossibleTypes = new [] { typeof(string) })] + string SystemDataLastModifiedByType { get; set; } + /// Gets or sets the type of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the type of the resource.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; } + + } + /// Email configuration model. + internal partial interface IEmailConfigurationModelInternal + + { + /// Gets or sets the custom email address for sending emails. + string[] CustomEmailAddress { get; set; } + /// Gets or sets the Id of the resource. + string Id { get; set; } + /// Gets or sets the locale for the email notification. + string Locale { get; set; } + /// Gets or sets the name of the resource. + string Name { get; set; } + /// Email configuration model properties. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelProperties Property { get; set; } + /// + /// Gets or sets a value indicating whether to send email to subscription administrator. + /// + bool SendToOwner { get; set; } + /// System data required to be defined for Azure resources. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel SystemData { get; set; } + /// Gets or sets the timestamp of resource creation (UTC). + global::System.DateTime? SystemDataCreatedAt { get; set; } + /// Gets or sets identity that created the resource. + string SystemDataCreatedBy { get; set; } + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + string SystemDataCreatedByType { get; set; } + /// Gets or sets the timestamp of resource last modification (UTC). + global::System.DateTime? SystemDataLastModifiedAt { get; set; } + /// Gets or sets the identity that last modified the resource. + string SystemDataLastModifiedBy { get; set; } + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + string SystemDataLastModifiedByType { get; set; } + /// Gets or sets the type of the resource. + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModel.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModel.json.cs new file mode 100644 index 000000000000..a5457b2d747b --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModel.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Email configuration model. + public partial class EmailConfigurationModel + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal EmailConfigurationModel(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api20210216Preview.EmailConfigurationModelProperties.FromJson(__jsonProperties) : Property;} + {_systemData = If( json?.PropertyT("systemData"), out var __jsonSystemData) ? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel.FromJson(__jsonSystemData) : SystemData;} + {_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); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModel. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModel. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModel FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new EmailConfigurationModel(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._systemData ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._systemData.ToJson(null,serializationMode) : null, "systemData" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModelCollection.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModelCollection.PowerShell.cs new file mode 100644 index 000000000000..5a0c2c1fcfe6 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModelCollection.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Email configuration model collection. + [System.ComponentModel.TypeConverter(typeof(EmailConfigurationModelCollectionTypeConverter))] + public partial class EmailConfigurationModelCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new EmailConfigurationModelCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new EmailConfigurationModelCollection(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal EmailConfigurationModelCollection(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.Migrate.Models.Api20210216Preview.IEmailConfigurationModelCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModel[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EmailConfigurationModelTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelCollectionInternal)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 EmailConfigurationModelCollection(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.Migrate.Models.Api20210216Preview.IEmailConfigurationModelCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModel[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EmailConfigurationModelTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelCollectionInternal)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.Migrate.Models.Api20210216Preview.IEmailConfigurationModelCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Email configuration model collection. + [System.ComponentModel.TypeConverter(typeof(EmailConfigurationModelCollectionTypeConverter))] + public partial interface IEmailConfigurationModelCollection + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModelCollection.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModelCollection.TypeConverter.cs new file mode 100644 index 000000000000..cc2bf738c15d --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModelCollection.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class EmailConfigurationModelCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return EmailConfigurationModelCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return EmailConfigurationModelCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return EmailConfigurationModelCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModelCollection.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModelCollection.cs new file mode 100644 index 000000000000..8700f6297126 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModelCollection.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Email configuration model collection. + public partial class EmailConfigurationModelCollection : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelCollection, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// Gets or sets the value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModel[] _value; + + /// Gets or sets the list of email configurations. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModel[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public EmailConfigurationModelCollection() + { + + } + } + /// Email configuration model collection. + public partial interface IEmailConfigurationModelCollection : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the value of next link.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// Gets or sets the list of email configurations. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the list of email configurations.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModel) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModel[] Value { get; set; } + + } + /// Email configuration model collection. + internal partial interface IEmailConfigurationModelCollectionInternal + + { + /// Gets or sets the value of next link. + string NextLink { get; set; } + /// Gets or sets the list of email configurations. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModel[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModelCollection.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModelCollection.json.cs new file mode 100644 index 000000000000..e4922767875b --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModelCollection.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Email configuration model collection. + public partial class EmailConfigurationModelCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal EmailConfigurationModelCollection(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Models.Api20210216Preview.IEmailConfigurationModel) (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EmailConfigurationModel.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.Migrate.Models.Api20210216Preview.IEmailConfigurationModelCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new EmailConfigurationModelCollection(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModelProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModelProperties.PowerShell.cs new file mode 100644 index 000000000000..aa137a5110d1 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModelProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Email configuration model properties. + [System.ComponentModel.TypeConverter(typeof(EmailConfigurationModelPropertiesTypeConverter))] + public partial class EmailConfigurationModelProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new EmailConfigurationModelProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new EmailConfigurationModelProperties(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal EmailConfigurationModelProperties(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.Migrate.Models.Api20210216Preview.IEmailConfigurationModelPropertiesInternal)this).SendToOwner = (bool) content.GetValueForProperty("SendToOwner",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelPropertiesInternal)this).SendToOwner, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("CustomEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelPropertiesInternal)this).CustomEmailAddress = (string[]) content.GetValueForProperty("CustomEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelPropertiesInternal)this).CustomEmailAddress, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("Locale")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelPropertiesInternal)this).Locale = (string) content.GetValueForProperty("Locale",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelPropertiesInternal)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 EmailConfigurationModelProperties(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.Migrate.Models.Api20210216Preview.IEmailConfigurationModelPropertiesInternal)this).SendToOwner = (bool) content.GetValueForProperty("SendToOwner",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelPropertiesInternal)this).SendToOwner, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("CustomEmailAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelPropertiesInternal)this).CustomEmailAddress = (string[]) content.GetValueForProperty("CustomEmailAddress",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelPropertiesInternal)this).CustomEmailAddress, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("Locale")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelPropertiesInternal)this).Locale = (string) content.GetValueForProperty("Locale",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelPropertiesInternal)this).Locale, 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.Migrate.Models.Api20210216Preview.IEmailConfigurationModelProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Email configuration model properties. + [System.ComponentModel.TypeConverter(typeof(EmailConfigurationModelPropertiesTypeConverter))] + public partial interface IEmailConfigurationModelProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModelProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModelProperties.TypeConverter.cs new file mode 100644 index 000000000000..77cafacb0d53 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModelProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class EmailConfigurationModelPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return EmailConfigurationModelProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return EmailConfigurationModelProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return EmailConfigurationModelProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModelProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModelProperties.cs new file mode 100644 index 000000000000..ead6897e54c4 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModelProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Email configuration model properties. + public partial class EmailConfigurationModelProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelPropertiesInternal + { + + /// Backing field for property. + private string[] _customEmailAddress; + + /// Gets or sets the custom email address for sending emails. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string[] CustomEmailAddress { get => this._customEmailAddress; set => this._customEmailAddress = value; } + + /// Backing field for property. + private string _locale; + + /// Gets or sets the locale for the email notification. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Locale { get => this._locale; set => this._locale = value; } + + /// Backing field for property. + private bool _sendToOwner; + + /// + /// Gets or sets a value indicating whether to send email to subscription administrator. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public bool SendToOwner { get => this._sendToOwner; set => this._sendToOwner = value; } + + /// Creates an new instance. + public EmailConfigurationModelProperties() + { + + } + } + /// Email configuration model properties. + public partial interface IEmailConfigurationModelProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the custom email address for sending emails. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the custom email address for sending emails.", + SerializedName = @"customEmailAddresses", + PossibleTypes = new [] { typeof(string) })] + string[] CustomEmailAddress { get; set; } + /// Gets or sets the locale for the email notification. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the locale for the email notification.", + SerializedName = @"locale", + PossibleTypes = new [] { typeof(string) })] + string Locale { get; set; } + /// + /// Gets or sets a value indicating whether to send email to subscription administrator. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets a value indicating whether to send email to subscription administrator.", + SerializedName = @"sendToOwners", + PossibleTypes = new [] { typeof(bool) })] + bool SendToOwner { get; set; } + + } + /// Email configuration model properties. + internal partial interface IEmailConfigurationModelPropertiesInternal + + { + /// Gets or sets the custom email address for sending emails. + string[] CustomEmailAddress { get; set; } + /// Gets or sets the locale for the email notification. + string Locale { get; set; } + /// + /// Gets or sets a value indicating whether to send email to subscription administrator. + /// + bool SendToOwner { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModelProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModelProperties.json.cs new file mode 100644 index 000000000000..0526bd3bc061 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModelProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Email configuration model properties. + public partial class EmailConfigurationModelProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal EmailConfigurationModelProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_sendToOwner = If( json?.PropertyT("sendToOwners"), out var __jsonSendToOwners) ? (bool)__jsonSendToOwners : SendToOwner;} + {_customEmailAddress = If( json?.PropertyT("customEmailAddresses"), out var __jsonCustomEmailAddresses) ? If( __jsonCustomEmailAddresses as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Models.Api20210216Preview.IEmailConfigurationModelProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new EmailConfigurationModelProperties(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonBoolean(this._sendToOwner), "sendToOwners" ,container.Add ); + if (null != this._customEmailAddress) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.XNodeArray(); + foreach( var __x in this._customEmailAddress ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("customEmailAddresses",__w); + } + AddIf( null != (((object)this._locale)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._locale.ToString()) : null, "locale" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModelSystemData.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModelSystemData.PowerShell.cs new file mode 100644 index 000000000000..dc5f287487ca --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModelSystemData.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(EmailConfigurationModelSystemDataTypeConverter))] + public partial class EmailConfigurationModelSystemData + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelSystemData DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new EmailConfigurationModelSystemData(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelSystemData DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new EmailConfigurationModelSystemData(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal EmailConfigurationModelSystemData(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy, global::System.Convert.ToString); + } + if (content.Contains("CreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType = (string) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType, global::System.Convert.ToString); + } + if (content.Contains("CreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType = (string) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt, (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 EmailConfigurationModelSystemData(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy, global::System.Convert.ToString); + } + if (content.Contains("CreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType = (string) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType, global::System.Convert.ToString); + } + if (content.Contains("CreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType = (string) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt, (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.Migrate.Models.Api20210216Preview.IEmailConfigurationModelSystemData FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + [System.ComponentModel.TypeConverter(typeof(EmailConfigurationModelSystemDataTypeConverter))] + public partial interface IEmailConfigurationModelSystemData + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModelSystemData.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModelSystemData.TypeConverter.cs new file mode 100644 index 000000000000..500056233b18 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModelSystemData.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class EmailConfigurationModelSystemDataTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelSystemData ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelSystemData).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return EmailConfigurationModelSystemData.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return EmailConfigurationModelSystemData.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return EmailConfigurationModelSystemData.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModelSystemData.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModelSystemData.cs new file mode 100644 index 000000000000..089e9925d179 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModelSystemData.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + public partial class EmailConfigurationModelSystemData : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelSystemData, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelSystemDataInternal, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel __systemDataModel = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel(); + + /// Gets or sets the timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public global::System.DateTime? CreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string CreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string CreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedByType = value ?? null; } + + /// Gets or sets the timestamp of resource last modification (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public global::System.DateTime? LastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets the identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string LastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string LastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedByType = value ?? null; } + + /// Creates an new instance. + public EmailConfigurationModelSystemData() + { + + } + + /// 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.Migrate.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__systemDataModel), __systemDataModel); + await eventListener.AssertObjectIsValid(nameof(__systemDataModel), __systemDataModel); + } + } + public partial interface IEmailConfigurationModelSystemData : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel + { + + } + internal partial interface IEmailConfigurationModelSystemDataInternal : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModelSystemData.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModelSystemData.json.cs new file mode 100644 index 000000000000..21500038b726 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EmailConfigurationModelSystemData.json.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + public partial class EmailConfigurationModelSystemData + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal EmailConfigurationModelSystemData(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __systemDataModel = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel(json); + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelSystemData. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelSystemData. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEmailConfigurationModelSystemData FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new EmailConfigurationModelSystemData(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __systemDataModel?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ErrorModel.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ErrorModel.PowerShell.cs new file mode 100644 index 000000000000..2ef3cecc70c6 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ErrorModel.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Error model. + [System.ComponentModel.TypeConverter(typeof(ErrorModelTypeConverter))] + public partial class ErrorModel + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModel DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ErrorModel(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModel DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ErrorModel(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ErrorModel(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.Migrate.Models.Api20210216Preview.IErrorModelInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModelInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModelInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModelInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Severity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModelInternal)this).Severity = (string) content.GetValueForProperty("Severity",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModelInternal)this).Severity, global::System.Convert.ToString); + } + if (content.Contains("CreationTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModelInternal)this).CreationTime = (global::System.DateTime?) content.GetValueForProperty("CreationTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModelInternal)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("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModelInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModelInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Caus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModelInternal)this).Caus = (string) content.GetValueForProperty("Caus",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModelInternal)this).Caus, global::System.Convert.ToString); + } + if (content.Contains("Recommendation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModelInternal)this).Recommendation = (string) content.GetValueForProperty("Recommendation",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModelInternal)this).Recommendation, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ErrorModel(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.Migrate.Models.Api20210216Preview.IErrorModelInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModelInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModelInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModelInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Severity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModelInternal)this).Severity = (string) content.GetValueForProperty("Severity",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModelInternal)this).Severity, global::System.Convert.ToString); + } + if (content.Contains("CreationTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModelInternal)this).CreationTime = (global::System.DateTime?) content.GetValueForProperty("CreationTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModelInternal)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("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModelInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModelInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Caus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModelInternal)this).Caus = (string) content.GetValueForProperty("Caus",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModelInternal)this).Caus, global::System.Convert.ToString); + } + if (content.Contains("Recommendation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModelInternal)this).Recommendation = (string) content.GetValueForProperty("Recommendation",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModelInternal)this).Recommendation, 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.Migrate.Models.Api20210216Preview.IErrorModel FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Error model. + [System.ComponentModel.TypeConverter(typeof(ErrorModelTypeConverter))] + public partial interface IErrorModel + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ErrorModel.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ErrorModel.TypeConverter.cs new file mode 100644 index 000000000000..d5981ddafbde --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ErrorModel.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ErrorModelTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModel ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModel).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ErrorModel.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ErrorModel.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ErrorModel.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ErrorModel.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ErrorModel.cs new file mode 100644 index 000000000000..bbd695a6b8e7 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ErrorModel.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Error model. + public partial class ErrorModel : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModel, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModelInternal + { + + /// Backing field for property. + private string _caus; + + /// Gets or sets the possible causes of error. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Caus { get => this._caus; } + + /// Backing field for property. + private string _code; + + /// Gets or sets the error code. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Code { get => this._code; } + + /// Backing field for property. + private global::System.DateTime? _creationTime; + + /// Gets or sets the creation time of error. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public global::System.DateTime? CreationTime { get => this._creationTime; } + + /// Backing field for property. + private string _message; + + /// Gets or sets the error message. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Message { get => this._message; } + + /// Internal Acessors for Caus + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModelInternal.Caus { get => this._caus; set { {_caus = value;} } } + + /// Internal Acessors for Code + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModelInternal.Code { get => this._code; set { {_code = value;} } } + + /// Internal Acessors for CreationTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModelInternal.CreationTime { get => this._creationTime; set { {_creationTime = value;} } } + + /// Internal Acessors for Message + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModelInternal.Message { get => this._message; set { {_message = value;} } } + + /// Internal Acessors for Recommendation + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModelInternal.Recommendation { get => this._recommendation; set { {_recommendation = value;} } } + + /// Internal Acessors for Severity + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModelInternal.Severity { get => this._severity; set { {_severity = value;} } } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModelInternal.Type { get => this._type; set { {_type = value;} } } + + /// Backing field for property. + private string _recommendation; + + /// Gets or sets the recommended action to resolve error. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Recommendation { get => this._recommendation; } + + /// Backing field for property. + private string _severity; + + /// Gets or sets the error severity. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Severity { get => this._severity; } + + /// Backing field for property. + private string _type; + + /// Gets or sets the error type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Type { get => this._type; } + + /// Creates an new instance. + public ErrorModel() + { + + } + } + /// Error model. + public partial interface IErrorModel : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the possible causes of error. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the possible causes of error.", + SerializedName = @"causes", + PossibleTypes = new [] { typeof(string) })] + string Caus { get; } + /// Gets or sets the error code. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the error code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string Code { get; } + /// Gets or sets the creation time of error. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the creation time of error.", + SerializedName = @"creationTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? CreationTime { get; } + /// Gets or sets the error message. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the error message.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; } + /// Gets or sets the recommended action to resolve error. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the recommended action to resolve error.", + SerializedName = @"recommendation", + PossibleTypes = new [] { typeof(string) })] + string Recommendation { get; } + /// Gets or sets the error severity. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the error severity.", + SerializedName = @"severity", + PossibleTypes = new [] { typeof(string) })] + string Severity { get; } + /// Gets or sets the error type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the error type.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; } + + } + /// Error model. + internal partial interface IErrorModelInternal + + { + /// Gets or sets the possible causes of error. + string Caus { get; set; } + /// Gets or sets the error code. + string Code { get; set; } + /// Gets or sets the creation time of error. + global::System.DateTime? CreationTime { get; set; } + /// Gets or sets the error message. + string Message { get; set; } + /// Gets or sets the recommended action to resolve error. + string Recommendation { get; set; } + /// Gets or sets the error severity. + string Severity { get; set; } + /// Gets or sets the error type. + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ErrorModel.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ErrorModel.json.cs new file mode 100644 index 000000000000..046ff79037cb --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ErrorModel.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Error model. + public partial class ErrorModel + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal ErrorModel(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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;} + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)Type;} + {_severity = If( json?.PropertyT("severity"), out var __jsonSeverity) ? (string)__jsonSeverity : (string)Severity;} + {_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;} + {_message = If( json?.PropertyT("message"), out var __jsonMessage) ? (string)__jsonMessage : (string)Message;} + {_caus = If( json?.PropertyT("causes"), out var __jsonCauses) ? (string)__jsonCauses : (string)Caus;} + {_recommendation = If( json?.PropertyT("recommendation"), out var __jsonRecommendation) ? (string)__jsonRecommendation : (string)Recommendation;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModel. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModel. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModel FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new ErrorModel(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._code)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._code.ToString()) : null, "code" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._severity)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._severity.ToString()) : null, "severity" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._creationTime ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._creationTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "creationTime" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._message)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._message.ToString()) : null, "message" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._caus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._caus.ToString()) : null, "causes" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._recommendation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._recommendation.ToString()) : null, "recommendation" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModel.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModel.PowerShell.cs new file mode 100644 index 000000000000..6667abf53dba --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModel.PowerShell.cs @@ -0,0 +1,312 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Event model. + [System.ComponentModel.TypeConverter(typeof(EventModelTypeConverter))] + public partial class EventModel + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModel DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new EventModel(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModel DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new EventModel(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal EventModel(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.Migrate.Models.Api20210216Preview.IEventModelInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EventModelPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModelTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("CustomProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).CustomProperty = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCustomProperties) content.GetValueForProperty("CustomProperty",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).CustomProperty, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EventModelCustomPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).ResourceType = (string) content.GetValueForProperty("ResourceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).ResourceType, global::System.Convert.ToString); + } + if (content.Contains("ResourceName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).ResourceName = (string) content.GetValueForProperty("ResourceName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).ResourceName, global::System.Convert.ToString); + } + if (content.Contains("EventType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).EventType = (string) content.GetValueForProperty("EventType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).EventType, global::System.Convert.ToString); + } + if (content.Contains("EventName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).EventName = (string) content.GetValueForProperty("EventName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).EventName, global::System.Convert.ToString); + } + if (content.Contains("TimeOfOccurrence")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).TimeOfOccurrence = (global::System.DateTime?) content.GetValueForProperty("TimeOfOccurrence",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)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("Severity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).Severity = (string) content.GetValueForProperty("Severity",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).Severity, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).Description, global::System.Convert.ToString); + } + if (content.Contains("CorrelationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).CorrelationId = (string) content.GetValueForProperty("CorrelationId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).CorrelationId, global::System.Convert.ToString); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HealthErrorModelTypeConverter.ConvertFrom)); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("CustomPropertyInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).CustomPropertyInstanceType = (string) content.GetValueForProperty("CustomPropertyInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).CustomPropertyInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal EventModel(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.Migrate.Models.Api20210216Preview.IEventModelInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EventModelPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModelTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("CustomProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).CustomProperty = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCustomProperties) content.GetValueForProperty("CustomProperty",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).CustomProperty, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EventModelCustomPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).ResourceType = (string) content.GetValueForProperty("ResourceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).ResourceType, global::System.Convert.ToString); + } + if (content.Contains("ResourceName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).ResourceName = (string) content.GetValueForProperty("ResourceName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).ResourceName, global::System.Convert.ToString); + } + if (content.Contains("EventType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).EventType = (string) content.GetValueForProperty("EventType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).EventType, global::System.Convert.ToString); + } + if (content.Contains("EventName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).EventName = (string) content.GetValueForProperty("EventName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).EventName, global::System.Convert.ToString); + } + if (content.Contains("TimeOfOccurrence")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).TimeOfOccurrence = (global::System.DateTime?) content.GetValueForProperty("TimeOfOccurrence",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)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("Severity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).Severity = (string) content.GetValueForProperty("Severity",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).Severity, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).Description, global::System.Convert.ToString); + } + if (content.Contains("CorrelationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).CorrelationId = (string) content.GetValueForProperty("CorrelationId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).CorrelationId, global::System.Convert.ToString); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HealthErrorModelTypeConverter.ConvertFrom)); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("CustomPropertyInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).CustomPropertyInstanceType = (string) content.GetValueForProperty("CustomPropertyInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal)this).CustomPropertyInstanceType, 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.Migrate.Models.Api20210216Preview.IEventModel FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Event model. + [System.ComponentModel.TypeConverter(typeof(EventModelTypeConverter))] + public partial interface IEventModel + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModel.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModel.TypeConverter.cs new file mode 100644 index 000000000000..78896f7d0003 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModel.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class EventModelTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModel ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModel).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return EventModel.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return EventModel.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return EventModel.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModel.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModel.cs new file mode 100644 index 000000000000..97b4901248f6 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModel.cs @@ -0,0 +1,394 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Event model. + public partial class EventModel : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModel, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal + { + + /// Gets or sets the event correlation Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string CorrelationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)Property).CorrelationId; } + + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string CustomPropertyInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)Property).CustomPropertyInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)Property).CustomPropertyInstanceType = value ; } + + /// Gets or sets the event description. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string Description { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)Property).Description; } + + /// Gets or sets the event name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string EventName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)Property).EventName; } + + /// Gets or sets the event type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string EventType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)Property).EventType; } + + /// Gets or sets the errors associated with this event. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel[] HealthError { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)Property).HealthError; } + + /// Backing field for property. + private string _id; + + /// Gets or sets the Id of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Id { get => this._id; } + + /// Internal Acessors for CorrelationId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal.CorrelationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)Property).CorrelationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)Property).CorrelationId = value; } + + /// Internal Acessors for CustomProperty + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCustomProperties Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal.CustomProperty { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)Property).CustomProperty; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)Property).CustomProperty = value; } + + /// Internal Acessors for Description + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal.Description { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)Property).Description; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)Property).Description = value; } + + /// Internal Acessors for EventName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal.EventName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)Property).EventName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)Property).EventName = value; } + + /// Internal Acessors for EventType + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal.EventType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)Property).EventType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)Property).EventType = value; } + + /// Internal Acessors for HealthError + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel[] Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal.HealthError { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)Property).HealthError; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)Property).HealthError = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal.Id { get => this._id; set { {_id = value;} } } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal.Name { get => this._name; set { {_name = value;} } } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelProperties Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EventModelProperties()); set { {_property = value;} } } + + /// Internal Acessors for ResourceName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal.ResourceName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)Property).ResourceName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)Property).ResourceName = value; } + + /// Internal Acessors for ResourceType + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal.ResourceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)Property).ResourceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)Property).ResourceType = value; } + + /// Internal Acessors for Severity + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal.Severity { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)Property).Severity; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)Property).Severity = value; } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal.SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel()); set { {_systemData = value;} } } + + /// Internal Acessors for TimeOfOccurrence + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal.TimeOfOccurrence { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)Property).TimeOfOccurrence; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)Property).TimeOfOccurrence = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelInternal.Type { get => this._type; set { {_type = value;} } } + + /// Backing field for property. + private string _name; + + /// Gets or sets the name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Name { get => this._name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelProperties _property; + + /// Event model properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EventModelProperties()); set => this._property = value; } + + /// Gets or sets the resource name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string ResourceName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)Property).ResourceName; } + + /// Gets or sets the resource type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string ResourceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)Property).ResourceType; } + + /// Gets or sets the event severity. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string Severity { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)Property).Severity; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel _systemData; + + /// System data required to be defined for Azure resources. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel()); } + + /// Gets or sets the timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedByType = value ?? null; } + + /// Gets or sets the timestamp of resource last modification (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets the identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedByType = value ?? null; } + + /// Gets or sets the time at which the event occurred at source. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public global::System.DateTime? TimeOfOccurrence { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)Property).TimeOfOccurrence; } + + /// Backing field for property. + private string _type; + + /// Gets or sets the type of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Type { get => this._type; } + + /// Creates an new instance. + public EventModel() + { + + } + } + /// Event model. + public partial interface IEventModel : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the event correlation Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the event correlation Id.", + SerializedName = @"correlationId", + PossibleTypes = new [] { typeof(string) })] + string CorrelationId { get; } + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string CustomPropertyInstanceType { get; set; } + /// Gets or sets the event description. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the event description.", + SerializedName = @"description", + PossibleTypes = new [] { typeof(string) })] + string Description { get; } + /// Gets or sets the event name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the event name.", + SerializedName = @"eventName", + PossibleTypes = new [] { typeof(string) })] + string EventName { get; } + /// Gets or sets the event type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the event type.", + SerializedName = @"eventType", + PossibleTypes = new [] { typeof(string) })] + string EventType { get; } + /// Gets or sets the errors associated with this event. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the errors associated with this event.", + SerializedName = @"healthErrors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel[] HealthError { get; } + /// Gets or sets the Id of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the Id of the resource.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; } + /// Gets or sets the name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the name of the resource.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; } + /// Gets or sets the resource name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the resource name.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + string ResourceName { get; } + /// Gets or sets the resource type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the resource type.", + SerializedName = @"resourceType", + PossibleTypes = new [] { typeof(string) })] + string ResourceType { get; } + /// Gets or sets the event severity. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the event severity.", + SerializedName = @"severity", + PossibleTypes = new [] { typeof(string) })] + string Severity { get; } + /// Gets or sets the timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the timestamp of resource creation (UTC).", + SerializedName = @"createdAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataCreatedAt { get; set; } + /// Gets or sets identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets identity that created the resource.", + SerializedName = @"createdBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataCreatedBy { get; set; } + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the type of identity that created the resource: user, application, + managedIdentity.", + SerializedName = @"createdByType", + PossibleTypes = new [] { typeof(string) })] + string SystemDataCreatedByType { get; set; } + /// Gets or sets the timestamp of resource last modification (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the timestamp of resource last modification (UTC).", + SerializedName = @"lastModifiedAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataLastModifiedAt { get; set; } + /// Gets or sets the identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the identity that last modified the resource.", + SerializedName = @"lastModifiedBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataLastModifiedBy { get; set; } + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the type of identity that last modified the resource: user, application, + managedIdentity.", + SerializedName = @"lastModifiedByType", + PossibleTypes = new [] { typeof(string) })] + string SystemDataLastModifiedByType { get; set; } + /// Gets or sets the time at which the event occurred at source. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the time at which the event occurred at source.", + SerializedName = @"timeOfOccurrence", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? TimeOfOccurrence { get; } + /// Gets or sets the type of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the type of the resource.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; } + + } + /// Event model. + internal partial interface IEventModelInternal + + { + /// Gets or sets the event correlation Id. + string CorrelationId { get; set; } + /// Event model custom properties. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCustomProperties CustomProperty { get; set; } + /// Gets or sets the instance type. + string CustomPropertyInstanceType { get; set; } + /// Gets or sets the event description. + string Description { get; set; } + /// Gets or sets the event name. + string EventName { get; set; } + /// Gets or sets the event type. + string EventType { get; set; } + /// Gets or sets the errors associated with this event. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel[] HealthError { get; set; } + /// Gets or sets the Id of the resource. + string Id { get; set; } + /// Gets or sets the name of the resource. + string Name { get; set; } + /// Event model properties. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelProperties Property { get; set; } + /// Gets or sets the resource name. + string ResourceName { get; set; } + /// Gets or sets the resource type. + string ResourceType { get; set; } + /// Gets or sets the event severity. + string Severity { get; set; } + /// System data required to be defined for Azure resources. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel SystemData { get; set; } + /// Gets or sets the timestamp of resource creation (UTC). + global::System.DateTime? SystemDataCreatedAt { get; set; } + /// Gets or sets identity that created the resource. + string SystemDataCreatedBy { get; set; } + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + string SystemDataCreatedByType { get; set; } + /// Gets or sets the timestamp of resource last modification (UTC). + global::System.DateTime? SystemDataLastModifiedAt { get; set; } + /// Gets or sets the identity that last modified the resource. + string SystemDataLastModifiedBy { get; set; } + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + string SystemDataLastModifiedByType { get; set; } + /// Gets or sets the time at which the event occurred at source. + global::System.DateTime? TimeOfOccurrence { get; set; } + /// Gets or sets the type of the resource. + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModel.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModel.json.cs new file mode 100644 index 000000000000..301c6784566d --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModel.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Event model. + public partial class EventModel + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal EventModel(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api20210216Preview.EventModelProperties.FromJson(__jsonProperties) : Property;} + {_systemData = If( json?.PropertyT("systemData"), out var __jsonSystemData) ? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel.FromJson(__jsonSystemData) : SystemData;} + {_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); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModel. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModel. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModel FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new EventModel(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._systemData ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._systemData.ToJson(null,serializationMode) : null, "systemData" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelCollection.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelCollection.PowerShell.cs new file mode 100644 index 000000000000..a2670376b90f --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelCollection.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Event model collection. + [System.ComponentModel.TypeConverter(typeof(EventModelCollectionTypeConverter))] + public partial class EventModelCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new EventModelCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new EventModelCollection(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal EventModelCollection(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.Migrate.Models.Api20210216Preview.IEventModelCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModel[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EventModelTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCollectionInternal)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 EventModelCollection(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.Migrate.Models.Api20210216Preview.IEventModelCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModel[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EventModelTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCollectionInternal)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.Migrate.Models.Api20210216Preview.IEventModelCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Event model collection. + [System.ComponentModel.TypeConverter(typeof(EventModelCollectionTypeConverter))] + public partial interface IEventModelCollection + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelCollection.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelCollection.TypeConverter.cs new file mode 100644 index 000000000000..74426bd07825 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelCollection.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class EventModelCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return EventModelCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return EventModelCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return EventModelCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelCollection.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelCollection.cs new file mode 100644 index 000000000000..7642f848667d --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelCollection.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Event model collection. + public partial class EventModelCollection : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCollection, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// Gets or sets the value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModel[] _value; + + /// Gets or sets the list of events. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModel[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public EventModelCollection() + { + + } + } + /// Event model collection. + public partial interface IEventModelCollection : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the value of next link.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// Gets or sets the list of events. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the list of events.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModel) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModel[] Value { get; set; } + + } + /// Event model collection. + internal partial interface IEventModelCollectionInternal + + { + /// Gets or sets the value of next link. + string NextLink { get; set; } + /// Gets or sets the list of events. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModel[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelCollection.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelCollection.json.cs new file mode 100644 index 000000000000..b6ad4f6b2b75 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelCollection.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Event model collection. + public partial class EventModelCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal EventModelCollection(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Models.Api20210216Preview.IEventModel) (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EventModel.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.Migrate.Models.Api20210216Preview.IEventModelCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new EventModelCollection(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelCustomProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelCustomProperties.PowerShell.cs new file mode 100644 index 000000000000..62c95b4b93d0 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Event model custom properties. + [System.ComponentModel.TypeConverter(typeof(EventModelCustomPropertiesTypeConverter))] + public partial class EventModelCustomProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCustomProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new EventModelCustomProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCustomProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new EventModelCustomProperties(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal EventModelCustomProperties(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.Migrate.Models.Api20210216Preview.IEventModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCustomPropertiesInternal)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 EventModelCustomProperties(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.Migrate.Models.Api20210216Preview.IEventModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCustomPropertiesInternal)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.Migrate.Models.Api20210216Preview.IEventModelCustomProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Event model custom properties. + [System.ComponentModel.TypeConverter(typeof(EventModelCustomPropertiesTypeConverter))] + public partial interface IEventModelCustomProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelCustomProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelCustomProperties.TypeConverter.cs new file mode 100644 index 000000000000..1ad02afec70a --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelCustomProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class EventModelCustomPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCustomProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCustomProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return EventModelCustomProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return EventModelCustomProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return EventModelCustomProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelCustomProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelCustomProperties.cs new file mode 100644 index 000000000000..7e8d705bc8af --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Event model custom properties. + public partial class EventModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCustomProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCustomPropertiesInternal + { + + /// Backing field for property. + private string _instanceType; + + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Creates an new instance. + public EventModelCustomProperties() + { + + } + } + /// Event model custom properties. + public partial interface IEventModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Event model custom properties. + internal partial interface IEventModelCustomPropertiesInternal + + { + /// Gets or sets the instance type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelCustomProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelCustomProperties.json.cs new file mode 100644 index 000000000000..0b2e032c9b40 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Event model custom properties. + public partial class EventModelCustomProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal EventModelCustomProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api20210216Preview.IEventModelCustomProperties. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCustomProperties 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.Migrate.Models.Api20210216Preview.IEventModelCustomProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCustomProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "HyperVToAzStackHCI": + { + return new HyperVToAzStackHcieventModelCustomProperties(json); + } + } + return new EventModelCustomProperties(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelProperties.PowerShell.cs new file mode 100644 index 000000000000..0010909a2b27 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Event model properties. + [System.ComponentModel.TypeConverter(typeof(EventModelPropertiesTypeConverter))] + public partial class EventModelProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new EventModelProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new EventModelProperties(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal EventModelProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CustomProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)this).CustomProperty = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCustomProperties) content.GetValueForProperty("CustomProperty",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)this).CustomProperty, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EventModelCustomPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)this).ResourceType = (string) content.GetValueForProperty("ResourceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)this).ResourceType, global::System.Convert.ToString); + } + if (content.Contains("ResourceName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)this).ResourceName = (string) content.GetValueForProperty("ResourceName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)this).ResourceName, global::System.Convert.ToString); + } + if (content.Contains("EventType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)this).EventType = (string) content.GetValueForProperty("EventType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)this).EventType, global::System.Convert.ToString); + } + if (content.Contains("EventName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)this).EventName = (string) content.GetValueForProperty("EventName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)this).EventName, global::System.Convert.ToString); + } + if (content.Contains("TimeOfOccurrence")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)this).TimeOfOccurrence = (global::System.DateTime?) content.GetValueForProperty("TimeOfOccurrence",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)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("Severity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)this).Severity = (string) content.GetValueForProperty("Severity",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)this).Severity, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)this).Description, global::System.Convert.ToString); + } + if (content.Contains("CorrelationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)this).CorrelationId = (string) content.GetValueForProperty("CorrelationId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)this).CorrelationId, global::System.Convert.ToString); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HealthErrorModelTypeConverter.ConvertFrom)); + } + if (content.Contains("CustomPropertyInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)this).CustomPropertyInstanceType = (string) content.GetValueForProperty("CustomPropertyInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)this).CustomPropertyInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal EventModelProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CustomProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)this).CustomProperty = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCustomProperties) content.GetValueForProperty("CustomProperty",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)this).CustomProperty, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EventModelCustomPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)this).ResourceType = (string) content.GetValueForProperty("ResourceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)this).ResourceType, global::System.Convert.ToString); + } + if (content.Contains("ResourceName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)this).ResourceName = (string) content.GetValueForProperty("ResourceName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)this).ResourceName, global::System.Convert.ToString); + } + if (content.Contains("EventType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)this).EventType = (string) content.GetValueForProperty("EventType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)this).EventType, global::System.Convert.ToString); + } + if (content.Contains("EventName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)this).EventName = (string) content.GetValueForProperty("EventName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)this).EventName, global::System.Convert.ToString); + } + if (content.Contains("TimeOfOccurrence")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)this).TimeOfOccurrence = (global::System.DateTime?) content.GetValueForProperty("TimeOfOccurrence",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)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("Severity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)this).Severity = (string) content.GetValueForProperty("Severity",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)this).Severity, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)this).Description, global::System.Convert.ToString); + } + if (content.Contains("CorrelationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)this).CorrelationId = (string) content.GetValueForProperty("CorrelationId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)this).CorrelationId, global::System.Convert.ToString); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HealthErrorModelTypeConverter.ConvertFrom)); + } + if (content.Contains("CustomPropertyInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)this).CustomPropertyInstanceType = (string) content.GetValueForProperty("CustomPropertyInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal)this).CustomPropertyInstanceType, 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.Migrate.Models.Api20210216Preview.IEventModelProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Event model properties. + [System.ComponentModel.TypeConverter(typeof(EventModelPropertiesTypeConverter))] + public partial interface IEventModelProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelProperties.TypeConverter.cs new file mode 100644 index 000000000000..f0161f982cef --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class EventModelPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return EventModelProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return EventModelProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return EventModelProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelProperties.cs new file mode 100644 index 000000000000..0b5a32bba716 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Event model properties. + public partial class EventModelProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal + { + + /// Backing field for property. + private string _correlationId; + + /// Gets or sets the event correlation Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string CorrelationId { get => this._correlationId; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCustomProperties _customProperty; + + /// Event model custom properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCustomProperties CustomProperty { get => (this._customProperty = this._customProperty ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EventModelCustomProperties()); set => this._customProperty = value; } + + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string CustomPropertyInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCustomPropertiesInternal)CustomProperty).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCustomPropertiesInternal)CustomProperty).InstanceType = value ; } + + /// Backing field for property. + private string _description; + + /// Gets or sets the event description. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Description { get => this._description; } + + /// Backing field for property. + private string _eventName; + + /// Gets or sets the event name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string EventName { get => this._eventName; } + + /// Backing field for property. + private string _eventType; + + /// Gets or sets the event type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string EventType { get => this._eventType; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel[] _healthError; + + /// Gets or sets the errors associated with this event. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel[] HealthError { get => this._healthError; } + + /// Internal Acessors for CorrelationId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal.CorrelationId { get => this._correlationId; set { {_correlationId = value;} } } + + /// Internal Acessors for CustomProperty + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCustomProperties Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal.CustomProperty { get => (this._customProperty = this._customProperty ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EventModelCustomProperties()); set { {_customProperty = value;} } } + + /// Internal Acessors for Description + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal.Description { get => this._description; set { {_description = value;} } } + + /// Internal Acessors for EventName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal.EventName { get => this._eventName; set { {_eventName = value;} } } + + /// Internal Acessors for EventType + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal.EventType { get => this._eventType; set { {_eventType = value;} } } + + /// Internal Acessors for HealthError + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel[] Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal.HealthError { get => this._healthError; set { {_healthError = value;} } } + + /// Internal Acessors for ResourceName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal.ResourceName { get => this._resourceName; set { {_resourceName = value;} } } + + /// Internal Acessors for ResourceType + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal.ResourceType { get => this._resourceType; set { {_resourceType = value;} } } + + /// Internal Acessors for Severity + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal.Severity { get => this._severity; set { {_severity = value;} } } + + /// Internal Acessors for TimeOfOccurrence + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelPropertiesInternal.TimeOfOccurrence { get => this._timeOfOccurrence; set { {_timeOfOccurrence = value;} } } + + /// Backing field for property. + private string _resourceName; + + /// Gets or sets the resource name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string ResourceName { get => this._resourceName; } + + /// Backing field for property. + private string _resourceType; + + /// Gets or sets the resource type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string ResourceType { get => this._resourceType; } + + /// Backing field for property. + private string _severity; + + /// Gets or sets the event severity. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Severity { get => this._severity; } + + /// Backing field for property. + private global::System.DateTime? _timeOfOccurrence; + + /// Gets or sets the time at which the event occurred at source. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public global::System.DateTime? TimeOfOccurrence { get => this._timeOfOccurrence; } + + /// Creates an new instance. + public EventModelProperties() + { + + } + } + /// Event model properties. + public partial interface IEventModelProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the event correlation Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the event correlation Id.", + SerializedName = @"correlationId", + PossibleTypes = new [] { typeof(string) })] + string CorrelationId { get; } + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string CustomPropertyInstanceType { get; set; } + /// Gets or sets the event description. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the event description.", + SerializedName = @"description", + PossibleTypes = new [] { typeof(string) })] + string Description { get; } + /// Gets or sets the event name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the event name.", + SerializedName = @"eventName", + PossibleTypes = new [] { typeof(string) })] + string EventName { get; } + /// Gets or sets the event type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the event type.", + SerializedName = @"eventType", + PossibleTypes = new [] { typeof(string) })] + string EventType { get; } + /// Gets or sets the errors associated with this event. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the errors associated with this event.", + SerializedName = @"healthErrors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel[] HealthError { get; } + /// Gets or sets the resource name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the resource name.", + SerializedName = @"resourceName", + PossibleTypes = new [] { typeof(string) })] + string ResourceName { get; } + /// Gets or sets the resource type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the resource type.", + SerializedName = @"resourceType", + PossibleTypes = new [] { typeof(string) })] + string ResourceType { get; } + /// Gets or sets the event severity. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the event severity.", + SerializedName = @"severity", + PossibleTypes = new [] { typeof(string) })] + string Severity { get; } + /// Gets or sets the time at which the event occurred at source. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the time at which the event occurred at source.", + SerializedName = @"timeOfOccurrence", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? TimeOfOccurrence { get; } + + } + /// Event model properties. + internal partial interface IEventModelPropertiesInternal + + { + /// Gets or sets the event correlation Id. + string CorrelationId { get; set; } + /// Event model custom properties. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCustomProperties CustomProperty { get; set; } + /// Gets or sets the instance type. + string CustomPropertyInstanceType { get; set; } + /// Gets or sets the event description. + string Description { get; set; } + /// Gets or sets the event name. + string EventName { get; set; } + /// Gets or sets the event type. + string EventType { get; set; } + /// Gets or sets the errors associated with this event. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel[] HealthError { get; set; } + /// Gets or sets the resource name. + string ResourceName { get; set; } + /// Gets or sets the resource type. + string ResourceType { get; set; } + /// Gets or sets the event severity. + string Severity { get; set; } + /// Gets or sets the time at which the event occurred at source. + global::System.DateTime? TimeOfOccurrence { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelProperties.json.cs new file mode 100644 index 000000000000..d04994b7d703 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelProperties.json.cs @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Event model properties. + public partial class EventModelProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal EventModelProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_customProperty = If( json?.PropertyT("customProperties"), out var __jsonCustomProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EventModelCustomProperties.FromJson(__jsonCustomProperties) : CustomProperty;} + {_resourceType = If( json?.PropertyT("resourceType"), out var __jsonResourceType) ? (string)__jsonResourceType : (string)ResourceType;} + {_resourceName = If( json?.PropertyT("resourceName"), out var __jsonResourceName) ? (string)__jsonResourceName : (string)ResourceName;} + {_eventType = If( json?.PropertyT("eventType"), out var __jsonEventType) ? (string)__jsonEventType : (string)EventType;} + {_eventName = If( json?.PropertyT("eventName"), out var __jsonEventName) ? (string)__jsonEventName : (string)EventName;} + {_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;} + {_severity = If( json?.PropertyT("severity"), out var __jsonSeverity) ? (string)__jsonSeverity : (string)Severity;} + {_description = If( json?.PropertyT("description"), out var __jsonDescription) ? (string)__jsonDescription : (string)Description;} + {_correlationId = If( json?.PropertyT("correlationId"), out var __jsonCorrelationId) ? (string)__jsonCorrelationId : (string)CorrelationId;} + {_healthError = If( json?.PropertyT("healthErrors"), out var __jsonHealthErrors) ? If( __jsonHealthErrors as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api20210216Preview.IHealthErrorModel) (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HealthErrorModel.FromJson(__u) )) ))() : null : HealthError;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new EventModelProperties(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._customProperty ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._customProperty.ToJson(null,serializationMode) : null, "customProperties" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._resourceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._resourceType.ToString()) : null, "resourceType" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._resourceName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._resourceName.ToString()) : null, "resourceName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._eventType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._eventType.ToString()) : null, "eventType" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._eventName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._eventName.ToString()) : null, "eventName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._timeOfOccurrence ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._timeOfOccurrence?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "timeOfOccurrence" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._severity)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._severity.ToString()) : null, "severity" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._description)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._description.ToString()) : null, "description" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._correlationId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._correlationId.ToString()) : null, "correlationId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._healthError) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelSystemData.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelSystemData.PowerShell.cs new file mode 100644 index 000000000000..fed1e8b182c9 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelSystemData.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(EventModelSystemDataTypeConverter))] + public partial class EventModelSystemData + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelSystemData DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new EventModelSystemData(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelSystemData DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new EventModelSystemData(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal EventModelSystemData(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy, global::System.Convert.ToString); + } + if (content.Contains("CreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType = (string) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType, global::System.Convert.ToString); + } + if (content.Contains("CreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType = (string) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt, (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 EventModelSystemData(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy, global::System.Convert.ToString); + } + if (content.Contains("CreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType = (string) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType, global::System.Convert.ToString); + } + if (content.Contains("CreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType = (string) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt, (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.Migrate.Models.Api20210216Preview.IEventModelSystemData FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + [System.ComponentModel.TypeConverter(typeof(EventModelSystemDataTypeConverter))] + public partial interface IEventModelSystemData + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelSystemData.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelSystemData.TypeConverter.cs new file mode 100644 index 000000000000..5e0622d684a2 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelSystemData.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class EventModelSystemDataTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelSystemData ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelSystemData).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return EventModelSystemData.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return EventModelSystemData.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return EventModelSystemData.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelSystemData.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelSystemData.cs new file mode 100644 index 000000000000..37d9ec0902f9 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelSystemData.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + public partial class EventModelSystemData : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelSystemData, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelSystemDataInternal, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel __systemDataModel = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel(); + + /// Gets or sets the timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public global::System.DateTime? CreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string CreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string CreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedByType = value ?? null; } + + /// Gets or sets the timestamp of resource last modification (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public global::System.DateTime? LastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets the identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string LastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string LastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedByType = value ?? null; } + + /// Creates an new instance. + public EventModelSystemData() + { + + } + + /// 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.Migrate.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__systemDataModel), __systemDataModel); + await eventListener.AssertObjectIsValid(nameof(__systemDataModel), __systemDataModel); + } + } + public partial interface IEventModelSystemData : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel + { + + } + internal partial interface IEventModelSystemDataInternal : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelSystemData.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelSystemData.json.cs new file mode 100644 index 000000000000..32e1a0f59e6a --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/EventModelSystemData.json.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + public partial class EventModelSystemData + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal EventModelSystemData(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __systemDataModel = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel(json); + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelSystemData. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelSystemData. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelSystemData FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new EventModelSystemData(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __systemDataModel?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModel.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModel.PowerShell.cs new file mode 100644 index 000000000000..9dd91b33a786 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModel.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Fabric model. + [System.ComponentModel.TypeConverter(typeof(FabricModelTypeConverter))] + public partial class FabricModel + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModel DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new FabricModel(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModel DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new FabricModel(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal FabricModel(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModelTypeConverter.ConvertFrom); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).SystemDataLastModifiedAt, (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 FabricModel(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModelTypeConverter.ConvertFrom); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal)this).SystemDataLastModifiedAt, (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.Migrate.Models.Api20210216Preview.IFabricModel FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Fabric model. + [System.ComponentModel.TypeConverter(typeof(FabricModelTypeConverter))] + public partial interface IFabricModel + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModel.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModel.TypeConverter.cs new file mode 100644 index 000000000000..6076c8a779e7 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModel.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class FabricModelTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModel ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModel).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return FabricModel.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return FabricModel.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return FabricModel.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModel.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModel.cs new file mode 100644 index 000000000000..dd4643745599 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModel.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Fabric model. + public partial class FabricModel : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModel, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal + { + + /// Backing field for property. + private string _id; + + /// Gets or sets the Id of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Id { get => this._id; } + + /// Backing field for property. + private string _location; + + /// Gets or sets the location of the fabric. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Location { get => this._location; set => this._location = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal.Id { get => this._id; set { {_id = value;} } } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal.Name { get => this._name; set { {_name = value;} } } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal.SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel()); set { {_systemData = value;} } } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelInternal.Type { get => this._type; set { {_type = value;} } } + + /// Backing field for property. + private string _name; + + /// Gets or sets the name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Name { get => this._name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelProperties _property; + + /// Fabric model properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelProperties()); set => this._property = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel _systemData; + + /// System data required to be defined for Azure resources. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel()); } + + /// Gets or sets the timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedByType = value ?? null; } + + /// Gets or sets the timestamp of resource last modification (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets the identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedByType = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelTags _tag; + + /// Gets or sets the resource tags. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelTags()); set => this._tag = value; } + + /// Backing field for property. + private string _type; + + /// Gets or sets the type of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Type { get => this._type; } + + /// Creates an new instance. + public FabricModel() + { + + } + } + /// Fabric model. + public partial interface IFabricModel : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the Id of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the Id of the resource.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; } + /// Gets or sets the location of the fabric. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the location of the fabric.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + string Location { get; set; } + /// Gets or sets the name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the name of the resource.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; } + /// Fabric model properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric model properties.", + SerializedName = @"properties", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelProperties) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelProperties Property { get; set; } + /// Gets or sets the timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the timestamp of resource creation (UTC).", + SerializedName = @"createdAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataCreatedAt { get; set; } + /// Gets or sets identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets identity that created the resource.", + SerializedName = @"createdBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataCreatedBy { get; set; } + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the type of identity that created the resource: user, application, + managedIdentity.", + SerializedName = @"createdByType", + PossibleTypes = new [] { typeof(string) })] + string SystemDataCreatedByType { get; set; } + /// Gets or sets the timestamp of resource last modification (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the timestamp of resource last modification (UTC).", + SerializedName = @"lastModifiedAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataLastModifiedAt { get; set; } + /// Gets or sets the identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the identity that last modified the resource.", + SerializedName = @"lastModifiedBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataLastModifiedBy { get; set; } + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the type of identity that last modified the resource: user, application, + managedIdentity.", + SerializedName = @"lastModifiedByType", + PossibleTypes = new [] { typeof(string) })] + string SystemDataLastModifiedByType { get; set; } + /// Gets or sets the resource tags. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelTags) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelTags Tag { get; set; } + /// Gets or sets the type of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the type of the resource.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; } + + } + /// Fabric model. + internal partial interface IFabricModelInternal + + { + /// Gets or sets the Id of the resource. + string Id { get; set; } + /// Gets or sets the location of the fabric. + string Location { get; set; } + /// Gets or sets the name of the resource. + string Name { get; set; } + /// Fabric model properties. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelProperties Property { get; set; } + /// System data required to be defined for Azure resources. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel SystemData { get; set; } + /// Gets or sets the timestamp of resource creation (UTC). + global::System.DateTime? SystemDataCreatedAt { get; set; } + /// Gets or sets identity that created the resource. + string SystemDataCreatedBy { get; set; } + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + string SystemDataCreatedByType { get; set; } + /// Gets or sets the timestamp of resource last modification (UTC). + global::System.DateTime? SystemDataLastModifiedAt { get; set; } + /// Gets or sets the identity that last modified the resource. + string SystemDataLastModifiedBy { get; set; } + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + string SystemDataLastModifiedByType { get; set; } + /// Gets or sets the resource tags. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelTags Tag { get; set; } + /// Gets or sets the type of the resource. + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModel.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModel.json.cs new file mode 100644 index 000000000000..4b5752f6d38e --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModel.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Fabric model. + public partial class FabricModel + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal FabricModel(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_systemData = If( json?.PropertyT("systemData"), out var __jsonSystemData) ? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel.FromJson(__jsonSystemData) : SystemData;} + {_location = If( json?.PropertyT("location"), out var __jsonLocation) ? (string)__jsonLocation : (string)Location;} + {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelTags.FromJson(__jsonTags) : Tag;} + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelProperties.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); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModel. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModel. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModel FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new FabricModel(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._systemData ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._systemData.ToJson(null,serializationMode) : null, "systemData" ,container.Add ); + } + AddIf( null != (((object)this._location)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._location.ToString()) : null, "location" ,container.Add ); + AddIf( null != this._tag ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._tag.ToJson(null,serializationMode) : null, "tags" ,container.Add ); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelCollection.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelCollection.PowerShell.cs new file mode 100644 index 000000000000..467155f0189b --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelCollection.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Fabric model collection. + [System.ComponentModel.TypeConverter(typeof(FabricModelCollectionTypeConverter))] + public partial class FabricModelCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new FabricModelCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new FabricModelCollection(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal FabricModelCollection(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.Migrate.Models.Api20210216Preview.IFabricModelCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModel[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCollectionInternal)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 FabricModelCollection(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.Migrate.Models.Api20210216Preview.IFabricModelCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModel[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCollectionInternal)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.Migrate.Models.Api20210216Preview.IFabricModelCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Fabric model collection. + [System.ComponentModel.TypeConverter(typeof(FabricModelCollectionTypeConverter))] + public partial interface IFabricModelCollection + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelCollection.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelCollection.TypeConverter.cs new file mode 100644 index 000000000000..9049f1e803b1 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelCollection.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class FabricModelCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return FabricModelCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return FabricModelCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return FabricModelCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelCollection.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelCollection.cs new file mode 100644 index 000000000000..9dca55b9b158 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelCollection.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Fabric model collection. + public partial class FabricModelCollection : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCollection, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// Gets or sets the value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModel[] _value; + + /// Gets or sets the list of fabrics. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModel[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public FabricModelCollection() + { + + } + } + /// Fabric model collection. + public partial interface IFabricModelCollection : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the value of next link.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// Gets or sets the list of fabrics. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the list of fabrics.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModel) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModel[] Value { get; set; } + + } + /// Fabric model collection. + internal partial interface IFabricModelCollectionInternal + + { + /// Gets or sets the value of next link. + string NextLink { get; set; } + /// Gets or sets the list of fabrics. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModel[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelCollection.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelCollection.json.cs new file mode 100644 index 000000000000..361ea7738140 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelCollection.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Fabric model collection. + public partial class FabricModelCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal FabricModelCollection(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Models.Api20210216Preview.IFabricModel) (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModel.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.Migrate.Models.Api20210216Preview.IFabricModelCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new FabricModelCollection(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelCustomProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelCustomProperties.PowerShell.cs new file mode 100644 index 000000000000..70ead6865358 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Fabric model custom properties. + [System.ComponentModel.TypeConverter(typeof(FabricModelCustomPropertiesTypeConverter))] + public partial class FabricModelCustomProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCustomProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new FabricModelCustomProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCustomProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new FabricModelCustomProperties(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal FabricModelCustomProperties(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.Migrate.Models.Api20210216Preview.IFabricModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCustomPropertiesInternal)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 FabricModelCustomProperties(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.Migrate.Models.Api20210216Preview.IFabricModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCustomPropertiesInternal)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.Migrate.Models.Api20210216Preview.IFabricModelCustomProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Fabric model custom properties. + [System.ComponentModel.TypeConverter(typeof(FabricModelCustomPropertiesTypeConverter))] + public partial interface IFabricModelCustomProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelCustomProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelCustomProperties.TypeConverter.cs new file mode 100644 index 000000000000..e44d9874ea4d --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelCustomProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class FabricModelCustomPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCustomProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCustomProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return FabricModelCustomProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return FabricModelCustomProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return FabricModelCustomProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelCustomProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelCustomProperties.cs new file mode 100644 index 000000000000..e3559f5325ac --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Fabric model custom properties. + public partial class FabricModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCustomProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCustomPropertiesInternal + { + + /// Backing field for property. + private string _instanceType; + + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Creates an new instance. + public FabricModelCustomProperties() + { + + } + } + /// Fabric model custom properties. + public partial interface IFabricModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Fabric model custom properties. + internal partial interface IFabricModelCustomPropertiesInternal + + { + /// Gets or sets the instance type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelCustomProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelCustomProperties.json.cs new file mode 100644 index 000000000000..b376248f6c97 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Fabric model custom properties. + public partial class FabricModelCustomProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal FabricModelCustomProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api20210216Preview.IFabricModelCustomProperties. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCustomProperties 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.Migrate.Models.Api20210216Preview.IFabricModelCustomProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCustomProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "AzStackHCI": + { + return new AzStackHciFabricModelCustomProperties(json); + } + case "HyperVMigrate": + { + return new HyperVMigrateFabricModelCustomProperties(json); + } + case "VMwareMigrate": + { + return new VMwareMigrateFabricModelCustomProperties(json); + } + } + return new FabricModelCustomProperties(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelProperties.PowerShell.cs new file mode 100644 index 000000000000..c04832a6e74d --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Fabric model properties. + [System.ComponentModel.TypeConverter(typeof(FabricModelPropertiesTypeConverter))] + public partial class FabricModelProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new FabricModelProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new FabricModelProperties(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal FabricModelProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelPropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelPropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState.CreateFrom); + } + if (content.Contains("ServiceEndpoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelPropertiesInternal)this).ServiceEndpoint = (string) content.GetValueForProperty("ServiceEndpoint",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelPropertiesInternal)this).ServiceEndpoint, global::System.Convert.ToString); + } + if (content.Contains("ServiceResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelPropertiesInternal)this).ServiceResourceId = (string) content.GetValueForProperty("ServiceResourceId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelPropertiesInternal)this).ServiceResourceId, global::System.Convert.ToString); + } + if (content.Contains("Health")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelPropertiesInternal)this).Health = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.HealthStatus?) content.GetValueForProperty("Health",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelPropertiesInternal)this).Health, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.HealthStatus.CreateFrom); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelPropertiesInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelPropertiesInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HealthErrorModelTypeConverter.ConvertFrom)); + } + if (content.Contains("CustomProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelPropertiesInternal)this).CustomProperty = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCustomProperties) content.GetValueForProperty("CustomProperty",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelPropertiesInternal)this).CustomProperty, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelCustomPropertiesTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal FabricModelProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelPropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelPropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState.CreateFrom); + } + if (content.Contains("ServiceEndpoint")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelPropertiesInternal)this).ServiceEndpoint = (string) content.GetValueForProperty("ServiceEndpoint",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelPropertiesInternal)this).ServiceEndpoint, global::System.Convert.ToString); + } + if (content.Contains("ServiceResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelPropertiesInternal)this).ServiceResourceId = (string) content.GetValueForProperty("ServiceResourceId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelPropertiesInternal)this).ServiceResourceId, global::System.Convert.ToString); + } + if (content.Contains("Health")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelPropertiesInternal)this).Health = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.HealthStatus?) content.GetValueForProperty("Health",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelPropertiesInternal)this).Health, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.HealthStatus.CreateFrom); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelPropertiesInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelPropertiesInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HealthErrorModelTypeConverter.ConvertFrom)); + } + if (content.Contains("CustomProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelPropertiesInternal)this).CustomProperty = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCustomProperties) content.GetValueForProperty("CustomProperty",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelPropertiesInternal)this).CustomProperty, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelCustomPropertiesTypeConverter.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.Migrate.Models.Api20210216Preview.IFabricModelProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Fabric model properties. + [System.ComponentModel.TypeConverter(typeof(FabricModelPropertiesTypeConverter))] + public partial interface IFabricModelProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelProperties.TypeConverter.cs new file mode 100644 index 000000000000..71e2af5a0b18 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class FabricModelPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return FabricModelProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return FabricModelProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return FabricModelProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelProperties.cs new file mode 100644 index 000000000000..a9175deba642 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Fabric model properties. + public partial class FabricModelProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelPropertiesInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCustomProperties _customProperty; + + /// Fabric model custom properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCustomProperties CustomProperty { get => (this._customProperty = this._customProperty ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelCustomProperties()); set => this._customProperty = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.HealthStatus? _health; + + /// Gets or sets the fabric health. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.HealthStatus? Health { get => this._health; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel[] _healthError; + + /// Gets or sets the list of health errors. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel[] HealthError { get => this._healthError; } + + /// Internal Acessors for Health + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.HealthStatus? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelPropertiesInternal.Health { get => this._health; set { {_health = value;} } } + + /// Internal Acessors for HealthError + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel[] Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelPropertiesInternal.HealthError { get => this._healthError; set { {_healthError = value;} } } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelPropertiesInternal.ProvisioningState { get => this._provisioningState; set { {_provisioningState = value;} } } + + /// Internal Acessors for ServiceEndpoint + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelPropertiesInternal.ServiceEndpoint { get => this._serviceEndpoint; set { {_serviceEndpoint = value;} } } + + /// Internal Acessors for ServiceResourceId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelPropertiesInternal.ServiceResourceId { get => this._serviceResourceId; set { {_serviceResourceId = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState? _provisioningState; + + /// Gets or sets the provisioning state of the fabric. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState? ProvisioningState { get => this._provisioningState; } + + /// Backing field for property. + private string _serviceEndpoint; + + /// Gets or sets the service endpoint. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string ServiceEndpoint { get => this._serviceEndpoint; } + + /// Backing field for property. + private string _serviceResourceId; + + /// Gets or sets the service resource Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string ServiceResourceId { get => this._serviceResourceId; } + + /// Creates an new instance. + public FabricModelProperties() + { + + } + } + /// Fabric model properties. + public partial interface IFabricModelProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Fabric model custom properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Fabric model custom properties.", + SerializedName = @"customProperties", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCustomProperties) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCustomProperties CustomProperty { get; set; } + /// Gets or sets the fabric health. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the fabric health.", + SerializedName = @"health", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.HealthStatus) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.HealthStatus? Health { get; } + /// Gets or sets the list of health errors. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the list of health errors.", + SerializedName = @"healthErrors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel[] HealthError { get; } + /// Gets or sets the provisioning state of the fabric. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the provisioning state of the fabric.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState? ProvisioningState { get; } + /// Gets or sets the service endpoint. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the service endpoint.", + SerializedName = @"serviceEndpoint", + PossibleTypes = new [] { typeof(string) })] + string ServiceEndpoint { get; } + /// Gets or sets the service resource Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the service resource Id.", + SerializedName = @"serviceResourceId", + PossibleTypes = new [] { typeof(string) })] + string ServiceResourceId { get; } + + } + /// Fabric model properties. + internal partial interface IFabricModelPropertiesInternal + + { + /// Fabric model custom properties. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCustomProperties CustomProperty { get; set; } + /// Gets or sets the fabric health. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.HealthStatus? Health { get; set; } + /// Gets or sets the list of health errors. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel[] HealthError { get; set; } + /// Gets or sets the provisioning state of the fabric. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState? ProvisioningState { get; set; } + /// Gets or sets the service endpoint. + string ServiceEndpoint { get; set; } + /// Gets or sets the service resource Id. + string ServiceResourceId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelProperties.json.cs new file mode 100644 index 000000000000..d605dd496b70 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Fabric model properties. + public partial class FabricModelProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal FabricModelProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)ProvisioningState;} + {_serviceEndpoint = If( json?.PropertyT("serviceEndpoint"), out var __jsonServiceEndpoint) ? (string)__jsonServiceEndpoint : (string)ServiceEndpoint;} + {_serviceResourceId = If( json?.PropertyT("serviceResourceId"), out var __jsonServiceResourceId) ? (string)__jsonServiceResourceId : (string)ServiceResourceId;} + {_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.Migrate.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.Migrate.Models.Api20210216Preview.IHealthErrorModel) (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HealthErrorModel.FromJson(__u) )) ))() : null : HealthError;} + {_customProperty = If( json?.PropertyT("customProperties"), out var __jsonCustomProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelCustomProperties.FromJson(__jsonCustomProperties) : CustomProperty;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new FabricModelProperties(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._serviceEndpoint)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._serviceEndpoint.ToString()) : null, "serviceEndpoint" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._serviceResourceId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._serviceResourceId.ToString()) : null, "serviceResourceId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._health)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._health.ToString()) : null, "health" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._healthError) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.XNodeArray(); + foreach( var __x in this._healthError ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("healthErrors",__w); + } + } + AddIf( null != this._customProperty ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._customProperty.ToJson(null,serializationMode) : null, "customProperties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelSystemData.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelSystemData.PowerShell.cs new file mode 100644 index 000000000000..cbfc6a2d246b --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelSystemData.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(FabricModelSystemDataTypeConverter))] + public partial class FabricModelSystemData + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelSystemData DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new FabricModelSystemData(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelSystemData DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new FabricModelSystemData(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal FabricModelSystemData(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy, global::System.Convert.ToString); + } + if (content.Contains("CreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType = (string) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType, global::System.Convert.ToString); + } + if (content.Contains("CreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType = (string) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt, (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 FabricModelSystemData(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy, global::System.Convert.ToString); + } + if (content.Contains("CreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType = (string) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType, global::System.Convert.ToString); + } + if (content.Contains("CreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType = (string) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt, (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.Migrate.Models.Api20210216Preview.IFabricModelSystemData FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + [System.ComponentModel.TypeConverter(typeof(FabricModelSystemDataTypeConverter))] + public partial interface IFabricModelSystemData + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelSystemData.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelSystemData.TypeConverter.cs new file mode 100644 index 000000000000..11466f90b90e --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelSystemData.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class FabricModelSystemDataTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelSystemData ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelSystemData).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return FabricModelSystemData.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return FabricModelSystemData.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return FabricModelSystemData.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelSystemData.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelSystemData.cs new file mode 100644 index 000000000000..3efcbab453c5 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelSystemData.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + public partial class FabricModelSystemData : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelSystemData, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelSystemDataInternal, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel __systemDataModel = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel(); + + /// Gets or sets the timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public global::System.DateTime? CreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string CreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string CreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedByType = value ?? null; } + + /// Gets or sets the timestamp of resource last modification (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public global::System.DateTime? LastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets the identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string LastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string LastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedByType = value ?? null; } + + /// Creates an new instance. + public FabricModelSystemData() + { + + } + + /// 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.Migrate.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__systemDataModel), __systemDataModel); + await eventListener.AssertObjectIsValid(nameof(__systemDataModel), __systemDataModel); + } + } + public partial interface IFabricModelSystemData : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel + { + + } + internal partial interface IFabricModelSystemDataInternal : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelSystemData.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelSystemData.json.cs new file mode 100644 index 000000000000..8e75f632d6ca --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelSystemData.json.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + public partial class FabricModelSystemData + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal FabricModelSystemData(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __systemDataModel = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel(json); + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelSystemData. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelSystemData. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelSystemData FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new FabricModelSystemData(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __systemDataModel?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelTags.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelTags.PowerShell.cs new file mode 100644 index 000000000000..9b0cda124976 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelTags.PowerShell.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Gets or sets the resource tags. + [System.ComponentModel.TypeConverter(typeof(FabricModelTagsTypeConverter))] + public partial class FabricModelTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new FabricModelTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new FabricModelTags(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal FabricModelTags(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 FabricModelTags(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); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Gets or sets the resource tags. + [System.ComponentModel.TypeConverter(typeof(FabricModelTagsTypeConverter))] + public partial interface IFabricModelTags + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelTags.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelTags.TypeConverter.cs new file mode 100644 index 000000000000..593e837238e9 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelTags.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class FabricModelTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return FabricModelTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return FabricModelTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return FabricModelTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelTags.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelTags.cs new file mode 100644 index 000000000000..18236c4df266 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelTags.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Gets or sets the resource tags. + public partial class FabricModelTags : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelTags, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelTagsInternal + { + + /// Creates an new instance. + public FabricModelTags() + { + + } + } + /// Gets or sets the resource tags. + public partial interface IFabricModelTags : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IAssociativeArray + { + + } + /// Gets or sets the resource tags. + internal partial interface IFabricModelTagsInternal + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelTags.dictionary.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelTags.dictionary.cs new file mode 100644 index 000000000000..5c8b276b05cc --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelTags.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + public partial class FabricModelTags : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Models.Api20210216Preview.FabricModelTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelTags.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelTags.json.cs new file mode 100644 index 000000000000..36f89383a2f5 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelTags.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Gets or sets the resource tags. + public partial class FabricModelTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + /// + internal FabricModelTags(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new FabricModelTags(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelUpdate.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelUpdate.PowerShell.cs new file mode 100644 index 000000000000..3be5565f21f3 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelUpdate.PowerShell.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Fabric model for update. + [System.ComponentModel.TypeConverter(typeof(FabricModelUpdateTypeConverter))] + public partial class FabricModelUpdate + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdate DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new FabricModelUpdate(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdate DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new FabricModelUpdate(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal FabricModelUpdate(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModelTypeConverter.ConvertFrom); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelUpdateTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).SystemDataLastModifiedAt, (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 FabricModelUpdate(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModelTypeConverter.ConvertFrom); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelUpdateTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal)this).SystemDataLastModifiedAt, (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.Migrate.Models.Api20210216Preview.IFabricModelUpdate FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Fabric model for update. + [System.ComponentModel.TypeConverter(typeof(FabricModelUpdateTypeConverter))] + public partial interface IFabricModelUpdate + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelUpdate.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelUpdate.TypeConverter.cs new file mode 100644 index 000000000000..418b30250a35 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelUpdate.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class FabricModelUpdateTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdate ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdate).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return FabricModelUpdate.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return FabricModelUpdate.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return FabricModelUpdate.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelUpdate.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelUpdate.cs new file mode 100644 index 000000000000..f168587ebcfa --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelUpdate.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Fabric model for update. + public partial class FabricModelUpdate : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdate, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal + { + + /// Backing field for property. + private string _id; + + /// Gets or sets the Id of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Id { get => this._id; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal.Id { get => this._id; set { {_id = value;} } } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal.Name { get => this._name; set { {_name = value;} } } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal.SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel()); set { {_systemData = value;} } } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateInternal.Type { get => this._type; set { {_type = value;} } } + + /// Backing field for property. + private string _name; + + /// Gets or sets the name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Name { get => this._name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelProperties _property; + + /// Fabric model properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelProperties()); set => this._property = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel _systemData; + + /// System data required to be defined for Azure resources. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel()); } + + /// Gets or sets the timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedByType = value ?? null; } + + /// Gets or sets the timestamp of resource last modification (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets the identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedByType = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateTags _tag; + + /// Gets or sets the resource tags. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelUpdateTags()); set => this._tag = value; } + + /// Backing field for property. + private string _type; + + /// Gets or sets the type of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Type { get => this._type; } + + /// Creates an new instance. + public FabricModelUpdate() + { + + } + } + /// Fabric model for update. + public partial interface IFabricModelUpdate : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the Id of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the Id of the resource.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; } + /// Gets or sets the name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the name of the resource.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; } + /// Fabric model properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Fabric model properties.", + SerializedName = @"properties", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelProperties) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelProperties Property { get; set; } + /// Gets or sets the timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the timestamp of resource creation (UTC).", + SerializedName = @"createdAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataCreatedAt { get; set; } + /// Gets or sets identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets identity that created the resource.", + SerializedName = @"createdBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataCreatedBy { get; set; } + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the type of identity that created the resource: user, application, + managedIdentity.", + SerializedName = @"createdByType", + PossibleTypes = new [] { typeof(string) })] + string SystemDataCreatedByType { get; set; } + /// Gets or sets the timestamp of resource last modification (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the timestamp of resource last modification (UTC).", + SerializedName = @"lastModifiedAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataLastModifiedAt { get; set; } + /// Gets or sets the identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the identity that last modified the resource.", + SerializedName = @"lastModifiedBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataLastModifiedBy { get; set; } + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the type of identity that last modified the resource: user, application, + managedIdentity.", + SerializedName = @"lastModifiedByType", + PossibleTypes = new [] { typeof(string) })] + string SystemDataLastModifiedByType { get; set; } + /// Gets or sets the resource tags. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateTags) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateTags Tag { get; set; } + /// Gets or sets the type of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the type of the resource.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; } + + } + /// Fabric model for update. + internal partial interface IFabricModelUpdateInternal + + { + /// Gets or sets the Id of the resource. + string Id { get; set; } + /// Gets or sets the name of the resource. + string Name { get; set; } + /// Fabric model properties. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelProperties Property { get; set; } + /// System data required to be defined for Azure resources. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel SystemData { get; set; } + /// Gets or sets the timestamp of resource creation (UTC). + global::System.DateTime? SystemDataCreatedAt { get; set; } + /// Gets or sets identity that created the resource. + string SystemDataCreatedBy { get; set; } + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + string SystemDataCreatedByType { get; set; } + /// Gets or sets the timestamp of resource last modification (UTC). + global::System.DateTime? SystemDataLastModifiedAt { get; set; } + /// Gets or sets the identity that last modified the resource. + string SystemDataLastModifiedBy { get; set; } + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + string SystemDataLastModifiedByType { get; set; } + /// Gets or sets the resource tags. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateTags Tag { get; set; } + /// Gets or sets the type of the resource. + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelUpdate.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelUpdate.json.cs new file mode 100644 index 000000000000..4a984515edee --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelUpdate.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Fabric model for update. + public partial class FabricModelUpdate + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal FabricModelUpdate(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_systemData = If( json?.PropertyT("systemData"), out var __jsonSystemData) ? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel.FromJson(__jsonSystemData) : SystemData;} + {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelUpdateTags.FromJson(__jsonTags) : Tag;} + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelProperties.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); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdate. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdate. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdate FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new FabricModelUpdate(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._systemData ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._systemData.ToJson(null,serializationMode) : null, "systemData" ,container.Add ); + } + AddIf( null != this._tag ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._tag.ToJson(null,serializationMode) : null, "tags" ,container.Add ); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelUpdateSystemData.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelUpdateSystemData.PowerShell.cs new file mode 100644 index 000000000000..4758be582458 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelUpdateSystemData.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(FabricModelUpdateSystemDataTypeConverter))] + public partial class FabricModelUpdateSystemData + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateSystemData DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new FabricModelUpdateSystemData(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateSystemData DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new FabricModelUpdateSystemData(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal FabricModelUpdateSystemData(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy, global::System.Convert.ToString); + } + if (content.Contains("CreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType = (string) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType, global::System.Convert.ToString); + } + if (content.Contains("CreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType = (string) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt, (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 FabricModelUpdateSystemData(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy, global::System.Convert.ToString); + } + if (content.Contains("CreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType = (string) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType, global::System.Convert.ToString); + } + if (content.Contains("CreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType = (string) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt, (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.Migrate.Models.Api20210216Preview.IFabricModelUpdateSystemData FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + [System.ComponentModel.TypeConverter(typeof(FabricModelUpdateSystemDataTypeConverter))] + public partial interface IFabricModelUpdateSystemData + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelUpdateSystemData.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelUpdateSystemData.TypeConverter.cs new file mode 100644 index 000000000000..1ab097e97678 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelUpdateSystemData.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class FabricModelUpdateSystemDataTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateSystemData ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateSystemData).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return FabricModelUpdateSystemData.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return FabricModelUpdateSystemData.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return FabricModelUpdateSystemData.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelUpdateSystemData.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelUpdateSystemData.cs new file mode 100644 index 000000000000..ecaa8b3a8207 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelUpdateSystemData.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + public partial class FabricModelUpdateSystemData : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateSystemData, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateSystemDataInternal, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel __systemDataModel = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel(); + + /// Gets or sets the timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public global::System.DateTime? CreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string CreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string CreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedByType = value ?? null; } + + /// Gets or sets the timestamp of resource last modification (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public global::System.DateTime? LastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets the identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string LastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string LastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedByType = value ?? null; } + + /// Creates an new instance. + public FabricModelUpdateSystemData() + { + + } + + /// 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.Migrate.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__systemDataModel), __systemDataModel); + await eventListener.AssertObjectIsValid(nameof(__systemDataModel), __systemDataModel); + } + } + public partial interface IFabricModelUpdateSystemData : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel + { + + } + internal partial interface IFabricModelUpdateSystemDataInternal : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelUpdateSystemData.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelUpdateSystemData.json.cs new file mode 100644 index 000000000000..1fbd7d867d83 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelUpdateSystemData.json.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + public partial class FabricModelUpdateSystemData + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal FabricModelUpdateSystemData(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __systemDataModel = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel(json); + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateSystemData. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateSystemData. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateSystemData FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new FabricModelUpdateSystemData(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __systemDataModel?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelUpdateTags.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelUpdateTags.PowerShell.cs new file mode 100644 index 000000000000..2f446f2a00d6 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelUpdateTags.PowerShell.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Gets or sets the resource tags. + [System.ComponentModel.TypeConverter(typeof(FabricModelUpdateTagsTypeConverter))] + public partial class FabricModelUpdateTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new FabricModelUpdateTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new FabricModelUpdateTags(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal FabricModelUpdateTags(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 FabricModelUpdateTags(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); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Gets or sets the resource tags. + [System.ComponentModel.TypeConverter(typeof(FabricModelUpdateTagsTypeConverter))] + public partial interface IFabricModelUpdateTags + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelUpdateTags.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelUpdateTags.TypeConverter.cs new file mode 100644 index 000000000000..b5fd220eae9d --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelUpdateTags.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class FabricModelUpdateTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return FabricModelUpdateTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return FabricModelUpdateTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return FabricModelUpdateTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelUpdateTags.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelUpdateTags.cs new file mode 100644 index 000000000000..2b3d770e95b9 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelUpdateTags.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Gets or sets the resource tags. + public partial class FabricModelUpdateTags : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateTags, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateTagsInternal + { + + /// Creates an new instance. + public FabricModelUpdateTags() + { + + } + } + /// Gets or sets the resource tags. + public partial interface IFabricModelUpdateTags : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IAssociativeArray + { + + } + /// Gets or sets the resource tags. + internal partial interface IFabricModelUpdateTagsInternal + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelUpdateTags.dictionary.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelUpdateTags.dictionary.cs new file mode 100644 index 000000000000..3a1b115efc15 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelUpdateTags.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + public partial class FabricModelUpdateTags : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Models.Api20210216Preview.FabricModelUpdateTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelUpdateTags.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelUpdateTags.json.cs new file mode 100644 index 000000000000..78e98a8b70a1 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FabricModelUpdateTags.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Gets or sets the resource tags. + public partial class FabricModelUpdateTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + /// + internal FabricModelUpdateTags(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelUpdateTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new FabricModelUpdateTags(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FailoverProtectedItemProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FailoverProtectedItemProperties.PowerShell.cs new file mode 100644 index 000000000000..23a0d4b0d0c8 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FailoverProtectedItemProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Failover properties of the protected item. + [System.ComponentModel.TypeConverter(typeof(FailoverProtectedItemPropertiesTypeConverter))] + public partial class FailoverProtectedItemProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new FailoverProtectedItemProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new FailoverProtectedItemProperties(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal FailoverProtectedItemProperties(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.Migrate.Models.Api20210216Preview.IFailoverProtectedItemPropertiesInternal)this).ProtectedItemName = (string) content.GetValueForProperty("ProtectedItemName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemPropertiesInternal)this).ProtectedItemName, global::System.Convert.ToString); + } + if (content.Contains("VMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemPropertiesInternal)this).VMName = (string) content.GetValueForProperty("VMName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemPropertiesInternal)this).VMName, global::System.Convert.ToString); + } + if (content.Contains("TestVMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemPropertiesInternal)this).TestVMName = (string) content.GetValueForProperty("TestVMName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemPropertiesInternal)this).TestVMName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemPropertiesInternal)this).RecoveryPointId = (string) content.GetValueForProperty("RecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemPropertiesInternal)this).RecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryPointTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemPropertiesInternal)this).RecoveryPointTime = (global::System.DateTime?) content.GetValueForProperty("RecoveryPointTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemPropertiesInternal)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("NetworkName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemPropertiesInternal)this).NetworkName = (string) content.GetValueForProperty("NetworkName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemPropertiesInternal)this).NetworkName, global::System.Convert.ToString); + } + if (content.Contains("Subnet")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemPropertiesInternal)this).Subnet = (string) content.GetValueForProperty("Subnet",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemPropertiesInternal)this).Subnet, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal FailoverProtectedItemProperties(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.Migrate.Models.Api20210216Preview.IFailoverProtectedItemPropertiesInternal)this).ProtectedItemName = (string) content.GetValueForProperty("ProtectedItemName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemPropertiesInternal)this).ProtectedItemName, global::System.Convert.ToString); + } + if (content.Contains("VMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemPropertiesInternal)this).VMName = (string) content.GetValueForProperty("VMName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemPropertiesInternal)this).VMName, global::System.Convert.ToString); + } + if (content.Contains("TestVMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemPropertiesInternal)this).TestVMName = (string) content.GetValueForProperty("TestVMName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemPropertiesInternal)this).TestVMName, global::System.Convert.ToString); + } + if (content.Contains("RecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemPropertiesInternal)this).RecoveryPointId = (string) content.GetValueForProperty("RecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemPropertiesInternal)this).RecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("RecoveryPointTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemPropertiesInternal)this).RecoveryPointTime = (global::System.DateTime?) content.GetValueForProperty("RecoveryPointTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemPropertiesInternal)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("NetworkName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemPropertiesInternal)this).NetworkName = (string) content.GetValueForProperty("NetworkName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemPropertiesInternal)this).NetworkName, global::System.Convert.ToString); + } + if (content.Contains("Subnet")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemPropertiesInternal)this).Subnet = (string) content.GetValueForProperty("Subnet",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemPropertiesInternal)this).Subnet, 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.Migrate.Models.Api20210216Preview.IFailoverProtectedItemProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Failover properties of the protected item. + [System.ComponentModel.TypeConverter(typeof(FailoverProtectedItemPropertiesTypeConverter))] + public partial interface IFailoverProtectedItemProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FailoverProtectedItemProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FailoverProtectedItemProperties.TypeConverter.cs new file mode 100644 index 000000000000..483d245d974d --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FailoverProtectedItemProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class FailoverProtectedItemPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return FailoverProtectedItemProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return FailoverProtectedItemProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return FailoverProtectedItemProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FailoverProtectedItemProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FailoverProtectedItemProperties.cs new file mode 100644 index 000000000000..31def81fb6ae --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FailoverProtectedItemProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Failover properties of the protected item. + public partial class FailoverProtectedItemProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemPropertiesInternal + { + + /// Internal Acessors for NetworkName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemPropertiesInternal.NetworkName { get => this._networkName; set { {_networkName = value;} } } + + /// Internal Acessors for ProtectedItemName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemPropertiesInternal.ProtectedItemName { get => this._protectedItemName; set { {_protectedItemName = value;} } } + + /// Internal Acessors for RecoveryPointId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemPropertiesInternal.RecoveryPointId { get => this._recoveryPointId; set { {_recoveryPointId = value;} } } + + /// Internal Acessors for RecoveryPointTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemPropertiesInternal.RecoveryPointTime { get => this._recoveryPointTime; set { {_recoveryPointTime = value;} } } + + /// Internal Acessors for Subnet + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemPropertiesInternal.Subnet { get => this._subnet; set { {_subnet = value;} } } + + /// Internal Acessors for TestVMName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemPropertiesInternal.TestVMName { get => this._testVMName; set { {_testVMName = value;} } } + + /// Internal Acessors for VMName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemPropertiesInternal.VMName { get => this._vMName; set { {_vMName = value;} } } + + /// Backing field for property. + private string _networkName; + + /// Gets or sets the network name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string NetworkName { get => this._networkName; } + + /// Backing field for property. + private string _protectedItemName; + + /// Gets or sets the protected item name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string ProtectedItemName { get => this._protectedItemName; } + + /// Backing field for property. + private string _recoveryPointId; + + /// Gets or sets the recovery point Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string RecoveryPointId { get => this._recoveryPointId; } + + /// Backing field for property. + private global::System.DateTime? _recoveryPointTime; + + /// Gets or sets the recovery point time. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public global::System.DateTime? RecoveryPointTime { get => this._recoveryPointTime; } + + /// Backing field for property. + private string _subnet; + + /// Gets or sets the network subnet. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Subnet { get => this._subnet; } + + /// Backing field for property. + private string _testVMName; + + /// Gets or sets the test VM name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TestVMName { get => this._testVMName; } + + /// Backing field for property. + private string _vMName; + + /// Gets or sets the VM name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string VMName { get => this._vMName; } + + /// Creates an new instance. + public FailoverProtectedItemProperties() + { + + } + } + /// Failover properties of the protected item. + public partial interface IFailoverProtectedItemProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the network name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the network name.", + SerializedName = @"networkName", + PossibleTypes = new [] { typeof(string) })] + string NetworkName { get; } + /// Gets or sets the protected item name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the protected item name.", + SerializedName = @"protectedItemName", + PossibleTypes = new [] { typeof(string) })] + string ProtectedItemName { get; } + /// Gets or sets the recovery point Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the recovery point Id.", + SerializedName = @"recoveryPointId", + PossibleTypes = new [] { typeof(string) })] + string RecoveryPointId { get; } + /// Gets or sets the recovery point time. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the recovery point time.", + SerializedName = @"recoveryPointTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? RecoveryPointTime { get; } + /// Gets or sets the network subnet. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the network subnet.", + SerializedName = @"subnet", + PossibleTypes = new [] { typeof(string) })] + string Subnet { get; } + /// Gets or sets the test VM name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the test VM name.", + SerializedName = @"testVmName", + PossibleTypes = new [] { typeof(string) })] + string TestVMName { get; } + /// Gets or sets the VM name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the VM name.", + SerializedName = @"vmName", + PossibleTypes = new [] { typeof(string) })] + string VMName { get; } + + } + /// Failover properties of the protected item. + internal partial interface IFailoverProtectedItemPropertiesInternal + + { + /// Gets or sets the network name. + string NetworkName { get; set; } + /// Gets or sets the protected item name. + string ProtectedItemName { get; set; } + /// Gets or sets the recovery point Id. + string RecoveryPointId { get; set; } + /// Gets or sets the recovery point time. + global::System.DateTime? RecoveryPointTime { get; set; } + /// Gets or sets the network subnet. + string Subnet { get; set; } + /// Gets or sets the test VM name. + string TestVMName { get; set; } + /// Gets or sets the VM name. + string VMName { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FailoverProtectedItemProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FailoverProtectedItemProperties.json.cs new file mode 100644 index 000000000000..e796072fe044 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FailoverProtectedItemProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Failover properties of the protected item. + public partial class FailoverProtectedItemProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal FailoverProtectedItemProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_protectedItemName = If( json?.PropertyT("protectedItemName"), out var __jsonProtectedItemName) ? (string)__jsonProtectedItemName : (string)ProtectedItemName;} + {_vMName = If( json?.PropertyT("vmName"), out var __jsonVMName) ? (string)__jsonVMName : (string)VMName;} + {_testVMName = If( json?.PropertyT("testVmName"), out var __jsonTestVMName) ? (string)__jsonTestVMName : (string)TestVMName;} + {_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;} + {_networkName = If( json?.PropertyT("networkName"), out var __jsonNetworkName) ? (string)__jsonNetworkName : (string)NetworkName;} + {_subnet = If( json?.PropertyT("subnet"), out var __jsonSubnet) ? (string)__jsonSubnet : (string)Subnet;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new FailoverProtectedItemProperties(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._protectedItemName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._protectedItemName.ToString()) : null, "protectedItemName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._vMName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._vMName.ToString()) : null, "vmName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._testVMName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._testVMName.ToString()) : null, "testVmName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._recoveryPointId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._recoveryPointId.ToString()) : null, "recoveryPointId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._recoveryPointTime ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._networkName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._networkName.ToString()) : null, "networkName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._subnet)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._subnet.ToString()) : null, "subnet" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FailoverWorkflowModelCustomProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FailoverWorkflowModelCustomProperties.PowerShell.cs new file mode 100644 index 000000000000..92cfe6cda429 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FailoverWorkflowModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Failover workflow model custom properties. + [System.ComponentModel.TypeConverter(typeof(FailoverWorkflowModelCustomPropertiesTypeConverter))] + public partial class FailoverWorkflowModelCustomProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverWorkflowModelCustomProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new FailoverWorkflowModelCustomProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverWorkflowModelCustomProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new FailoverWorkflowModelCustomProperties(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal FailoverWorkflowModelCustomProperties(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.Migrate.Models.Api20210216Preview.IFailoverWorkflowModelCustomPropertiesInternal)this).ProtectedItemDetail = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemProperties[]) content.GetValueForProperty("ProtectedItemDetail",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverWorkflowModelCustomPropertiesInternal)this).ProtectedItemDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FailoverProtectedItemPropertiesTypeConverter.ConvertFrom)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("AffectedObjectDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)this).AffectedObjectDetail = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesAffectedObjectDetails) content.GetValueForProperty("AffectedObjectDetail",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)this).AffectedObjectDetail, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetailsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal FailoverWorkflowModelCustomProperties(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.Migrate.Models.Api20210216Preview.IFailoverWorkflowModelCustomPropertiesInternal)this).ProtectedItemDetail = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemProperties[]) content.GetValueForProperty("ProtectedItemDetail",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverWorkflowModelCustomPropertiesInternal)this).ProtectedItemDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FailoverProtectedItemPropertiesTypeConverter.ConvertFrom)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("AffectedObjectDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)this).AffectedObjectDetail = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesAffectedObjectDetails) content.GetValueForProperty("AffectedObjectDetail",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)this).AffectedObjectDetail, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetailsTypeConverter.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.Migrate.Models.Api20210216Preview.IFailoverWorkflowModelCustomProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Failover workflow model custom properties. + [System.ComponentModel.TypeConverter(typeof(FailoverWorkflowModelCustomPropertiesTypeConverter))] + public partial interface IFailoverWorkflowModelCustomProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FailoverWorkflowModelCustomProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FailoverWorkflowModelCustomProperties.TypeConverter.cs new file mode 100644 index 000000000000..e20c9e383c96 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FailoverWorkflowModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class FailoverWorkflowModelCustomPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverWorkflowModelCustomProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverWorkflowModelCustomProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return FailoverWorkflowModelCustomProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return FailoverWorkflowModelCustomProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return FailoverWorkflowModelCustomProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FailoverWorkflowModelCustomProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FailoverWorkflowModelCustomProperties.cs new file mode 100644 index 000000000000..4575320bcedb --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FailoverWorkflowModelCustomProperties.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Failover workflow model custom properties. + public partial class FailoverWorkflowModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverWorkflowModelCustomProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverWorkflowModelCustomPropertiesInternal, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomProperties __workflowModelCustomProperties = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomProperties(); + + /// Gets or sets any custom properties of the affected object. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesAffectedObjectDetails AffectedObjectDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)__workflowModelCustomProperties).AffectedObjectDetail; } + + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)__workflowModelCustomProperties).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)__workflowModelCustomProperties).InstanceType = value ; } + + /// Internal Acessors for ProtectedItemDetail + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemProperties[] Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverWorkflowModelCustomPropertiesInternal.ProtectedItemDetail { get => this._protectedItemDetail; set { {_protectedItemDetail = value;} } } + + /// Internal Acessors for AffectedObjectDetail + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesAffectedObjectDetails Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal.AffectedObjectDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)__workflowModelCustomProperties).AffectedObjectDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)__workflowModelCustomProperties).AffectedObjectDetail = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemProperties[] _protectedItemDetail; + + /// Gets or sets the failed over protected item details. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemProperties[] ProtectedItemDetail { get => this._protectedItemDetail; } + + /// Creates an new instance. + public FailoverWorkflowModelCustomProperties() + { + + } + + /// 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.Migrate.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__workflowModelCustomProperties), __workflowModelCustomProperties); + await eventListener.AssertObjectIsValid(nameof(__workflowModelCustomProperties), __workflowModelCustomProperties); + } + } + /// Failover workflow model custom properties. + public partial interface IFailoverWorkflowModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomProperties + { + /// Gets or sets the failed over protected item details. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the failed over protected item details.", + SerializedName = @"protectedItemDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemProperties) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemProperties[] ProtectedItemDetail { get; } + + } + /// Failover workflow model custom properties. + internal partial interface IFailoverWorkflowModelCustomPropertiesInternal : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal + { + /// Gets or sets the failed over protected item details. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemProperties[] ProtectedItemDetail { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FailoverWorkflowModelCustomProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FailoverWorkflowModelCustomProperties.json.cs new file mode 100644 index 000000000000..230ac87cf198 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/FailoverWorkflowModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Failover workflow model custom properties. + public partial class FailoverWorkflowModelCustomProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal FailoverWorkflowModelCustomProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __workflowModelCustomProperties = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomProperties(json); + {_protectedItemDetail = If( json?.PropertyT("protectedItemDetails"), out var __jsonProtectedItemDetails) ? If( __jsonProtectedItemDetails as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api20210216Preview.IFailoverProtectedItemProperties) (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FailoverProtectedItemProperties.FromJson(__u) )) ))() : null : ProtectedItemDetail;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverWorkflowModelCustomProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverWorkflowModelCustomProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverWorkflowModelCustomProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new FailoverWorkflowModelCustomProperties(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __workflowModelCustomProperties?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._protectedItemDetail) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HealthErrorModel.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HealthErrorModel.PowerShell.cs new file mode 100644 index 000000000000..c608fc368ff6 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HealthErrorModel.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Health error model. + [System.ComponentModel.TypeConverter(typeof(HealthErrorModelTypeConverter))] + public partial class HealthErrorModel + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HealthErrorModel(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HealthErrorModel(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HealthErrorModel(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AffectedResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).AffectedResourceType = (string) content.GetValueForProperty("AffectedResourceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).AffectedResourceType, global::System.Convert.ToString); + } + if (content.Contains("AffectedResourceCorrelationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).AffectedResourceCorrelationId = (string[]) content.GetValueForProperty("AffectedResourceCorrelationId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).AffectedResourceCorrelationId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("ChildError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).ChildError = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModel[]) content.GetValueForProperty("ChildError",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).ChildError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.InnerHealthErrorModelTypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("HealthCategory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).HealthCategory = (string) content.GetValueForProperty("HealthCategory",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).HealthCategory, global::System.Convert.ToString); + } + if (content.Contains("Category")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).Category = (string) content.GetValueForProperty("Category",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).Category, global::System.Convert.ToString); + } + if (content.Contains("Severity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).Severity = (string) content.GetValueForProperty("Severity",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).Severity, global::System.Convert.ToString); + } + if (content.Contains("Source")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).Source = (string) content.GetValueForProperty("Source",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).Source, global::System.Convert.ToString); + } + if (content.Contains("CreationTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).CreationTime = (global::System.DateTime?) content.GetValueForProperty("CreationTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)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("IsCustomerResolvable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).IsCustomerResolvable = (bool?) content.GetValueForProperty("IsCustomerResolvable",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).IsCustomerResolvable, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("Summary")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).Summary = (string) content.GetValueForProperty("Summary",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).Summary, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Caus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).Caus = (string) content.GetValueForProperty("Caus",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).Caus, global::System.Convert.ToString); + } + if (content.Contains("Recommendation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).Recommendation = (string) content.GetValueForProperty("Recommendation",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).Recommendation, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HealthErrorModel(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("AffectedResourceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).AffectedResourceType = (string) content.GetValueForProperty("AffectedResourceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).AffectedResourceType, global::System.Convert.ToString); + } + if (content.Contains("AffectedResourceCorrelationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).AffectedResourceCorrelationId = (string[]) content.GetValueForProperty("AffectedResourceCorrelationId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).AffectedResourceCorrelationId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("ChildError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).ChildError = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModel[]) content.GetValueForProperty("ChildError",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).ChildError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.InnerHealthErrorModelTypeConverter.ConvertFrom)); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("HealthCategory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).HealthCategory = (string) content.GetValueForProperty("HealthCategory",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).HealthCategory, global::System.Convert.ToString); + } + if (content.Contains("Category")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).Category = (string) content.GetValueForProperty("Category",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).Category, global::System.Convert.ToString); + } + if (content.Contains("Severity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).Severity = (string) content.GetValueForProperty("Severity",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).Severity, global::System.Convert.ToString); + } + if (content.Contains("Source")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).Source = (string) content.GetValueForProperty("Source",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).Source, global::System.Convert.ToString); + } + if (content.Contains("CreationTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).CreationTime = (global::System.DateTime?) content.GetValueForProperty("CreationTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)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("IsCustomerResolvable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).IsCustomerResolvable = (bool?) content.GetValueForProperty("IsCustomerResolvable",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).IsCustomerResolvable, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("Summary")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).Summary = (string) content.GetValueForProperty("Summary",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).Summary, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Caus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).Caus = (string) content.GetValueForProperty("Caus",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).Caus, global::System.Convert.ToString); + } + if (content.Contains("Recommendation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).Recommendation = (string) content.GetValueForProperty("Recommendation",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal)this).Recommendation, 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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Health error model. + [System.ComponentModel.TypeConverter(typeof(HealthErrorModelTypeConverter))] + public partial interface IHealthErrorModel + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HealthErrorModel.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HealthErrorModel.TypeConverter.cs new file mode 100644 index 000000000000..5462a1fbe075 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HealthErrorModel.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HealthErrorModelTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HealthErrorModel.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HealthErrorModel.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HealthErrorModel.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HealthErrorModel.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HealthErrorModel.cs new file mode 100644 index 000000000000..58e22c9832ce --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HealthErrorModel.cs @@ -0,0 +1,319 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Health error model. + public partial class HealthErrorModel : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal + { + + /// Backing field for property. + private string[] _affectedResourceCorrelationId; + + /// + /// Gets or sets 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.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string[] AffectedResourceCorrelationId { get => this._affectedResourceCorrelationId; set => this._affectedResourceCorrelationId = value; } + + /// Backing field for property. + private string _affectedResourceType; + + /// Gets or sets the type of affected resource type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string AffectedResourceType { get => this._affectedResourceType; set => this._affectedResourceType = value; } + + /// Backing field for property. + private string _category; + + /// Gets or sets the error category. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Category { get => this._category; } + + /// Backing field for property. + private string _caus; + + /// Gets or sets possible causes of the error. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Caus { get => this._caus; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModel[] _childError; + + /// Gets or sets a list of child health errors associated with this error. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModel[] ChildError { get => this._childError; set => this._childError = value; } + + /// Backing field for property. + private string _code; + + /// Gets or sets the error code. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Code { get => this._code; } + + /// Backing field for property. + private global::System.DateTime? _creationTime; + + /// Gets or sets the error creation time. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public global::System.DateTime? CreationTime { get => this._creationTime; } + + /// Backing field for property. + private string _healthCategory; + + /// Gets or sets the health category. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string HealthCategory { get => this._healthCategory; } + + /// Backing field for property. + private bool? _isCustomerResolvable; + + /// Gets or sets a value indicating whether the error is customer resolvable. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public bool? IsCustomerResolvable { get => this._isCustomerResolvable; } + + /// Backing field for property. + private string _message; + + /// Gets or sets the error message. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Message { get => this._message; } + + /// Internal Acessors for Category + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal.Category { get => this._category; set { {_category = value;} } } + + /// Internal Acessors for Caus + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal.Caus { get => this._caus; set { {_caus = value;} } } + + /// Internal Acessors for Code + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal.Code { get => this._code; set { {_code = value;} } } + + /// Internal Acessors for CreationTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal.CreationTime { get => this._creationTime; set { {_creationTime = value;} } } + + /// Internal Acessors for HealthCategory + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal.HealthCategory { get => this._healthCategory; set { {_healthCategory = value;} } } + + /// Internal Acessors for IsCustomerResolvable + bool? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal.IsCustomerResolvable { get => this._isCustomerResolvable; set { {_isCustomerResolvable = value;} } } + + /// Internal Acessors for Message + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal.Message { get => this._message; set { {_message = value;} } } + + /// Internal Acessors for Recommendation + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal.Recommendation { get => this._recommendation; set { {_recommendation = value;} } } + + /// Internal Acessors for Severity + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal.Severity { get => this._severity; set { {_severity = value;} } } + + /// Internal Acessors for Source + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal.Source { get => this._source; set { {_source = value;} } } + + /// Internal Acessors for Summary + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModelInternal.Summary { get => this._summary; set { {_summary = value;} } } + + /// Backing field for property. + private string _recommendation; + + /// Gets or sets recommended action to resolve the error. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Recommendation { get => this._recommendation; } + + /// Backing field for property. + private string _severity; + + /// Gets or sets the error severity. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Severity { get => this._severity; } + + /// Backing field for property. + private string _source; + + /// Gets or sets the error source. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Source { get => this._source; } + + /// Backing field for property. + private string _summary; + + /// Gets or sets the error summary. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Summary { get => this._summary; } + + /// Creates an new instance. + public HealthErrorModel() + { + + } + } + /// Health error model. + public partial interface IHealthErrorModel : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// + /// Gets or sets 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.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets 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; } + /// Gets or sets the type of affected resource type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the type of affected resource type.", + SerializedName = @"affectedResourceType", + PossibleTypes = new [] { typeof(string) })] + string AffectedResourceType { get; set; } + /// Gets or sets the error category. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the error category.", + SerializedName = @"category", + PossibleTypes = new [] { typeof(string) })] + string Category { get; } + /// Gets or sets possible causes of the error. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets possible causes of the error.", + SerializedName = @"causes", + PossibleTypes = new [] { typeof(string) })] + string Caus { get; } + /// Gets or sets a list of child health errors associated with this error. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets a list of child health errors associated with this error.", + SerializedName = @"childErrors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModel) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModel[] ChildError { get; set; } + /// Gets or sets the error code. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the error code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string Code { get; } + /// Gets or sets the error creation time. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the error creation time.", + SerializedName = @"creationTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? CreationTime { get; } + /// Gets or sets the health category. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the health category.", + SerializedName = @"healthCategory", + PossibleTypes = new [] { typeof(string) })] + string HealthCategory { get; } + /// Gets or sets a value indicating whether the error is customer resolvable. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets a value indicating whether the error is customer resolvable.", + SerializedName = @"isCustomerResolvable", + PossibleTypes = new [] { typeof(bool) })] + bool? IsCustomerResolvable { get; } + /// Gets or sets the error message. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the error message.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; } + /// Gets or sets recommended action to resolve the error. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets recommended action to resolve the error.", + SerializedName = @"recommendation", + PossibleTypes = new [] { typeof(string) })] + string Recommendation { get; } + /// Gets or sets the error severity. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the error severity.", + SerializedName = @"severity", + PossibleTypes = new [] { typeof(string) })] + string Severity { get; } + /// Gets or sets the error source. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the error source.", + SerializedName = @"source", + PossibleTypes = new [] { typeof(string) })] + string Source { get; } + /// Gets or sets the error summary. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the error summary.", + SerializedName = @"summary", + PossibleTypes = new [] { typeof(string) })] + string Summary { get; } + + } + /// Health error model. + internal partial interface IHealthErrorModelInternal + + { + /// + /// Gets or sets 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; } + /// Gets or sets the type of affected resource type. + string AffectedResourceType { get; set; } + /// Gets or sets the error category. + string Category { get; set; } + /// Gets or sets possible causes of the error. + string Caus { get; set; } + /// Gets or sets a list of child health errors associated with this error. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModel[] ChildError { get; set; } + /// Gets or sets the error code. + string Code { get; set; } + /// Gets or sets the error creation time. + global::System.DateTime? CreationTime { get; set; } + /// Gets or sets the health category. + string HealthCategory { get; set; } + /// Gets or sets a value indicating whether the error is customer resolvable. + bool? IsCustomerResolvable { get; set; } + /// Gets or sets the error message. + string Message { get; set; } + /// Gets or sets recommended action to resolve the error. + string Recommendation { get; set; } + /// Gets or sets the error severity. + string Severity { get; set; } + /// Gets or sets the error source. + string Source { get; set; } + /// Gets or sets the error summary. + string Summary { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HealthErrorModel.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HealthErrorModel.json.cs new file mode 100644 index 000000000000..550738b445ed --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HealthErrorModel.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Health error model. + public partial class HealthErrorModel + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new HealthErrorModel(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal HealthErrorModel(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_affectedResourceType = If( json?.PropertyT("affectedResourceType"), out var __jsonAffectedResourceType) ? (string)__jsonAffectedResourceType : (string)AffectedResourceType;} + {_affectedResourceCorrelationId = If( json?.PropertyT("affectedResourceCorrelationIds"), out var __jsonAffectedResourceCorrelationIds) ? If( __jsonAffectedResourceCorrelationIds as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : AffectedResourceCorrelationId;} + {_childError = If( json?.PropertyT("childErrors"), out var __jsonChildErrors) ? If( __jsonChildErrors as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api20210216Preview.IInnerHealthErrorModel) (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.InnerHealthErrorModel.FromJson(__p) )) ))() : null : ChildError;} + {_code = If( json?.PropertyT("code"), out var __jsonCode) ? (string)__jsonCode : (string)Code;} + {_healthCategory = If( json?.PropertyT("healthCategory"), out var __jsonHealthCategory) ? (string)__jsonHealthCategory : (string)HealthCategory;} + {_category = If( json?.PropertyT("category"), out var __jsonCategory) ? (string)__jsonCategory : (string)Category;} + {_severity = If( json?.PropertyT("severity"), out var __jsonSeverity) ? (string)__jsonSeverity : (string)Severity;} + {_source = If( json?.PropertyT("source"), out var __jsonSource) ? (string)__jsonSource : (string)Source;} + {_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;} + {_isCustomerResolvable = If( json?.PropertyT("isCustomerResolvable"), out var __jsonIsCustomerResolvable) ? (bool?)__jsonIsCustomerResolvable : IsCustomerResolvable;} + {_summary = If( json?.PropertyT("summary"), out var __jsonSummary) ? (string)__jsonSummary : (string)Summary;} + {_message = If( json?.PropertyT("message"), out var __jsonMessage) ? (string)__jsonMessage : (string)Message;} + {_caus = If( json?.PropertyT("causes"), out var __jsonCauses) ? (string)__jsonCauses : (string)Caus;} + {_recommendation = If( json?.PropertyT("recommendation"), out var __jsonRecommendation) ? (string)__jsonRecommendation : (string)Recommendation;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._affectedResourceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._affectedResourceType.ToString()) : null, "affectedResourceType" ,container.Add ); + if (null != this._affectedResourceCorrelationId) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.XNodeArray(); + foreach( var __x in this._affectedResourceCorrelationId ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("affectedResourceCorrelationIds",__w); + } + if (null != this._childError) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.XNodeArray(); + foreach( var __s in this._childError ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("childErrors",__r); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._code)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._code.ToString()) : null, "code" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._healthCategory)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._healthCategory.ToString()) : null, "healthCategory" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._category)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._category.ToString()) : null, "category" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._severity)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._severity.ToString()) : null, "severity" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._source)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._source.ToString()) : null, "source" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._creationTime ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._creationTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "creationTime" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._isCustomerResolvable ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonBoolean((bool)this._isCustomerResolvable) : null, "isCustomerResolvable" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._summary)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._summary.ToString()) : null, "summary" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._message)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._message.ToString()) : null, "message" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._caus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._caus.ToString()) : null, "causes" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._recommendation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._recommendation.ToString()) : null, "recommendation" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVMigrateFabricModelCustomProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVMigrateFabricModelCustomProperties.PowerShell.cs new file mode 100644 index 000000000000..f25ede3ddd4d --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVMigrateFabricModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// HyperV migrate fabric model custom properties. + [System.ComponentModel.TypeConverter(typeof(HyperVMigrateFabricModelCustomPropertiesTypeConverter))] + public partial class HyperVMigrateFabricModelCustomProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVMigrateFabricModelCustomProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVMigrateFabricModelCustomProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVMigrateFabricModelCustomProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVMigrateFabricModelCustomProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVMigrateFabricModelCustomProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVMigrateFabricModelCustomProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("HyperVSiteId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVMigrateFabricModelCustomPropertiesInternal)this).HyperVSiteId = (string) content.GetValueForProperty("HyperVSiteId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVMigrateFabricModelCustomPropertiesInternal)this).HyperVSiteId, global::System.Convert.ToString); + } + if (content.Contains("FabricResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVMigrateFabricModelCustomPropertiesInternal)this).FabricResourceId = (string) content.GetValueForProperty("FabricResourceId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVMigrateFabricModelCustomPropertiesInternal)this).FabricResourceId, global::System.Convert.ToString); + } + if (content.Contains("FabricContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVMigrateFabricModelCustomPropertiesInternal)this).FabricContainerId = (string) content.GetValueForProperty("FabricContainerId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVMigrateFabricModelCustomPropertiesInternal)this).FabricContainerId, global::System.Convert.ToString); + } + if (content.Contains("MigrationSolutionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVMigrateFabricModelCustomPropertiesInternal)this).MigrationSolutionId = (string) content.GetValueForProperty("MigrationSolutionId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVMigrateFabricModelCustomPropertiesInternal)this).MigrationSolutionId, global::System.Convert.ToString); + } + if (content.Contains("MigrationHubUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVMigrateFabricModelCustomPropertiesInternal)this).MigrationHubUri = (string) content.GetValueForProperty("MigrationHubUri",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVMigrateFabricModelCustomPropertiesInternal)this).MigrationHubUri, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCustomPropertiesInternal)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 HyperVMigrateFabricModelCustomProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("HyperVSiteId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVMigrateFabricModelCustomPropertiesInternal)this).HyperVSiteId = (string) content.GetValueForProperty("HyperVSiteId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVMigrateFabricModelCustomPropertiesInternal)this).HyperVSiteId, global::System.Convert.ToString); + } + if (content.Contains("FabricResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVMigrateFabricModelCustomPropertiesInternal)this).FabricResourceId = (string) content.GetValueForProperty("FabricResourceId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVMigrateFabricModelCustomPropertiesInternal)this).FabricResourceId, global::System.Convert.ToString); + } + if (content.Contains("FabricContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVMigrateFabricModelCustomPropertiesInternal)this).FabricContainerId = (string) content.GetValueForProperty("FabricContainerId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVMigrateFabricModelCustomPropertiesInternal)this).FabricContainerId, global::System.Convert.ToString); + } + if (content.Contains("MigrationSolutionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVMigrateFabricModelCustomPropertiesInternal)this).MigrationSolutionId = (string) content.GetValueForProperty("MigrationSolutionId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVMigrateFabricModelCustomPropertiesInternal)this).MigrationSolutionId, global::System.Convert.ToString); + } + if (content.Contains("MigrationHubUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVMigrateFabricModelCustomPropertiesInternal)this).MigrationHubUri = (string) content.GetValueForProperty("MigrationHubUri",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVMigrateFabricModelCustomPropertiesInternal)this).MigrationHubUri, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCustomPropertiesInternal)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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// HyperV migrate fabric model custom properties. + [System.ComponentModel.TypeConverter(typeof(HyperVMigrateFabricModelCustomPropertiesTypeConverter))] + public partial interface IHyperVMigrateFabricModelCustomProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVMigrateFabricModelCustomProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVMigrateFabricModelCustomProperties.TypeConverter.cs new file mode 100644 index 000000000000..2ea40b931cbb --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVMigrateFabricModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVMigrateFabricModelCustomPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVMigrateFabricModelCustomProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVMigrateFabricModelCustomProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVMigrateFabricModelCustomProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVMigrateFabricModelCustomProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVMigrateFabricModelCustomProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVMigrateFabricModelCustomProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVMigrateFabricModelCustomProperties.cs new file mode 100644 index 000000000000..c219284163ce --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVMigrateFabricModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// HyperV migrate fabric model custom properties. + public partial class HyperVMigrateFabricModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVMigrateFabricModelCustomProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVMigrateFabricModelCustomPropertiesInternal, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCustomProperties __fabricModelCustomProperties = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelCustomProperties(); + + /// Backing field for property. + private string _fabricContainerId; + + /// Gets or sets the fabric container Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string FabricContainerId { get => this._fabricContainerId; } + + /// Backing field for property. + private string _fabricResourceId; + + /// Gets or sets the fabric resource Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string FabricResourceId { get => this._fabricResourceId; } + + /// Backing field for property. + private string _hyperVSiteId; + + /// Gets or sets the ARM Id of the HyperV site. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string HyperVSiteId { get => this._hyperVSiteId; set => this._hyperVSiteId = value; } + + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCustomPropertiesInternal)__fabricModelCustomProperties).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCustomPropertiesInternal)__fabricModelCustomProperties).InstanceType = value ; } + + /// Internal Acessors for FabricContainerId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVMigrateFabricModelCustomPropertiesInternal.FabricContainerId { get => this._fabricContainerId; set { {_fabricContainerId = value;} } } + + /// Internal Acessors for FabricResourceId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVMigrateFabricModelCustomPropertiesInternal.FabricResourceId { get => this._fabricResourceId; set { {_fabricResourceId = value;} } } + + /// Internal Acessors for MigrationHubUri + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVMigrateFabricModelCustomPropertiesInternal.MigrationHubUri { get => this._migrationHubUri; set { {_migrationHubUri = value;} } } + + /// Backing field for property. + private string _migrationHubUri; + + /// Gets or sets the migration hub Uri. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string MigrationHubUri { get => this._migrationHubUri; } + + /// Backing field for property. + private string _migrationSolutionId; + + /// Gets or sets the migration solution ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string MigrationSolutionId { get => this._migrationSolutionId; set => this._migrationSolutionId = value; } + + /// + /// Creates an new instance. + /// + public HyperVMigrateFabricModelCustomProperties() + { + + } + + /// 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.Migrate.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__fabricModelCustomProperties), __fabricModelCustomProperties); + await eventListener.AssertObjectIsValid(nameof(__fabricModelCustomProperties), __fabricModelCustomProperties); + } + } + /// HyperV migrate fabric model custom properties. + public partial interface IHyperVMigrateFabricModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCustomProperties + { + /// Gets or sets the fabric container Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the fabric container Id.", + SerializedName = @"fabricContainerId", + PossibleTypes = new [] { typeof(string) })] + string FabricContainerId { get; } + /// Gets or sets the fabric resource Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the fabric resource Id.", + SerializedName = @"fabricResourceId", + PossibleTypes = new [] { typeof(string) })] + string FabricResourceId { get; } + /// Gets or sets the ARM Id of the HyperV site. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the ARM Id of the HyperV site.", + SerializedName = @"hyperVSiteId", + PossibleTypes = new [] { typeof(string) })] + string HyperVSiteId { get; set; } + /// Gets or sets the migration hub Uri. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the migration hub Uri.", + SerializedName = @"migrationHubUri", + PossibleTypes = new [] { typeof(string) })] + string MigrationHubUri { get; } + /// Gets or sets the migration solution ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the migration solution ARM Id.", + SerializedName = @"migrationSolutionId", + PossibleTypes = new [] { typeof(string) })] + string MigrationSolutionId { get; set; } + + } + /// HyperV migrate fabric model custom properties. + internal partial interface IHyperVMigrateFabricModelCustomPropertiesInternal : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCustomPropertiesInternal + { + /// Gets or sets the fabric container Id. + string FabricContainerId { get; set; } + /// Gets or sets the fabric resource Id. + string FabricResourceId { get; set; } + /// Gets or sets the ARM Id of the HyperV site. + string HyperVSiteId { get; set; } + /// Gets or sets the migration hub Uri. + string MigrationHubUri { get; set; } + /// Gets or sets the migration solution ARM Id. + string MigrationSolutionId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVMigrateFabricModelCustomProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVMigrateFabricModelCustomProperties.json.cs new file mode 100644 index 000000000000..16837adda172 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVMigrateFabricModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// HyperV migrate fabric model custom properties. + public partial class HyperVMigrateFabricModelCustomProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVMigrateFabricModelCustomProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVMigrateFabricModelCustomProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVMigrateFabricModelCustomProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new HyperVMigrateFabricModelCustomProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal HyperVMigrateFabricModelCustomProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __fabricModelCustomProperties = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelCustomProperties(json); + {_hyperVSiteId = If( json?.PropertyT("hyperVSiteId"), out var __jsonHyperVSiteId) ? (string)__jsonHyperVSiteId : (string)HyperVSiteId;} + {_fabricResourceId = If( json?.PropertyT("fabricResourceId"), out var __jsonFabricResourceId) ? (string)__jsonFabricResourceId : (string)FabricResourceId;} + {_fabricContainerId = If( json?.PropertyT("fabricContainerId"), out var __jsonFabricContainerId) ? (string)__jsonFabricContainerId : (string)FabricContainerId;} + {_migrationSolutionId = If( json?.PropertyT("migrationSolutionId"), out var __jsonMigrationSolutionId) ? (string)__jsonMigrationSolutionId : (string)MigrationSolutionId;} + {_migrationHubUri = If( json?.PropertyT("migrationHubUri"), out var __jsonMigrationHubUri) ? (string)__jsonMigrationHubUri : (string)MigrationHubUri;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __fabricModelCustomProperties?.ToJson(container, serializationMode); + AddIf( null != (((object)this._hyperVSiteId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._hyperVSiteId.ToString()) : null, "hyperVSiteId" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._fabricResourceId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._fabricResourceId.ToString()) : null, "fabricResourceId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._fabricContainerId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._fabricContainerId.ToString()) : null, "fabricContainerId" ,container.Add ); + } + AddIf( null != (((object)this._migrationSolutionId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._migrationSolutionId.ToString()) : null, "migrationSolutionId" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._migrationHubUri)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._migrationHubUri.ToString()) : null, "migrationHubUri" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcidiskInput.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcidiskInput.PowerShell.cs new file mode 100644 index 000000000000..c9c32140fade --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcidiskInput.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// HyperVToAzStack disk input. + [System.ComponentModel.TypeConverter(typeof(HyperVToAzStackHcidiskInputTypeConverter))] + public partial class HyperVToAzStackHcidiskInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcidiskInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVToAzStackHcidiskInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcidiskInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVToAzStackHcidiskInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcidiskInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVToAzStackHcidiskInput(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.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcidiskInputInternal)this).DiskId = (string) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcidiskInputInternal)this).DiskId, global::System.Convert.ToString); + } + if (content.Contains("StorageContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcidiskInputInternal)this).StorageContainerId = (string) content.GetValueForProperty("StorageContainerId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcidiskInputInternal)this).StorageContainerId, global::System.Convert.ToString); + } + if (content.Contains("IsDynamic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcidiskInputInternal)this).IsDynamic = (bool?) content.GetValueForProperty("IsDynamic",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcidiskInputInternal)this).IsDynamic, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("DiskSizeGb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcidiskInputInternal)this).DiskSizeGb = (long) content.GetValueForProperty("DiskSizeGb",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcidiskInputInternal)this).DiskSizeGb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("DiskFileFormat")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcidiskInputInternal)this).DiskFileFormat = (string) content.GetValueForProperty("DiskFileFormat",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcidiskInputInternal)this).DiskFileFormat, global::System.Convert.ToString); + } + if (content.Contains("IsOSDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcidiskInputInternal)this).IsOSDisk = (bool) content.GetValueForProperty("IsOSDisk",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcidiskInputInternal)this).IsOSDisk, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HyperVToAzStackHcidiskInput(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.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcidiskInputInternal)this).DiskId = (string) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcidiskInputInternal)this).DiskId, global::System.Convert.ToString); + } + if (content.Contains("StorageContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcidiskInputInternal)this).StorageContainerId = (string) content.GetValueForProperty("StorageContainerId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcidiskInputInternal)this).StorageContainerId, global::System.Convert.ToString); + } + if (content.Contains("IsDynamic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcidiskInputInternal)this).IsDynamic = (bool?) content.GetValueForProperty("IsDynamic",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcidiskInputInternal)this).IsDynamic, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("DiskSizeGb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcidiskInputInternal)this).DiskSizeGb = (long) content.GetValueForProperty("DiskSizeGb",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcidiskInputInternal)this).DiskSizeGb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("DiskFileFormat")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcidiskInputInternal)this).DiskFileFormat = (string) content.GetValueForProperty("DiskFileFormat",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcidiskInputInternal)this).DiskFileFormat, global::System.Convert.ToString); + } + if (content.Contains("IsOSDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcidiskInputInternal)this).IsOSDisk = (bool) content.GetValueForProperty("IsOSDisk",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcidiskInputInternal)this).IsOSDisk, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// HyperVToAzStack disk input. + [System.ComponentModel.TypeConverter(typeof(HyperVToAzStackHcidiskInputTypeConverter))] + public partial interface IHyperVToAzStackHcidiskInput + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcidiskInput.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcidiskInput.TypeConverter.cs new file mode 100644 index 000000000000..dfa09e48783d --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcidiskInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVToAzStackHcidiskInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcidiskInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcidiskInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVToAzStackHcidiskInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVToAzStackHcidiskInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVToAzStackHcidiskInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcidiskInput.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcidiskInput.cs new file mode 100644 index 000000000000..5708de562940 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcidiskInput.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// HyperVToAzStack disk input. + public partial class HyperVToAzStackHcidiskInput : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcidiskInput, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcidiskInputInternal + { + + /// Backing field for property. + private string _diskFileFormat; + + /// Gets or sets the type of the virtual hard disk, vhd or vhdx. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string DiskFileFormat { get => this._diskFileFormat; set => this._diskFileFormat = value; } + + /// Backing field for property. + private string _diskId; + + /// Gets or sets the disk Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string DiskId { get => this._diskId; set => this._diskId = value; } + + /// Backing field for property. + private long _diskSizeGb; + + /// Gets or sets the disk size in GB. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public long DiskSizeGb { get => this._diskSizeGb; set => this._diskSizeGb = value; } + + /// Backing field for property. + private bool? _isDynamic; + + /// + /// Gets or sets a value indicating whether dynamic sizing is enabled on the virtual hard + /// disk. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public bool? IsDynamic { get => this._isDynamic; set => this._isDynamic = value; } + + /// Backing field for property. + private bool _isOSDisk; + + /// Gets or sets a value indicating whether disk is os disk. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public bool IsOSDisk { get => this._isOSDisk; set => this._isOSDisk = value; } + + /// Backing field for property. + private string _storageContainerId; + + /// Gets or sets the target storage account ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string StorageContainerId { get => this._storageContainerId; set => this._storageContainerId = value; } + + /// Creates an new instance. + public HyperVToAzStackHcidiskInput() + { + + } + } + /// HyperVToAzStack disk input. + public partial interface IHyperVToAzStackHcidiskInput : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the type of the virtual hard disk, vhd or vhdx. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the type of the virtual hard disk, vhd or vhdx.", + SerializedName = @"diskFileFormat", + PossibleTypes = new [] { typeof(string) })] + string DiskFileFormat { get; set; } + /// Gets or sets the disk Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the disk Id.", + SerializedName = @"diskId", + PossibleTypes = new [] { typeof(string) })] + string DiskId { get; set; } + /// Gets or sets the disk size in GB. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the disk size in GB.", + SerializedName = @"diskSizeGB", + PossibleTypes = new [] { typeof(long) })] + long DiskSizeGb { get; set; } + /// + /// Gets or sets a value indicating whether dynamic sizing is enabled on the virtual hard + /// disk. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets a value indicating whether dynamic sizing is enabled on the virtual hard + disk.", + SerializedName = @"isDynamic", + PossibleTypes = new [] { typeof(bool) })] + bool? IsDynamic { get; set; } + /// Gets or sets a value indicating whether disk is os disk. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets a value indicating whether disk is os disk.", + SerializedName = @"isOsDisk", + PossibleTypes = new [] { typeof(bool) })] + bool IsOSDisk { get; set; } + /// Gets or sets the target storage account ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the target storage account ARM Id.", + SerializedName = @"storageContainerId", + PossibleTypes = new [] { typeof(string) })] + string StorageContainerId { get; set; } + + } + /// HyperVToAzStack disk input. + internal partial interface IHyperVToAzStackHcidiskInputInternal + + { + /// Gets or sets the type of the virtual hard disk, vhd or vhdx. + string DiskFileFormat { get; set; } + /// Gets or sets the disk Id. + string DiskId { get; set; } + /// Gets or sets the disk size in GB. + long DiskSizeGb { get; set; } + /// + /// Gets or sets a value indicating whether dynamic sizing is enabled on the virtual hard + /// disk. + /// + bool? IsDynamic { get; set; } + /// Gets or sets a value indicating whether disk is os disk. + bool IsOSDisk { get; set; } + /// Gets or sets the target storage account ARM Id. + string StorageContainerId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcidiskInput.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcidiskInput.json.cs new file mode 100644 index 000000000000..820854cb6534 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcidiskInput.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// HyperVToAzStack disk input. + public partial class HyperVToAzStackHcidiskInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcidiskInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcidiskInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcidiskInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new HyperVToAzStackHcidiskInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal HyperVToAzStackHcidiskInput(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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;} + {_storageContainerId = If( json?.PropertyT("storageContainerId"), out var __jsonStorageContainerId) ? (string)__jsonStorageContainerId : (string)StorageContainerId;} + {_isDynamic = If( json?.PropertyT("isDynamic"), out var __jsonIsDynamic) ? (bool?)__jsonIsDynamic : IsDynamic;} + {_diskSizeGb = If( json?.PropertyT("diskSizeGB"), out var __jsonDiskSizeGb) ? (long)__jsonDiskSizeGb : DiskSizeGb;} + {_diskFileFormat = If( json?.PropertyT("diskFileFormat"), out var __jsonDiskFileFormat) ? (string)__jsonDiskFileFormat : (string)DiskFileFormat;} + {_isOSDisk = If( json?.PropertyT("isOsDisk"), out var __jsonIsOSDisk) ? (bool)__jsonIsOSDisk : IsOSDisk;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._diskId.ToString()) : null, "diskId" ,container.Add ); + AddIf( null != (((object)this._storageContainerId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._storageContainerId.ToString()) : null, "storageContainerId" ,container.Add ); + AddIf( null != this._isDynamic ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonBoolean((bool)this._isDynamic) : null, "isDynamic" ,container.Add ); + AddIf( (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNumber(this._diskSizeGb), "diskSizeGB" ,container.Add ); + AddIf( null != (((object)this._diskFileFormat)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._diskFileFormat.ToString()) : null, "diskFileFormat" ,container.Add ); + AddIf( (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonBoolean(this._isOSDisk), "isOsDisk" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcieventModelCustomProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcieventModelCustomProperties.PowerShell.cs new file mode 100644 index 000000000000..cc08cde584bd --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcieventModelCustomProperties.PowerShell.cs @@ -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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// HyperV to AzStackHCI event model custom properties. This class provides provider specific + /// details for events of type DataContract.HealthEvents.HealthEventType.ProtectedItemHealth and + /// DataContract.HealthEvents.HealthEventType.AgentHealth. + /// + [System.ComponentModel.TypeConverter(typeof(HyperVToAzStackHcieventModelCustomPropertiesTypeConverter))] + public partial class HyperVToAzStackHcieventModelCustomProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcieventModelCustomProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVToAzStackHcieventModelCustomProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcieventModelCustomProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVToAzStackHcieventModelCustomProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcieventModelCustomProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVToAzStackHcieventModelCustomProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("EventSourceFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcieventModelCustomPropertiesInternal)this).EventSourceFriendlyName = (string) content.GetValueForProperty("EventSourceFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcieventModelCustomPropertiesInternal)this).EventSourceFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("ProtectedItemFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcieventModelCustomPropertiesInternal)this).ProtectedItemFriendlyName = (string) content.GetValueForProperty("ProtectedItemFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcieventModelCustomPropertiesInternal)this).ProtectedItemFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("SourceApplianceName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcieventModelCustomPropertiesInternal)this).SourceApplianceName = (string) content.GetValueForProperty("SourceApplianceName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcieventModelCustomPropertiesInternal)this).SourceApplianceName, global::System.Convert.ToString); + } + if (content.Contains("TargetApplianceName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcieventModelCustomPropertiesInternal)this).TargetApplianceName = (string) content.GetValueForProperty("TargetApplianceName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcieventModelCustomPropertiesInternal)this).TargetApplianceName, global::System.Convert.ToString); + } + if (content.Contains("ServerType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcieventModelCustomPropertiesInternal)this).ServerType = (string) content.GetValueForProperty("ServerType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcieventModelCustomPropertiesInternal)this).ServerType, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCustomPropertiesInternal)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 HyperVToAzStackHcieventModelCustomProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("EventSourceFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcieventModelCustomPropertiesInternal)this).EventSourceFriendlyName = (string) content.GetValueForProperty("EventSourceFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcieventModelCustomPropertiesInternal)this).EventSourceFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("ProtectedItemFriendlyName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcieventModelCustomPropertiesInternal)this).ProtectedItemFriendlyName = (string) content.GetValueForProperty("ProtectedItemFriendlyName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcieventModelCustomPropertiesInternal)this).ProtectedItemFriendlyName, global::System.Convert.ToString); + } + if (content.Contains("SourceApplianceName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcieventModelCustomPropertiesInternal)this).SourceApplianceName = (string) content.GetValueForProperty("SourceApplianceName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcieventModelCustomPropertiesInternal)this).SourceApplianceName, global::System.Convert.ToString); + } + if (content.Contains("TargetApplianceName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcieventModelCustomPropertiesInternal)this).TargetApplianceName = (string) content.GetValueForProperty("TargetApplianceName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcieventModelCustomPropertiesInternal)this).TargetApplianceName, global::System.Convert.ToString); + } + if (content.Contains("ServerType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcieventModelCustomPropertiesInternal)this).ServerType = (string) content.GetValueForProperty("ServerType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcieventModelCustomPropertiesInternal)this).ServerType, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCustomPropertiesInternal)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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// HyperV to AzStackHCI event model custom properties. This class provides provider specific + /// details for events of type DataContract.HealthEvents.HealthEventType.ProtectedItemHealth and + /// DataContract.HealthEvents.HealthEventType.AgentHealth. + [System.ComponentModel.TypeConverter(typeof(HyperVToAzStackHcieventModelCustomPropertiesTypeConverter))] + public partial interface IHyperVToAzStackHcieventModelCustomProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcieventModelCustomProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcieventModelCustomProperties.TypeConverter.cs new file mode 100644 index 000000000000..7792635ed218 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcieventModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVToAzStackHcieventModelCustomPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcieventModelCustomProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcieventModelCustomProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVToAzStackHcieventModelCustomProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVToAzStackHcieventModelCustomProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVToAzStackHcieventModelCustomProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcieventModelCustomProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcieventModelCustomProperties.cs new file mode 100644 index 000000000000..159e7039addb --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcieventModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// + /// HyperV to AzStackHCI event model custom properties. This class provides provider specific + /// details for events of type DataContract.HealthEvents.HealthEventType.ProtectedItemHealth and + /// DataContract.HealthEvents.HealthEventType.AgentHealth. + /// + public partial class HyperVToAzStackHcieventModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcieventModelCustomProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcieventModelCustomPropertiesInternal, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCustomProperties __eventModelCustomProperties = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EventModelCustomProperties(); + + /// Backing field for property. + private string _eventSourceFriendlyName; + + /// + /// Gets or sets the friendly name of the source which has raised this health event. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string EventSourceFriendlyName { get => this._eventSourceFriendlyName; } + + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCustomPropertiesInternal)__eventModelCustomProperties).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCustomPropertiesInternal)__eventModelCustomProperties).InstanceType = value ; } + + /// Internal Acessors for EventSourceFriendlyName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcieventModelCustomPropertiesInternal.EventSourceFriendlyName { get => this._eventSourceFriendlyName; set { {_eventSourceFriendlyName = value;} } } + + /// Internal Acessors for ProtectedItemFriendlyName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcieventModelCustomPropertiesInternal.ProtectedItemFriendlyName { get => this._protectedItemFriendlyName; set { {_protectedItemFriendlyName = value;} } } + + /// Internal Acessors for ServerType + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcieventModelCustomPropertiesInternal.ServerType { get => this._serverType; set { {_serverType = value;} } } + + /// Internal Acessors for SourceApplianceName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcieventModelCustomPropertiesInternal.SourceApplianceName { get => this._sourceApplianceName; set { {_sourceApplianceName = value;} } } + + /// Internal Acessors for TargetApplianceName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcieventModelCustomPropertiesInternal.TargetApplianceName { get => this._targetApplianceName; set { {_targetApplianceName = value;} } } + + /// Backing field for property. + private string _protectedItemFriendlyName; + + /// Gets or sets the protected item friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string ProtectedItemFriendlyName { get => this._protectedItemFriendlyName; } + + /// Backing field for property. + private string _serverType; + + /// Gets or sets the server type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string ServerType { get => this._serverType; } + + /// Backing field for property. + private string _sourceApplianceName; + + /// Gets or sets the source appliance name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string SourceApplianceName { get => this._sourceApplianceName; } + + /// Backing field for property. + private string _targetApplianceName; + + /// Gets or sets the source target name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TargetApplianceName { get => this._targetApplianceName; } + + /// + /// Creates an new instance. + /// + public HyperVToAzStackHcieventModelCustomProperties() + { + + } + + /// 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.Migrate.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__eventModelCustomProperties), __eventModelCustomProperties); + await eventListener.AssertObjectIsValid(nameof(__eventModelCustomProperties), __eventModelCustomProperties); + } + } + /// HyperV to AzStackHCI event model custom properties. This class provides provider specific + /// details for events of type DataContract.HealthEvents.HealthEventType.ProtectedItemHealth and + /// DataContract.HealthEvents.HealthEventType.AgentHealth. + public partial interface IHyperVToAzStackHcieventModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCustomProperties + { + /// + /// Gets or sets the friendly name of the source which has raised this health event. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the friendly name of the source which has raised this health event.", + SerializedName = @"eventSourceFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string EventSourceFriendlyName { get; } + /// Gets or sets the protected item friendly name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the protected item friendly name.", + SerializedName = @"protectedItemFriendlyName", + PossibleTypes = new [] { typeof(string) })] + string ProtectedItemFriendlyName { get; } + /// Gets or sets the server type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the server type.", + SerializedName = @"serverType", + PossibleTypes = new [] { typeof(string) })] + string ServerType { get; } + /// Gets or sets the source appliance name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the source appliance name.", + SerializedName = @"sourceApplianceName", + PossibleTypes = new [] { typeof(string) })] + string SourceApplianceName { get; } + /// Gets or sets the source target name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the source target name.", + SerializedName = @"targetApplianceName", + PossibleTypes = new [] { typeof(string) })] + string TargetApplianceName { get; } + + } + /// HyperV to AzStackHCI event model custom properties. This class provides provider specific + /// details for events of type DataContract.HealthEvents.HealthEventType.ProtectedItemHealth and + /// DataContract.HealthEvents.HealthEventType.AgentHealth. + internal partial interface IHyperVToAzStackHcieventModelCustomPropertiesInternal : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IEventModelCustomPropertiesInternal + { + /// + /// Gets or sets the friendly name of the source which has raised this health event. + /// + string EventSourceFriendlyName { get; set; } + /// Gets or sets the protected item friendly name. + string ProtectedItemFriendlyName { get; set; } + /// Gets or sets the server type. + string ServerType { get; set; } + /// Gets or sets the source appliance name. + string SourceApplianceName { get; set; } + /// Gets or sets the source target name. + string TargetApplianceName { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcieventModelCustomProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcieventModelCustomProperties.json.cs new file mode 100644 index 000000000000..bfbe4b660694 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcieventModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// + /// HyperV to AzStackHCI event model custom properties. This class provides provider specific + /// details for events of type DataContract.HealthEvents.HealthEventType.ProtectedItemHealth and + /// DataContract.HealthEvents.HealthEventType.AgentHealth. + /// + public partial class HyperVToAzStackHcieventModelCustomProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcieventModelCustomProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcieventModelCustomProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcieventModelCustomProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new HyperVToAzStackHcieventModelCustomProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal HyperVToAzStackHcieventModelCustomProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __eventModelCustomProperties = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.EventModelCustomProperties(json); + {_eventSourceFriendlyName = If( json?.PropertyT("eventSourceFriendlyName"), out var __jsonEventSourceFriendlyName) ? (string)__jsonEventSourceFriendlyName : (string)EventSourceFriendlyName;} + {_protectedItemFriendlyName = If( json?.PropertyT("protectedItemFriendlyName"), out var __jsonProtectedItemFriendlyName) ? (string)__jsonProtectedItemFriendlyName : (string)ProtectedItemFriendlyName;} + {_sourceApplianceName = If( json?.PropertyT("sourceApplianceName"), out var __jsonSourceApplianceName) ? (string)__jsonSourceApplianceName : (string)SourceApplianceName;} + {_targetApplianceName = If( json?.PropertyT("targetApplianceName"), out var __jsonTargetApplianceName) ? (string)__jsonTargetApplianceName : (string)TargetApplianceName;} + {_serverType = If( json?.PropertyT("serverType"), out var __jsonServerType) ? (string)__jsonServerType : (string)ServerType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __eventModelCustomProperties?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._eventSourceFriendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._eventSourceFriendlyName.ToString()) : null, "eventSourceFriendlyName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._protectedItemFriendlyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._protectedItemFriendlyName.ToString()) : null, "protectedItemFriendlyName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._sourceApplianceName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._sourceApplianceName.ToString()) : null, "sourceApplianceName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._targetApplianceName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._targetApplianceName.ToString()) : null, "targetApplianceName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._serverType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._serverType.ToString()) : null, "serverType" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcinicInput.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcinicInput.PowerShell.cs new file mode 100644 index 000000000000..6bccbf201985 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcinicInput.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// HyperVToAzStackHCI NIC properties. + [System.ComponentModel.TypeConverter(typeof(HyperVToAzStackHcinicInputTypeConverter))] + public partial class HyperVToAzStackHcinicInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcinicInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVToAzStackHcinicInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcinicInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVToAzStackHcinicInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcinicInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVToAzStackHcinicInput(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.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcinicInputInternal)this).NicId = (string) content.GetValueForProperty("NicId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcinicInputInternal)this).NicId, global::System.Convert.ToString); + } + if (content.Contains("NetworkName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcinicInputInternal)this).NetworkName = (string) content.GetValueForProperty("NetworkName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcinicInputInternal)this).NetworkName, global::System.Convert.ToString); + } + if (content.Contains("TargetNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcinicInputInternal)this).TargetNetworkId = (string) content.GetValueForProperty("TargetNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcinicInputInternal)this).TargetNetworkId, global::System.Convert.ToString); + } + if (content.Contains("TestNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcinicInputInternal)this).TestNetworkId = (string) content.GetValueForProperty("TestNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcinicInputInternal)this).TestNetworkId, global::System.Convert.ToString); + } + if (content.Contains("SelectionTypeForFailover")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcinicInputInternal)this).SelectionTypeForFailover = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection) content.GetValueForProperty("SelectionTypeForFailover",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcinicInputInternal)this).SelectionTypeForFailover, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HyperVToAzStackHcinicInput(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.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcinicInputInternal)this).NicId = (string) content.GetValueForProperty("NicId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcinicInputInternal)this).NicId, global::System.Convert.ToString); + } + if (content.Contains("NetworkName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcinicInputInternal)this).NetworkName = (string) content.GetValueForProperty("NetworkName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcinicInputInternal)this).NetworkName, global::System.Convert.ToString); + } + if (content.Contains("TargetNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcinicInputInternal)this).TargetNetworkId = (string) content.GetValueForProperty("TargetNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcinicInputInternal)this).TargetNetworkId, global::System.Convert.ToString); + } + if (content.Contains("TestNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcinicInputInternal)this).TestNetworkId = (string) content.GetValueForProperty("TestNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcinicInputInternal)this).TestNetworkId, global::System.Convert.ToString); + } + if (content.Contains("SelectionTypeForFailover")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcinicInputInternal)this).SelectionTypeForFailover = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection) content.GetValueForProperty("SelectionTypeForFailover",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcinicInputInternal)this).SelectionTypeForFailover, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// HyperVToAzStackHCI NIC properties. + [System.ComponentModel.TypeConverter(typeof(HyperVToAzStackHcinicInputTypeConverter))] + public partial interface IHyperVToAzStackHcinicInput + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcinicInput.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcinicInput.TypeConverter.cs new file mode 100644 index 000000000000..dd607fc3429b --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcinicInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVToAzStackHcinicInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcinicInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcinicInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVToAzStackHcinicInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVToAzStackHcinicInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVToAzStackHcinicInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcinicInput.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcinicInput.cs new file mode 100644 index 000000000000..a5f8d5b3a745 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcinicInput.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// HyperVToAzStackHCI NIC properties. + public partial class HyperVToAzStackHcinicInput : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcinicInput, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcinicInputInternal + { + + /// Internal Acessors for NetworkName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcinicInputInternal.NetworkName { get => this._networkName; set { {_networkName = value;} } } + + /// Backing field for property. + private string _networkName; + + /// Gets or sets the network name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string NetworkName { get => this._networkName; } + + /// Backing field for property. + private string _nicId; + + /// Gets or sets the NIC Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string NicId { get => this._nicId; set => this._nicId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection _selectionTypeForFailover; + + /// Gets or sets the selection type of the NIC. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection SelectionTypeForFailover { get => this._selectionTypeForFailover; set => this._selectionTypeForFailover = value; } + + /// Backing field for property. + private string _targetNetworkId; + + /// Gets or sets the target network Id within AzStackHCI Cluster. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TargetNetworkId { get => this._targetNetworkId; set => this._targetNetworkId = value; } + + /// Backing field for property. + private string _testNetworkId; + + /// Gets or sets the target test network Id within AzStackHCI Cluster. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TestNetworkId { get => this._testNetworkId; set => this._testNetworkId = value; } + + /// Creates an new instance. + public HyperVToAzStackHcinicInput() + { + + } + } + /// HyperVToAzStackHCI NIC properties. + public partial interface IHyperVToAzStackHcinicInput : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the network name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the network name.", + SerializedName = @"networkName", + PossibleTypes = new [] { typeof(string) })] + string NetworkName { get; } + /// Gets or sets the NIC Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the NIC Id.", + SerializedName = @"nicId", + PossibleTypes = new [] { typeof(string) })] + string NicId { get; set; } + /// Gets or sets the selection type of the NIC. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the selection type of the NIC.", + SerializedName = @"selectionTypeForFailover", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection SelectionTypeForFailover { get; set; } + /// Gets or sets the target network Id within AzStackHCI Cluster. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the target network Id within AzStackHCI Cluster.", + SerializedName = @"targetNetworkId", + PossibleTypes = new [] { typeof(string) })] + string TargetNetworkId { get; set; } + /// Gets or sets the target test network Id within AzStackHCI Cluster. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the target test network Id within AzStackHCI Cluster.", + SerializedName = @"testNetworkId", + PossibleTypes = new [] { typeof(string) })] + string TestNetworkId { get; set; } + + } + /// HyperVToAzStackHCI NIC properties. + internal partial interface IHyperVToAzStackHcinicInputInternal + + { + /// Gets or sets the network name. + string NetworkName { get; set; } + /// Gets or sets the NIC Id. + string NicId { get; set; } + /// Gets or sets the selection type of the NIC. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection SelectionTypeForFailover { get; set; } + /// Gets or sets the target network Id within AzStackHCI Cluster. + string TargetNetworkId { get; set; } + /// Gets or sets the target test network Id within AzStackHCI Cluster. + string TestNetworkId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcinicInput.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcinicInput.json.cs new file mode 100644 index 000000000000..9d434ea4942e --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcinicInput.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// HyperVToAzStackHCI NIC properties. + public partial class HyperVToAzStackHcinicInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcinicInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcinicInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcinicInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new HyperVToAzStackHcinicInput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal HyperVToAzStackHcinicInput(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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;} + {_networkName = If( json?.PropertyT("networkName"), out var __jsonNetworkName) ? (string)__jsonNetworkName : (string)NetworkName;} + {_targetNetworkId = If( json?.PropertyT("targetNetworkId"), out var __jsonTargetNetworkId) ? (string)__jsonTargetNetworkId : (string)TargetNetworkId;} + {_testNetworkId = If( json?.PropertyT("testNetworkId"), out var __jsonTestNetworkId) ? (string)__jsonTestNetworkId : (string)TestNetworkId;} + {_selectionTypeForFailover = If( json?.PropertyT("selectionTypeForFailover"), out var __jsonSelectionTypeForFailover) ? (string)__jsonSelectionTypeForFailover : (string)SelectionTypeForFailover;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._nicId.ToString()) : null, "nicId" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._networkName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._networkName.ToString()) : null, "networkName" ,container.Add ); + } + AddIf( null != (((object)this._targetNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._targetNetworkId.ToString()) : null, "targetNetworkId" ,container.Add ); + AddIf( null != (((object)this._testNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._testNetworkId.ToString()) : null, "testNetworkId" ,container.Add ); + AddIf( null != (((object)this._selectionTypeForFailover)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._selectionTypeForFailover.ToString()) : null, "selectionTypeForFailover" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciplannedFailoverModelCustomProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciplannedFailoverModelCustomProperties.PowerShell.cs new file mode 100644 index 000000000000..306c95d55855 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciplannedFailoverModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// HyperV to AzStackHCI planned failover model custom properties. + [System.ComponentModel.TypeConverter(typeof(HyperVToAzStackHciplannedFailoverModelCustomPropertiesTypeConverter))] + public partial class HyperVToAzStackHciplannedFailoverModelCustomProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciplannedFailoverModelCustomProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVToAzStackHciplannedFailoverModelCustomProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciplannedFailoverModelCustomProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVToAzStackHciplannedFailoverModelCustomProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content + /// from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciplannedFailoverModelCustomProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVToAzStackHciplannedFailoverModelCustomProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ShutdownSourceVM")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciplannedFailoverModelCustomPropertiesInternal)this).ShutdownSourceVM = (bool) content.GetValueForProperty("ShutdownSourceVM",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciplannedFailoverModelCustomPropertiesInternal)this).ShutdownSourceVM, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelCustomPropertiesInternal)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 HyperVToAzStackHciplannedFailoverModelCustomProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ShutdownSourceVM")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciplannedFailoverModelCustomPropertiesInternal)this).ShutdownSourceVM = (bool) content.GetValueForProperty("ShutdownSourceVM",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciplannedFailoverModelCustomPropertiesInternal)this).ShutdownSourceVM, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelCustomPropertiesInternal)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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// HyperV to AzStackHCI planned failover model custom properties. + [System.ComponentModel.TypeConverter(typeof(HyperVToAzStackHciplannedFailoverModelCustomPropertiesTypeConverter))] + public partial interface IHyperVToAzStackHciplannedFailoverModelCustomProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciplannedFailoverModelCustomProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciplannedFailoverModelCustomProperties.TypeConverter.cs new file mode 100644 index 000000000000..a17773ce81a7 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciplannedFailoverModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVToAzStackHciplannedFailoverModelCustomPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciplannedFailoverModelCustomProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciplannedFailoverModelCustomProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVToAzStackHciplannedFailoverModelCustomProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVToAzStackHciplannedFailoverModelCustomProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVToAzStackHciplannedFailoverModelCustomProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciplannedFailoverModelCustomProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciplannedFailoverModelCustomProperties.cs new file mode 100644 index 000000000000..b24a6aa56590 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciplannedFailoverModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// HyperV to AzStackHCI planned failover model custom properties. + public partial class HyperVToAzStackHciplannedFailoverModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciplannedFailoverModelCustomProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciplannedFailoverModelCustomPropertiesInternal, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelCustomProperties __plannedFailoverModelCustomProperties = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PlannedFailoverModelCustomProperties(); + + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelCustomPropertiesInternal)__plannedFailoverModelCustomProperties).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelCustomPropertiesInternal)__plannedFailoverModelCustomProperties).InstanceType = value ; } + + /// Backing field for property. + private bool _shutdownSourceVM; + + /// Gets or sets a value indicating whether VM needs to be shut down. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public bool ShutdownSourceVM { get => this._shutdownSourceVM; set => this._shutdownSourceVM = value; } + + /// + /// Creates an new instance. + /// + public HyperVToAzStackHciplannedFailoverModelCustomProperties() + { + + } + + /// 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.Migrate.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__plannedFailoverModelCustomProperties), __plannedFailoverModelCustomProperties); + await eventListener.AssertObjectIsValid(nameof(__plannedFailoverModelCustomProperties), __plannedFailoverModelCustomProperties); + } + } + /// HyperV to AzStackHCI planned failover model custom properties. + public partial interface IHyperVToAzStackHciplannedFailoverModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelCustomProperties + { + /// Gets or sets a value indicating whether VM needs to be shut down. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets a value indicating whether VM needs to be shut down.", + SerializedName = @"shutdownSourceVM", + PossibleTypes = new [] { typeof(bool) })] + bool ShutdownSourceVM { get; set; } + + } + /// HyperV to AzStackHCI planned failover model custom properties. + internal partial interface IHyperVToAzStackHciplannedFailoverModelCustomPropertiesInternal : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelCustomPropertiesInternal + { + /// Gets or sets a value indicating whether VM needs to be shut down. + bool ShutdownSourceVM { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciplannedFailoverModelCustomProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciplannedFailoverModelCustomProperties.json.cs new file mode 100644 index 000000000000..a5fb54414155 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciplannedFailoverModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// HyperV to AzStackHCI planned failover model custom properties. + public partial class HyperVToAzStackHciplannedFailoverModelCustomProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciplannedFailoverModelCustomProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciplannedFailoverModelCustomProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciplannedFailoverModelCustomProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new HyperVToAzStackHciplannedFailoverModelCustomProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal HyperVToAzStackHciplannedFailoverModelCustomProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __plannedFailoverModelCustomProperties = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PlannedFailoverModelCustomProperties(json); + {_shutdownSourceVM = If( json?.PropertyT("shutdownSourceVM"), out var __jsonShutdownSourceVM) ? (bool)__jsonShutdownSourceVM : ShutdownSourceVM;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __plannedFailoverModelCustomProperties?.ToJson(container, serializationMode); + AddIf( (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonBoolean(this._shutdownSourceVM), "shutdownSourceVM" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcipolicyModelCustomProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcipolicyModelCustomProperties.PowerShell.cs new file mode 100644 index 000000000000..33bac9630aea --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcipolicyModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// HyperV To AzStackHCI Policy model custom properties. + [System.ComponentModel.TypeConverter(typeof(HyperVToAzStackHcipolicyModelCustomPropertiesTypeConverter))] + public partial class HyperVToAzStackHcipolicyModelCustomProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcipolicyModelCustomProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVToAzStackHcipolicyModelCustomProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcipolicyModelCustomProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVToAzStackHcipolicyModelCustomProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcipolicyModelCustomProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVToAzStackHcipolicyModelCustomProperties(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.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcipolicyModelCustomPropertiesInternal)this).RecoveryPointHistoryInMinute = (int) content.GetValueForProperty("RecoveryPointHistoryInMinute",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcipolicyModelCustomPropertiesInternal)this).RecoveryPointHistoryInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("CrashConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcipolicyModelCustomPropertiesInternal)this).CrashConsistentFrequencyInMinute = (int) content.GetValueForProperty("CrashConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcipolicyModelCustomPropertiesInternal)this).CrashConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AppConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcipolicyModelCustomPropertiesInternal)this).AppConsistentFrequencyInMinute = (int) content.GetValueForProperty("AppConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcipolicyModelCustomPropertiesInternal)this).AppConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCustomPropertiesInternal)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 HyperVToAzStackHcipolicyModelCustomProperties(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.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcipolicyModelCustomPropertiesInternal)this).RecoveryPointHistoryInMinute = (int) content.GetValueForProperty("RecoveryPointHistoryInMinute",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcipolicyModelCustomPropertiesInternal)this).RecoveryPointHistoryInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("CrashConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcipolicyModelCustomPropertiesInternal)this).CrashConsistentFrequencyInMinute = (int) content.GetValueForProperty("CrashConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcipolicyModelCustomPropertiesInternal)this).CrashConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AppConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcipolicyModelCustomPropertiesInternal)this).AppConsistentFrequencyInMinute = (int) content.GetValueForProperty("AppConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcipolicyModelCustomPropertiesInternal)this).AppConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCustomPropertiesInternal)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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// HyperV To AzStackHCI Policy model custom properties. + [System.ComponentModel.TypeConverter(typeof(HyperVToAzStackHcipolicyModelCustomPropertiesTypeConverter))] + public partial interface IHyperVToAzStackHcipolicyModelCustomProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcipolicyModelCustomProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcipolicyModelCustomProperties.TypeConverter.cs new file mode 100644 index 000000000000..f6eb78a02685 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcipolicyModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVToAzStackHcipolicyModelCustomPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcipolicyModelCustomProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcipolicyModelCustomProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVToAzStackHcipolicyModelCustomProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVToAzStackHcipolicyModelCustomProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVToAzStackHcipolicyModelCustomProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcipolicyModelCustomProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcipolicyModelCustomProperties.cs new file mode 100644 index 000000000000..55b1a8d33316 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcipolicyModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// HyperV To AzStackHCI Policy model custom properties. + public partial class HyperVToAzStackHcipolicyModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcipolicyModelCustomProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcipolicyModelCustomPropertiesInternal, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCustomProperties __policyModelCustomProperties = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PolicyModelCustomProperties(); + + /// Backing field for property. + private int _appConsistentFrequencyInMinute; + + /// Gets or sets the app consistent snapshot frequency (in minutes). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public int AppConsistentFrequencyInMinute { get => this._appConsistentFrequencyInMinute; set => this._appConsistentFrequencyInMinute = value; } + + /// Backing field for property. + private int _crashConsistentFrequencyInMinute; + + /// Gets or sets the crash consistent snapshot frequency (in minutes). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public int CrashConsistentFrequencyInMinute { get => this._crashConsistentFrequencyInMinute; set => this._crashConsistentFrequencyInMinute = value; } + + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCustomPropertiesInternal)__policyModelCustomProperties).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCustomPropertiesInternal)__policyModelCustomProperties).InstanceType = value ; } + + /// Backing field for property. + private int _recoveryPointHistoryInMinute; + + /// + /// Gets or sets the duration in minutes until which the recovery points need to be + /// stored. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public int RecoveryPointHistoryInMinute { get => this._recoveryPointHistoryInMinute; set => this._recoveryPointHistoryInMinute = value; } + + /// + /// Creates an new instance. + /// + public HyperVToAzStackHcipolicyModelCustomProperties() + { + + } + + /// 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.Migrate.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__policyModelCustomProperties), __policyModelCustomProperties); + await eventListener.AssertObjectIsValid(nameof(__policyModelCustomProperties), __policyModelCustomProperties); + } + } + /// HyperV To AzStackHCI Policy model custom properties. + public partial interface IHyperVToAzStackHcipolicyModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCustomProperties + { + /// Gets or sets the app consistent snapshot frequency (in minutes). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the app consistent snapshot frequency (in minutes).", + SerializedName = @"appConsistentFrequencyInMinutes", + PossibleTypes = new [] { typeof(int) })] + int AppConsistentFrequencyInMinute { get; set; } + /// Gets or sets the crash consistent snapshot frequency (in minutes). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the crash consistent snapshot frequency (in minutes).", + SerializedName = @"crashConsistentFrequencyInMinutes", + PossibleTypes = new [] { typeof(int) })] + int CrashConsistentFrequencyInMinute { get; set; } + /// + /// Gets or sets the duration in minutes until which the recovery points need to be + /// stored. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the duration in minutes until which the recovery points need to be + stored.", + SerializedName = @"recoveryPointHistoryInMinutes", + PossibleTypes = new [] { typeof(int) })] + int RecoveryPointHistoryInMinute { get; set; } + + } + /// HyperV To AzStackHCI Policy model custom properties. + internal partial interface IHyperVToAzStackHcipolicyModelCustomPropertiesInternal : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCustomPropertiesInternal + { + /// Gets or sets the app consistent snapshot frequency (in minutes). + int AppConsistentFrequencyInMinute { get; set; } + /// Gets or sets the crash consistent snapshot frequency (in minutes). + int CrashConsistentFrequencyInMinute { get; set; } + /// + /// Gets or sets 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/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcipolicyModelCustomProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcipolicyModelCustomProperties.json.cs new file mode 100644 index 000000000000..58f596f34ed4 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcipolicyModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// HyperV To AzStackHCI Policy model custom properties. + public partial class HyperVToAzStackHcipolicyModelCustomProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcipolicyModelCustomProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcipolicyModelCustomProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcipolicyModelCustomProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new HyperVToAzStackHcipolicyModelCustomProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal HyperVToAzStackHcipolicyModelCustomProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __policyModelCustomProperties = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PolicyModelCustomProperties(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); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __policyModelCustomProperties?.ToJson(container, serializationMode); + AddIf( (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNumber(this._recoveryPointHistoryInMinute), "recoveryPointHistoryInMinutes" ,container.Add ); + AddIf( (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNumber(this._crashConsistentFrequencyInMinute), "crashConsistentFrequencyInMinutes" ,container.Add ); + AddIf( (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNumber(this._appConsistentFrequencyInMinute), "appConsistentFrequencyInMinutes" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciprotectedDiskProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciprotectedDiskProperties.PowerShell.cs new file mode 100644 index 000000000000..55960feb9531 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciprotectedDiskProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// HyperVToAzStackHCI protected disk properties. + [System.ComponentModel.TypeConverter(typeof(HyperVToAzStackHciprotectedDiskPropertiesTypeConverter))] + public partial class HyperVToAzStackHciprotectedDiskProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVToAzStackHciprotectedDiskProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVToAzStackHciprotectedDiskProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVToAzStackHciprotectedDiskProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("StorageContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal)this).StorageContainerId = (string) content.GetValueForProperty("StorageContainerId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal)this).StorageContainerId, global::System.Convert.ToString); + } + if (content.Contains("StorageContainerLocalPath")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal)this).StorageContainerLocalPath = (string) content.GetValueForProperty("StorageContainerLocalPath",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal)this).StorageContainerLocalPath, global::System.Convert.ToString); + } + if (content.Contains("SourceDiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal)this).SourceDiskId = (string) content.GetValueForProperty("SourceDiskId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal)this).SourceDiskId, global::System.Convert.ToString); + } + if (content.Contains("SourceDiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal)this).SourceDiskName = (string) content.GetValueForProperty("SourceDiskName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal)this).SourceDiskName, global::System.Convert.ToString); + } + if (content.Contains("SeedDiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal)this).SeedDiskName = (string) content.GetValueForProperty("SeedDiskName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal)this).SeedDiskName, global::System.Convert.ToString); + } + if (content.Contains("TestMigrateDiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal)this).TestMigrateDiskName = (string) content.GetValueForProperty("TestMigrateDiskName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal)this).TestMigrateDiskName, global::System.Convert.ToString); + } + if (content.Contains("MigrateDiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal)this).MigrateDiskName = (string) content.GetValueForProperty("MigrateDiskName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal)this).MigrateDiskName, global::System.Convert.ToString); + } + if (content.Contains("IsOSDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal)this).IsOSDisk = (bool?) content.GetValueForProperty("IsOSDisk",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal)this).IsOSDisk, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("CapacityInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal)this).CapacityInByte = (long?) content.GetValueForProperty("CapacityInByte",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal)this).CapacityInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("IsDynamic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal)this).IsDynamic = (bool?) content.GetValueForProperty("IsDynamic",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal)this).IsDynamic, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("DiskType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal)this).DiskType = (string) content.GetValueForProperty("DiskType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal)this).DiskType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HyperVToAzStackHciprotectedDiskProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("StorageContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal)this).StorageContainerId = (string) content.GetValueForProperty("StorageContainerId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal)this).StorageContainerId, global::System.Convert.ToString); + } + if (content.Contains("StorageContainerLocalPath")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal)this).StorageContainerLocalPath = (string) content.GetValueForProperty("StorageContainerLocalPath",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal)this).StorageContainerLocalPath, global::System.Convert.ToString); + } + if (content.Contains("SourceDiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal)this).SourceDiskId = (string) content.GetValueForProperty("SourceDiskId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal)this).SourceDiskId, global::System.Convert.ToString); + } + if (content.Contains("SourceDiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal)this).SourceDiskName = (string) content.GetValueForProperty("SourceDiskName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal)this).SourceDiskName, global::System.Convert.ToString); + } + if (content.Contains("SeedDiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal)this).SeedDiskName = (string) content.GetValueForProperty("SeedDiskName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal)this).SeedDiskName, global::System.Convert.ToString); + } + if (content.Contains("TestMigrateDiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal)this).TestMigrateDiskName = (string) content.GetValueForProperty("TestMigrateDiskName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal)this).TestMigrateDiskName, global::System.Convert.ToString); + } + if (content.Contains("MigrateDiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal)this).MigrateDiskName = (string) content.GetValueForProperty("MigrateDiskName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal)this).MigrateDiskName, global::System.Convert.ToString); + } + if (content.Contains("IsOSDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal)this).IsOSDisk = (bool?) content.GetValueForProperty("IsOSDisk",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal)this).IsOSDisk, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("CapacityInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal)this).CapacityInByte = (long?) content.GetValueForProperty("CapacityInByte",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal)this).CapacityInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("IsDynamic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal)this).IsDynamic = (bool?) content.GetValueForProperty("IsDynamic",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal)this).IsDynamic, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("DiskType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal)this).DiskType = (string) content.GetValueForProperty("DiskType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal)this).DiskType, 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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// HyperVToAzStackHCI protected disk properties. + [System.ComponentModel.TypeConverter(typeof(HyperVToAzStackHciprotectedDiskPropertiesTypeConverter))] + public partial interface IHyperVToAzStackHciprotectedDiskProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciprotectedDiskProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciprotectedDiskProperties.TypeConverter.cs new file mode 100644 index 000000000000..94e091b7cfa4 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciprotectedDiskProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVToAzStackHciprotectedDiskPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVToAzStackHciprotectedDiskProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVToAzStackHciprotectedDiskProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVToAzStackHciprotectedDiskProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciprotectedDiskProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciprotectedDiskProperties.cs new file mode 100644 index 000000000000..8cb1dabc57c7 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciprotectedDiskProperties.cs @@ -0,0 +1,266 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// HyperVToAzStackHCI protected disk properties. + public partial class HyperVToAzStackHciprotectedDiskProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal + { + + /// Backing field for property. + private long? _capacityInByte; + + /// Gets or sets the disk capacity in bytes. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public long? CapacityInByte { get => this._capacityInByte; } + + /// Backing field for property. + private string _diskType; + + /// Gets or sets the disk type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string DiskType { get => this._diskType; } + + /// Backing field for property. + private bool? _isDynamic; + + /// + /// Gets or sets a value indicating whether dynamic sizing is enabled on the virtual hard + /// disk. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public bool? IsDynamic { get => this._isDynamic; } + + /// Backing field for property. + private bool? _isOSDisk; + + /// Gets or sets a value indicating whether the disk is the OS disk. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public bool? IsOSDisk { get => this._isOSDisk; } + + /// Internal Acessors for CapacityInByte + long? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal.CapacityInByte { get => this._capacityInByte; set { {_capacityInByte = value;} } } + + /// Internal Acessors for DiskType + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal.DiskType { get => this._diskType; set { {_diskType = value;} } } + + /// Internal Acessors for IsDynamic + bool? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal.IsDynamic { get => this._isDynamic; set { {_isDynamic = value;} } } + + /// Internal Acessors for IsOSDisk + bool? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal.IsOSDisk { get => this._isOSDisk; set { {_isOSDisk = value;} } } + + /// Internal Acessors for MigrateDiskName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal.MigrateDiskName { get => this._migrateDiskName; set { {_migrateDiskName = value;} } } + + /// Internal Acessors for SeedDiskName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal.SeedDiskName { get => this._seedDiskName; set { {_seedDiskName = value;} } } + + /// Internal Acessors for SourceDiskId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal.SourceDiskId { get => this._sourceDiskId; set { {_sourceDiskId = value;} } } + + /// Internal Acessors for SourceDiskName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal.SourceDiskName { get => this._sourceDiskName; set { {_sourceDiskName = value;} } } + + /// Internal Acessors for StorageContainerId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal.StorageContainerId { get => this._storageContainerId; set { {_storageContainerId = value;} } } + + /// Internal Acessors for StorageContainerLocalPath + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal.StorageContainerLocalPath { get => this._storageContainerLocalPath; set { {_storageContainerLocalPath = value;} } } + + /// Internal Acessors for TestMigrateDiskName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskPropertiesInternal.TestMigrateDiskName { get => this._testMigrateDiskName; set { {_testMigrateDiskName = value;} } } + + /// Backing field for property. + private string _migrateDiskName; + + /// Gets or sets the failover clone disk. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string MigrateDiskName { get => this._migrateDiskName; } + + /// Backing field for property. + private string _seedDiskName; + + /// Gets or sets the seed disk name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string SeedDiskName { get => this._seedDiskName; } + + /// Backing field for property. + private string _sourceDiskId; + + /// Gets or sets the source disk Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string SourceDiskId { get => this._sourceDiskId; } + + /// Backing field for property. + private string _sourceDiskName; + + /// Gets or sets the source disk Name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string SourceDiskName { get => this._sourceDiskName; } + + /// Backing field for property. + private string _storageContainerId; + + /// Gets or sets the ARM Id of the storage container. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string StorageContainerId { get => this._storageContainerId; } + + /// Backing field for property. + private string _storageContainerLocalPath; + + /// Gets or sets the local path of the storage container. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string StorageContainerLocalPath { get => this._storageContainerLocalPath; } + + /// Backing field for property. + private string _testMigrateDiskName; + + /// Gets or sets the test failover clone disk. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TestMigrateDiskName { get => this._testMigrateDiskName; } + + /// + /// Creates an new instance. + /// + public HyperVToAzStackHciprotectedDiskProperties() + { + + } + } + /// HyperVToAzStackHCI protected disk properties. + public partial interface IHyperVToAzStackHciprotectedDiskProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the disk capacity in bytes. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the disk capacity in bytes.", + SerializedName = @"capacityInBytes", + PossibleTypes = new [] { typeof(long) })] + long? CapacityInByte { get; } + /// Gets or sets the disk type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the disk type.", + SerializedName = @"diskType", + PossibleTypes = new [] { typeof(string) })] + string DiskType { get; } + /// + /// Gets or sets a value indicating whether dynamic sizing is enabled on the virtual hard + /// disk. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets a value indicating whether dynamic sizing is enabled on the virtual hard + disk.", + SerializedName = @"isDynamic", + PossibleTypes = new [] { typeof(bool) })] + bool? IsDynamic { get; } + /// Gets or sets a value indicating whether the disk is the OS disk. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets a value indicating whether the disk is the OS disk.", + SerializedName = @"isOsDisk", + PossibleTypes = new [] { typeof(bool) })] + bool? IsOSDisk { get; } + /// Gets or sets the failover clone disk. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the failover clone disk.", + SerializedName = @"migrateDiskName", + PossibleTypes = new [] { typeof(string) })] + string MigrateDiskName { get; } + /// Gets or sets the seed disk name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the seed disk name.", + SerializedName = @"seedDiskName", + PossibleTypes = new [] { typeof(string) })] + string SeedDiskName { get; } + /// Gets or sets the source disk Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the source disk Id.", + SerializedName = @"sourceDiskId", + PossibleTypes = new [] { typeof(string) })] + string SourceDiskId { get; } + /// Gets or sets the source disk Name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the source disk Name.", + SerializedName = @"sourceDiskName", + PossibleTypes = new [] { typeof(string) })] + string SourceDiskName { get; } + /// Gets or sets the ARM Id of the storage container. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the ARM Id of the storage container.", + SerializedName = @"storageContainerId", + PossibleTypes = new [] { typeof(string) })] + string StorageContainerId { get; } + /// Gets or sets the local path of the storage container. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the local path of the storage container.", + SerializedName = @"storageContainerLocalPath", + PossibleTypes = new [] { typeof(string) })] + string StorageContainerLocalPath { get; } + /// Gets or sets the test failover clone disk. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the test failover clone disk.", + SerializedName = @"testMigrateDiskName", + PossibleTypes = new [] { typeof(string) })] + string TestMigrateDiskName { get; } + + } + /// HyperVToAzStackHCI protected disk properties. + internal partial interface IHyperVToAzStackHciprotectedDiskPropertiesInternal + + { + /// Gets or sets the disk capacity in bytes. + long? CapacityInByte { get; set; } + /// Gets or sets the disk type. + string DiskType { get; set; } + /// + /// Gets or sets a value indicating whether dynamic sizing is enabled on the virtual hard + /// disk. + /// + bool? IsDynamic { get; set; } + /// Gets or sets a value indicating whether the disk is the OS disk. + bool? IsOSDisk { get; set; } + /// Gets or sets the failover clone disk. + string MigrateDiskName { get; set; } + /// Gets or sets the seed disk name. + string SeedDiskName { get; set; } + /// Gets or sets the source disk Id. + string SourceDiskId { get; set; } + /// Gets or sets the source disk Name. + string SourceDiskName { get; set; } + /// Gets or sets the ARM Id of the storage container. + string StorageContainerId { get; set; } + /// Gets or sets the local path of the storage container. + string StorageContainerLocalPath { get; set; } + /// Gets or sets the test failover clone disk. + string TestMigrateDiskName { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciprotectedDiskProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciprotectedDiskProperties.json.cs new file mode 100644 index 000000000000..a8b8d51a8405 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciprotectedDiskProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// HyperVToAzStackHCI protected disk properties. + public partial class HyperVToAzStackHciprotectedDiskProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new HyperVToAzStackHciprotectedDiskProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal HyperVToAzStackHciprotectedDiskProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_storageContainerId = If( json?.PropertyT("storageContainerId"), out var __jsonStorageContainerId) ? (string)__jsonStorageContainerId : (string)StorageContainerId;} + {_storageContainerLocalPath = If( json?.PropertyT("storageContainerLocalPath"), out var __jsonStorageContainerLocalPath) ? (string)__jsonStorageContainerLocalPath : (string)StorageContainerLocalPath;} + {_sourceDiskId = If( json?.PropertyT("sourceDiskId"), out var __jsonSourceDiskId) ? (string)__jsonSourceDiskId : (string)SourceDiskId;} + {_sourceDiskName = If( json?.PropertyT("sourceDiskName"), out var __jsonSourceDiskName) ? (string)__jsonSourceDiskName : (string)SourceDiskName;} + {_seedDiskName = If( json?.PropertyT("seedDiskName"), out var __jsonSeedDiskName) ? (string)__jsonSeedDiskName : (string)SeedDiskName;} + {_testMigrateDiskName = If( json?.PropertyT("testMigrateDiskName"), out var __jsonTestMigrateDiskName) ? (string)__jsonTestMigrateDiskName : (string)TestMigrateDiskName;} + {_migrateDiskName = If( json?.PropertyT("migrateDiskName"), out var __jsonMigrateDiskName) ? (string)__jsonMigrateDiskName : (string)MigrateDiskName;} + {_isOSDisk = If( json?.PropertyT("isOsDisk"), out var __jsonIsOSDisk) ? (bool?)__jsonIsOSDisk : IsOSDisk;} + {_capacityInByte = If( json?.PropertyT("capacityInBytes"), out var __jsonCapacityInBytes) ? (long?)__jsonCapacityInBytes : CapacityInByte;} + {_isDynamic = If( json?.PropertyT("isDynamic"), out var __jsonIsDynamic) ? (bool?)__jsonIsDynamic : IsDynamic;} + {_diskType = If( json?.PropertyT("diskType"), out var __jsonDiskType) ? (string)__jsonDiskType : (string)DiskType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._storageContainerId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._storageContainerId.ToString()) : null, "storageContainerId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._storageContainerLocalPath)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._storageContainerLocalPath.ToString()) : null, "storageContainerLocalPath" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._sourceDiskId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._sourceDiskId.ToString()) : null, "sourceDiskId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._sourceDiskName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._sourceDiskName.ToString()) : null, "sourceDiskName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._seedDiskName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._seedDiskName.ToString()) : null, "seedDiskName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._testMigrateDiskName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._testMigrateDiskName.ToString()) : null, "testMigrateDiskName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._migrateDiskName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._migrateDiskName.ToString()) : null, "migrateDiskName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._isOSDisk ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonBoolean((bool)this._isOSDisk) : null, "isOsDisk" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._capacityInByte ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNumber((long)this._capacityInByte) : null, "capacityInBytes" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._isDynamic ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonBoolean((bool)this._isDynamic) : null, "isDynamic" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._diskType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._diskType.ToString()) : null, "diskType" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciprotectedItemModelCustomProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciprotectedItemModelCustomProperties.PowerShell.cs new file mode 100644 index 000000000000..3b5ef531d9d5 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciprotectedItemModelCustomProperties.PowerShell.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// HyperV to AzStackHCI Protected item model custom properties. + [System.ComponentModel.TypeConverter(typeof(HyperVToAzStackHciprotectedItemModelCustomPropertiesTypeConverter))] + public partial class HyperVToAzStackHciprotectedItemModelCustomProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVToAzStackHciprotectedItemModelCustomProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVToAzStackHciprotectedItemModelCustomProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content + /// from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVToAzStackHciprotectedItemModelCustomProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ActiveLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ActiveLocation = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectedItemActiveLocation?) content.GetValueForProperty("ActiveLocation",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ActiveLocation, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectedItemActiveLocation.CreateFrom); + } + if (content.Contains("TargetHciClusterId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetHciClusterId = (string) content.GetValueForProperty("TargetHciClusterId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetHciClusterId, global::System.Convert.ToString); + } + if (content.Contains("TargetArcClusterCustomLocationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetArcClusterCustomLocationId = (string) content.GetValueForProperty("TargetArcClusterCustomLocationId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetArcClusterCustomLocationId, global::System.Convert.ToString); + } + if (content.Contains("TargetAzStackHciClusterName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetAzStackHciClusterName = (string) content.GetValueForProperty("TargetAzStackHciClusterName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetAzStackHciClusterName, global::System.Convert.ToString); + } + if (content.Contains("FabricDiscoveryMachineId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).FabricDiscoveryMachineId = (string) content.GetValueForProperty("FabricDiscoveryMachineId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).FabricDiscoveryMachineId, global::System.Convert.ToString); + } + if (content.Contains("DisksToInclude")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).DisksToInclude = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcidiskInput[]) content.GetValueForProperty("DisksToInclude",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).DisksToInclude, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHcidiskInputTypeConverter.ConvertFrom)); + } + if (content.Contains("NicsToInclude")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).NicsToInclude = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcinicInput[]) content.GetValueForProperty("NicsToInclude",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).NicsToInclude, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHcinicInputTypeConverter.ConvertFrom)); + } + if (content.Contains("SourceVMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).SourceVMName = (string) content.GetValueForProperty("SourceVMName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).SourceVMName, global::System.Convert.ToString); + } + if (content.Contains("SourceCpuCore")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).SourceCpuCore = (int?) content.GetValueForProperty("SourceCpuCore",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).SourceCpuCore, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("SourceMemoryInMegaByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).SourceMemoryInMegaByte = (double?) content.GetValueForProperty("SourceMemoryInMegaByte",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).SourceMemoryInMegaByte, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("TargetVMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetVMName = (string) content.GetValueForProperty("TargetVMName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetVMName, global::System.Convert.ToString); + } + if (content.Contains("TargetResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetResourceGroupId = (string) content.GetValueForProperty("TargetResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("StorageContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).StorageContainerId = (string) content.GetValueForProperty("StorageContainerId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).StorageContainerId, global::System.Convert.ToString); + } + if (content.Contains("HyperVGeneration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).HyperVGeneration = (string) content.GetValueForProperty("HyperVGeneration",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).HyperVGeneration, global::System.Convert.ToString); + } + if (content.Contains("TargetNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetNetworkId = (string) content.GetValueForProperty("TargetNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetNetworkId, global::System.Convert.ToString); + } + if (content.Contains("TestNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TestNetworkId = (string) content.GetValueForProperty("TestNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TestNetworkId, global::System.Convert.ToString); + } + if (content.Contains("TargetCpuCore")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetCpuCore = (int?) content.GetValueForProperty("TargetCpuCore",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetCpuCore, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("IsDynamicRam")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).IsDynamicRam = (bool?) content.GetValueForProperty("IsDynamicRam",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).IsDynamicRam, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("DynamicMemoryConfig")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).DynamicMemoryConfig = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemDynamicMemoryConfig) content.GetValueForProperty("DynamicMemoryConfig",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).DynamicMemoryConfig, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemDynamicMemoryConfigTypeConverter.ConvertFrom); + } + if (content.Contains("TargetMemoryInMegaByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetMemoryInMegaByte = (int?) content.GetValueForProperty("TargetMemoryInMegaByte",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetMemoryInMegaByte, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("RunAsAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).RunAsAccountId = (string) content.GetValueForProperty("RunAsAccountId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).RunAsAccountId, global::System.Convert.ToString); + } + if (content.Contains("SourceDraName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).SourceDraName = (string) content.GetValueForProperty("SourceDraName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).SourceDraName, global::System.Convert.ToString); + } + if (content.Contains("TargetDraName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetDraName = (string) content.GetValueForProperty("TargetDraName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetDraName, global::System.Convert.ToString); + } + if (content.Contains("SourceApplianceName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).SourceApplianceName = (string) content.GetValueForProperty("SourceApplianceName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).SourceApplianceName, global::System.Convert.ToString); + } + if (content.Contains("TargetApplianceName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetApplianceName = (string) content.GetValueForProperty("TargetApplianceName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetApplianceName, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).OSType, global::System.Convert.ToString); + } + if (content.Contains("OSName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).OSName = (string) content.GetValueForProperty("OSName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).OSName, global::System.Convert.ToString); + } + if (content.Contains("FirmwareType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).FirmwareType = (string) content.GetValueForProperty("FirmwareType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).FirmwareType, global::System.Convert.ToString); + } + if (content.Contains("TargetLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetLocation = (string) content.GetValueForProperty("TargetLocation",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetLocation, global::System.Convert.ToString); + } + if (content.Contains("CustomLocationRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).CustomLocationRegion = (string) content.GetValueForProperty("CustomLocationRegion",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).CustomLocationRegion, global::System.Convert.ToString); + } + if (content.Contains("FailoverRecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).FailoverRecoveryPointId = (string) content.GetValueForProperty("FailoverRecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).FailoverRecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("LastRecoveryPointReceived")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).LastRecoveryPointReceived = (global::System.DateTime?) content.GetValueForProperty("LastRecoveryPointReceived",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)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.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).LastRecoveryPointId = (string) content.GetValueForProperty("LastRecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).LastRecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("InitialReplicationProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).InitialReplicationProgressPercentage = (int?) content.GetValueForProperty("InitialReplicationProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).InitialReplicationProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ResyncProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ResyncProgressPercentage = (int?) content.GetValueForProperty("ResyncProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ResyncProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ProtectedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ProtectedDisk = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskProperties[]) content.GetValueForProperty("ProtectedDisk",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ProtectedDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHciprotectedDiskPropertiesTypeConverter.ConvertFrom)); + } + if (content.Contains("ProtectedNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ProtectedNic = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicProperties[]) content.GetValueForProperty("ProtectedNic",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ProtectedNic, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHciprotectedNicPropertiesTypeConverter.ConvertFrom)); + } + if (content.Contains("TargetVMBiosId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetVMBiosId = (string) content.GetValueForProperty("TargetVMBiosId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetVMBiosId, global::System.Convert.ToString); + } + if (content.Contains("LastReplicationUpdateTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).LastReplicationUpdateTime = (global::System.DateTime?) content.GetValueForProperty("LastReplicationUpdateTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).LastReplicationUpdateTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCustomPropertiesInternal)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 HyperVToAzStackHciprotectedItemModelCustomProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ActiveLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ActiveLocation = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectedItemActiveLocation?) content.GetValueForProperty("ActiveLocation",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ActiveLocation, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectedItemActiveLocation.CreateFrom); + } + if (content.Contains("TargetHciClusterId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetHciClusterId = (string) content.GetValueForProperty("TargetHciClusterId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetHciClusterId, global::System.Convert.ToString); + } + if (content.Contains("TargetArcClusterCustomLocationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetArcClusterCustomLocationId = (string) content.GetValueForProperty("TargetArcClusterCustomLocationId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetArcClusterCustomLocationId, global::System.Convert.ToString); + } + if (content.Contains("TargetAzStackHciClusterName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetAzStackHciClusterName = (string) content.GetValueForProperty("TargetAzStackHciClusterName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetAzStackHciClusterName, global::System.Convert.ToString); + } + if (content.Contains("FabricDiscoveryMachineId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).FabricDiscoveryMachineId = (string) content.GetValueForProperty("FabricDiscoveryMachineId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).FabricDiscoveryMachineId, global::System.Convert.ToString); + } + if (content.Contains("DisksToInclude")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).DisksToInclude = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcidiskInput[]) content.GetValueForProperty("DisksToInclude",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).DisksToInclude, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHcidiskInputTypeConverter.ConvertFrom)); + } + if (content.Contains("NicsToInclude")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).NicsToInclude = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcinicInput[]) content.GetValueForProperty("NicsToInclude",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).NicsToInclude, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHcinicInputTypeConverter.ConvertFrom)); + } + if (content.Contains("SourceVMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).SourceVMName = (string) content.GetValueForProperty("SourceVMName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).SourceVMName, global::System.Convert.ToString); + } + if (content.Contains("SourceCpuCore")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).SourceCpuCore = (int?) content.GetValueForProperty("SourceCpuCore",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).SourceCpuCore, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("SourceMemoryInMegaByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).SourceMemoryInMegaByte = (double?) content.GetValueForProperty("SourceMemoryInMegaByte",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).SourceMemoryInMegaByte, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("TargetVMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetVMName = (string) content.GetValueForProperty("TargetVMName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetVMName, global::System.Convert.ToString); + } + if (content.Contains("TargetResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetResourceGroupId = (string) content.GetValueForProperty("TargetResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("StorageContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).StorageContainerId = (string) content.GetValueForProperty("StorageContainerId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).StorageContainerId, global::System.Convert.ToString); + } + if (content.Contains("HyperVGeneration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).HyperVGeneration = (string) content.GetValueForProperty("HyperVGeneration",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).HyperVGeneration, global::System.Convert.ToString); + } + if (content.Contains("TargetNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetNetworkId = (string) content.GetValueForProperty("TargetNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetNetworkId, global::System.Convert.ToString); + } + if (content.Contains("TestNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TestNetworkId = (string) content.GetValueForProperty("TestNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TestNetworkId, global::System.Convert.ToString); + } + if (content.Contains("TargetCpuCore")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetCpuCore = (int?) content.GetValueForProperty("TargetCpuCore",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetCpuCore, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("IsDynamicRam")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).IsDynamicRam = (bool?) content.GetValueForProperty("IsDynamicRam",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).IsDynamicRam, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("DynamicMemoryConfig")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).DynamicMemoryConfig = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemDynamicMemoryConfig) content.GetValueForProperty("DynamicMemoryConfig",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).DynamicMemoryConfig, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemDynamicMemoryConfigTypeConverter.ConvertFrom); + } + if (content.Contains("TargetMemoryInMegaByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetMemoryInMegaByte = (int?) content.GetValueForProperty("TargetMemoryInMegaByte",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetMemoryInMegaByte, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("RunAsAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).RunAsAccountId = (string) content.GetValueForProperty("RunAsAccountId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).RunAsAccountId, global::System.Convert.ToString); + } + if (content.Contains("SourceDraName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).SourceDraName = (string) content.GetValueForProperty("SourceDraName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).SourceDraName, global::System.Convert.ToString); + } + if (content.Contains("TargetDraName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetDraName = (string) content.GetValueForProperty("TargetDraName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetDraName, global::System.Convert.ToString); + } + if (content.Contains("SourceApplianceName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).SourceApplianceName = (string) content.GetValueForProperty("SourceApplianceName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).SourceApplianceName, global::System.Convert.ToString); + } + if (content.Contains("TargetApplianceName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetApplianceName = (string) content.GetValueForProperty("TargetApplianceName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetApplianceName, global::System.Convert.ToString); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).OSType, global::System.Convert.ToString); + } + if (content.Contains("OSName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).OSName = (string) content.GetValueForProperty("OSName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).OSName, global::System.Convert.ToString); + } + if (content.Contains("FirmwareType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).FirmwareType = (string) content.GetValueForProperty("FirmwareType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).FirmwareType, global::System.Convert.ToString); + } + if (content.Contains("TargetLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetLocation = (string) content.GetValueForProperty("TargetLocation",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetLocation, global::System.Convert.ToString); + } + if (content.Contains("CustomLocationRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).CustomLocationRegion = (string) content.GetValueForProperty("CustomLocationRegion",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).CustomLocationRegion, global::System.Convert.ToString); + } + if (content.Contains("FailoverRecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).FailoverRecoveryPointId = (string) content.GetValueForProperty("FailoverRecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).FailoverRecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("LastRecoveryPointReceived")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).LastRecoveryPointReceived = (global::System.DateTime?) content.GetValueForProperty("LastRecoveryPointReceived",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)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.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).LastRecoveryPointId = (string) content.GetValueForProperty("LastRecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).LastRecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("InitialReplicationProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).InitialReplicationProgressPercentage = (int?) content.GetValueForProperty("InitialReplicationProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).InitialReplicationProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ResyncProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ResyncProgressPercentage = (int?) content.GetValueForProperty("ResyncProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ResyncProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ProtectedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ProtectedDisk = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskProperties[]) content.GetValueForProperty("ProtectedDisk",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ProtectedDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHciprotectedDiskPropertiesTypeConverter.ConvertFrom)); + } + if (content.Contains("ProtectedNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ProtectedNic = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicProperties[]) content.GetValueForProperty("ProtectedNic",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ProtectedNic, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHciprotectedNicPropertiesTypeConverter.ConvertFrom)); + } + if (content.Contains("TargetVMBiosId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetVMBiosId = (string) content.GetValueForProperty("TargetVMBiosId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetVMBiosId, global::System.Convert.ToString); + } + if (content.Contains("LastReplicationUpdateTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).LastReplicationUpdateTime = (global::System.DateTime?) content.GetValueForProperty("LastReplicationUpdateTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal)this).LastReplicationUpdateTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCustomPropertiesInternal)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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// HyperV to AzStackHCI Protected item model custom properties. + [System.ComponentModel.TypeConverter(typeof(HyperVToAzStackHciprotectedItemModelCustomPropertiesTypeConverter))] + public partial interface IHyperVToAzStackHciprotectedItemModelCustomProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciprotectedItemModelCustomProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciprotectedItemModelCustomProperties.TypeConverter.cs new file mode 100644 index 000000000000..9cb159f642ed --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciprotectedItemModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVToAzStackHciprotectedItemModelCustomPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a + /// type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVToAzStackHciprotectedItemModelCustomProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVToAzStackHciprotectedItemModelCustomProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVToAzStackHciprotectedItemModelCustomProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciprotectedItemModelCustomProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciprotectedItemModelCustomProperties.cs new file mode 100644 index 000000000000..560b211e99a7 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciprotectedItemModelCustomProperties.cs @@ -0,0 +1,802 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// HyperV to AzStackHCI Protected item model custom properties. + public partial class HyperVToAzStackHciprotectedItemModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCustomProperties __protectedItemModelCustomProperties = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelCustomProperties(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectedItemActiveLocation? _activeLocation; + + /// Gets or sets the location of the protected item. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectedItemActiveLocation? ActiveLocation { get => this._activeLocation; } + + /// Backing field for property. + private string _customLocationRegion; + + /// Gets or sets the location of Azure Arc HCI custom location resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string CustomLocationRegion { get => this._customLocationRegion; set => this._customLocationRegion = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcidiskInput[] _disksToInclude; + + /// Gets or sets the list of disks to replicate. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcidiskInput[] DisksToInclude { get => this._disksToInclude; set => this._disksToInclude = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemDynamicMemoryConfig _dynamicMemoryConfig; + + /// Protected item dynamic memory config. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemDynamicMemoryConfig DynamicMemoryConfig { get => (this._dynamicMemoryConfig = this._dynamicMemoryConfig ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemDynamicMemoryConfig()); set => this._dynamicMemoryConfig = value; } + + /// Backing field for property. + private string _fabricDiscoveryMachineId; + + /// Gets or sets the ARM Id of the discovered machine. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string FabricDiscoveryMachineId { get => this._fabricDiscoveryMachineId; set => this._fabricDiscoveryMachineId = value; } + + /// Backing field for property. + private string _failoverRecoveryPointId; + + /// Gets or sets the recovery point Id to which the VM was failed over. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string FailoverRecoveryPointId { get => this._failoverRecoveryPointId; } + + /// Backing field for property. + private string _firmwareType; + + /// Gets or sets the firmware type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string FirmwareType { get => this._firmwareType; } + + /// Backing field for property. + private string _hyperVGeneration; + + /// Gets or sets the hypervisor generation of the virtual machine. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string HyperVGeneration { get => this._hyperVGeneration; set => this._hyperVGeneration = value; } + + /// Backing field for property. + private int? _initialReplicationProgressPercentage; + + /// + /// Gets or sets the initial replication progress percentage. This is calculated based on + /// total bytes processed for all disks in the source VM. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public int? InitialReplicationProgressPercentage { get => this._initialReplicationProgressPercentage; } + + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCustomPropertiesInternal)__protectedItemModelCustomProperties).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCustomPropertiesInternal)__protectedItemModelCustomProperties).InstanceType = value ; } + + /// Backing field for property. + private bool? _isDynamicRam; + + /// Gets or sets a value indicating whether memory is dynamical. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public bool? IsDynamicRam { get => this._isDynamicRam; set => this._isDynamicRam = value; } + + /// Backing field for property. + private string _lastRecoveryPointId; + + /// Gets or sets the last recovery point Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string LastRecoveryPointId { get => this._lastRecoveryPointId; } + + /// Backing field for property. + private global::System.DateTime? _lastRecoveryPointReceived; + + /// Gets or sets the last recovery point received time. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public global::System.DateTime? LastRecoveryPointReceived { get => this._lastRecoveryPointReceived; } + + /// Backing field for property. + private global::System.DateTime? _lastReplicationUpdateTime; + + /// Gets or sets the latest timestamp that replication status is updated. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public global::System.DateTime? LastReplicationUpdateTime { get => this._lastReplicationUpdateTime; } + + /// Internal Acessors for ActiveLocation + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectedItemActiveLocation? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal.ActiveLocation { get => this._activeLocation; set { {_activeLocation = value;} } } + + /// Internal Acessors for FailoverRecoveryPointId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal.FailoverRecoveryPointId { get => this._failoverRecoveryPointId; set { {_failoverRecoveryPointId = value;} } } + + /// Internal Acessors for FirmwareType + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal.FirmwareType { get => this._firmwareType; set { {_firmwareType = value;} } } + + /// Internal Acessors for InitialReplicationProgressPercentage + int? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal.InitialReplicationProgressPercentage { get => this._initialReplicationProgressPercentage; set { {_initialReplicationProgressPercentage = value;} } } + + /// Internal Acessors for LastRecoveryPointId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal.LastRecoveryPointId { get => this._lastRecoveryPointId; set { {_lastRecoveryPointId = value;} } } + + /// Internal Acessors for LastRecoveryPointReceived + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal.LastRecoveryPointReceived { get => this._lastRecoveryPointReceived; set { {_lastRecoveryPointReceived = value;} } } + + /// Internal Acessors for LastReplicationUpdateTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal.LastReplicationUpdateTime { get => this._lastReplicationUpdateTime; set { {_lastReplicationUpdateTime = value;} } } + + /// Internal Acessors for OSName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal.OSName { get => this._oSName; set { {_oSName = value;} } } + + /// Internal Acessors for OSType + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal.OSType { get => this._oSType; set { {_oSType = value;} } } + + /// Internal Acessors for ProtectedDisk + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskProperties[] Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal.ProtectedDisk { get => this._protectedDisk; set { {_protectedDisk = value;} } } + + /// Internal Acessors for ProtectedNic + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicProperties[] Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal.ProtectedNic { get => this._protectedNic; set { {_protectedNic = value;} } } + + /// Internal Acessors for ResyncProgressPercentage + int? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal.ResyncProgressPercentage { get => this._resyncProgressPercentage; set { {_resyncProgressPercentage = value;} } } + + /// Internal Acessors for SourceApplianceName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal.SourceApplianceName { get => this._sourceApplianceName; set { {_sourceApplianceName = value;} } } + + /// Internal Acessors for SourceCpuCore + int? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal.SourceCpuCore { get => this._sourceCpuCore; set { {_sourceCpuCore = value;} } } + + /// Internal Acessors for SourceMemoryInMegaByte + double? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal.SourceMemoryInMegaByte { get => this._sourceMemoryInMegaByte; set { {_sourceMemoryInMegaByte = value;} } } + + /// Internal Acessors for SourceVMName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal.SourceVMName { get => this._sourceVMName; set { {_sourceVMName = value;} } } + + /// Internal Acessors for TargetApplianceName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal.TargetApplianceName { get => this._targetApplianceName; set { {_targetApplianceName = value;} } } + + /// Internal Acessors for TargetAzStackHciClusterName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal.TargetAzStackHciClusterName { get => this._targetAzStackHciClusterName; set { {_targetAzStackHciClusterName = value;} } } + + /// Internal Acessors for TargetLocation + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal.TargetLocation { get => this._targetLocation; set { {_targetLocation = value;} } } + + /// Internal Acessors for TargetVMBiosId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal.TargetVMBiosId { get => this._targetVMBiosId; set { {_targetVMBiosId = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcinicInput[] _nicsToInclude; + + /// Gets or sets the list of VM NIC to replicate. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcinicInput[] NicsToInclude { get => this._nicsToInclude; set => this._nicsToInclude = value; } + + /// Backing field for property. + private string _oSName; + + /// Gets or sets the name of the OS. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string OSName { get => this._oSName; } + + /// Backing field for property. + private string _oSType; + + /// Gets or sets the type of the OS. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string OSType { get => this._oSType; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskProperties[] _protectedDisk; + + /// Gets or sets the list of protected disks. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskProperties[] ProtectedDisk { get => this._protectedDisk; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicProperties[] _protectedNic; + + /// Gets or sets the VM NIC details. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicProperties[] ProtectedNic { get => this._protectedNic; } + + /// Backing field for property. + private int? _resyncProgressPercentage; + + /// + /// Gets or sets the resync progress percentage. This is calculated based on total bytes + /// processed for all disks in the source VM. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public int? ResyncProgressPercentage { get => this._resyncProgressPercentage; } + + /// Backing field for property. + private string _runAsAccountId; + + /// Gets or sets the Run As account Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string RunAsAccountId { get => this._runAsAccountId; set => this._runAsAccountId = value; } + + /// Backing field for property. + private string _sourceApplianceName; + + /// Gets or sets the source appliance name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string SourceApplianceName { get => this._sourceApplianceName; } + + /// Backing field for property. + private int? _sourceCpuCore; + + /// Gets or sets the source VM CPU cores. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public int? SourceCpuCore { get => this._sourceCpuCore; } + + /// Backing field for property. + private string _sourceDraName; + + /// Gets or sets the source DRA name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string SourceDraName { get => this._sourceDraName; set => this._sourceDraName = value; } + + /// Backing field for property. + private double? _sourceMemoryInMegaByte; + + /// Gets or sets the source VM ram memory size in megabytes. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public double? SourceMemoryInMegaByte { get => this._sourceMemoryInMegaByte; } + + /// Backing field for property. + private string _sourceVMName; + + /// Gets or sets the source VM display name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string SourceVMName { get => this._sourceVMName; } + + /// Backing field for property. + private string _storageContainerId; + + /// Gets or sets the target storage container ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string StorageContainerId { get => this._storageContainerId; set => this._storageContainerId = value; } + + /// Backing field for property. + private string _targetApplianceName; + + /// Gets or sets the target appliance name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TargetApplianceName { get => this._targetApplianceName; } + + /// Backing field for property. + private string _targetArcClusterCustomLocationId; + + /// Gets or sets the Target Arc Cluster Custom Location ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TargetArcClusterCustomLocationId { get => this._targetArcClusterCustomLocationId; set => this._targetArcClusterCustomLocationId = value; } + + /// Backing field for property. + private string _targetAzStackHciClusterName; + + /// Gets or sets the Target AzStackHCI cluster name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TargetAzStackHciClusterName { get => this._targetAzStackHciClusterName; } + + /// Backing field for property. + private int? _targetCpuCore; + + /// Gets or sets the target CPU cores. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public int? TargetCpuCore { get => this._targetCpuCore; set => this._targetCpuCore = value; } + + /// Backing field for property. + private string _targetDraName; + + /// Gets or sets the target DRA name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TargetDraName { get => this._targetDraName; set => this._targetDraName = value; } + + /// Backing field for property. + private string _targetHciClusterId; + + /// Gets or sets the Target HCI Cluster ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TargetHciClusterId { get => this._targetHciClusterId; set => this._targetHciClusterId = value; } + + /// Backing field for property. + private string _targetLocation; + + /// Gets or sets the target location. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TargetLocation { get => this._targetLocation; } + + /// Backing field for property. + private int? _targetMemoryInMegaByte; + + /// Gets or sets the target memory in mega-bytes. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public int? TargetMemoryInMegaByte { get => this._targetMemoryInMegaByte; set => this._targetMemoryInMegaByte = value; } + + /// Backing field for property. + private string _targetNetworkId; + + /// Gets or sets the target network Id within AzStackHCI Cluster. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TargetNetworkId { get => this._targetNetworkId; set => this._targetNetworkId = value; } + + /// Backing field for property. + private string _targetResourceGroupId; + + /// Gets or sets the target resource group ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TargetResourceGroupId { get => this._targetResourceGroupId; set => this._targetResourceGroupId = value; } + + /// Backing field for property. + private string _targetVMBiosId; + + /// Gets or sets the BIOS Id of the target AzStackHCI VM. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TargetVMBiosId { get => this._targetVMBiosId; } + + /// Backing field for property. + private string _targetVMName; + + /// Gets or sets the target VM display name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TargetVMName { get => this._targetVMName; set => this._targetVMName = value; } + + /// Backing field for property. + private string _testNetworkId; + + /// Gets or sets the target test network Id within AzStackHCI Cluster. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TestNetworkId { get => this._testNetworkId; set => this._testNetworkId = value; } + + /// + /// Creates an new instance. + /// + public HyperVToAzStackHciprotectedItemModelCustomProperties() + { + + } + + /// 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.Migrate.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__protectedItemModelCustomProperties), __protectedItemModelCustomProperties); + await eventListener.AssertObjectIsValid(nameof(__protectedItemModelCustomProperties), __protectedItemModelCustomProperties); + } + } + /// HyperV to AzStackHCI Protected item model custom properties. + public partial interface IHyperVToAzStackHciprotectedItemModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCustomProperties + { + /// Gets or sets the location of the protected item. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the location of the protected item.", + SerializedName = @"activeLocation", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectedItemActiveLocation) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectedItemActiveLocation? ActiveLocation { get; } + /// Gets or sets the location of Azure Arc HCI custom location resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the location of Azure Arc HCI custom location resource.", + SerializedName = @"customLocationRegion", + PossibleTypes = new [] { typeof(string) })] + string CustomLocationRegion { get; set; } + /// Gets or sets the list of disks to replicate. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the list of disks to replicate.", + SerializedName = @"disksToInclude", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcidiskInput) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcidiskInput[] DisksToInclude { get; set; } + /// Protected item dynamic memory config. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Protected item dynamic memory config.", + SerializedName = @"dynamicMemoryConfig", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemDynamicMemoryConfig) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemDynamicMemoryConfig DynamicMemoryConfig { get; set; } + /// Gets or sets the ARM Id of the discovered machine. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the ARM Id of the discovered machine.", + SerializedName = @"fabricDiscoveryMachineId", + PossibleTypes = new [] { typeof(string) })] + string FabricDiscoveryMachineId { get; set; } + /// Gets or sets the recovery point Id to which the VM was failed over. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the recovery point Id to which the VM was failed over.", + SerializedName = @"failoverRecoveryPointId", + PossibleTypes = new [] { typeof(string) })] + string FailoverRecoveryPointId { get; } + /// Gets or sets the firmware type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the firmware type.", + SerializedName = @"firmwareType", + PossibleTypes = new [] { typeof(string) })] + string FirmwareType { get; } + /// Gets or sets the hypervisor generation of the virtual machine. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the hypervisor generation of the virtual machine.", + SerializedName = @"hyperVGeneration", + PossibleTypes = new [] { typeof(string) })] + string HyperVGeneration { get; set; } + /// + /// Gets or sets the initial replication progress percentage. This is calculated based on + /// total bytes processed for all disks in the source VM. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets 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; } + /// Gets or sets a value indicating whether memory is dynamical. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets a value indicating whether memory is dynamical.", + SerializedName = @"isDynamicRam", + PossibleTypes = new [] { typeof(bool) })] + bool? IsDynamicRam { get; set; } + /// Gets or sets the last recovery point Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the last recovery point Id.", + SerializedName = @"lastRecoveryPointId", + PossibleTypes = new [] { typeof(string) })] + string LastRecoveryPointId { get; } + /// Gets or sets the last recovery point received time. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the last recovery point received time.", + SerializedName = @"lastRecoveryPointReceived", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastRecoveryPointReceived { get; } + /// Gets or sets the latest timestamp that replication status is updated. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the latest timestamp that replication status is updated.", + SerializedName = @"lastReplicationUpdateTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastReplicationUpdateTime { get; } + /// Gets or sets the list of VM NIC to replicate. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the list of VM NIC to replicate.", + SerializedName = @"nicsToInclude", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcinicInput) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcinicInput[] NicsToInclude { get; set; } + /// Gets or sets the name of the OS. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the name of the OS.", + SerializedName = @"osName", + PossibleTypes = new [] { typeof(string) })] + string OSName { get; } + /// Gets or sets the type of the OS. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the type of the OS.", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(string) })] + string OSType { get; } + /// Gets or sets the list of protected disks. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the list of protected disks.", + SerializedName = @"protectedDisks", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskProperties) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskProperties[] ProtectedDisk { get; } + /// Gets or sets the VM NIC details. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the VM NIC details.", + SerializedName = @"protectedNics", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicProperties) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicProperties[] ProtectedNic { get; } + /// + /// Gets or sets the resync progress percentage. This is calculated based on total bytes + /// processed for all disks in the source VM. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets 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; } + /// Gets or sets the Run As account Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the Run As account Id.", + SerializedName = @"runAsAccountId", + PossibleTypes = new [] { typeof(string) })] + string RunAsAccountId { get; set; } + /// Gets or sets the source appliance name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the source appliance name.", + SerializedName = @"sourceApplianceName", + PossibleTypes = new [] { typeof(string) })] + string SourceApplianceName { get; } + /// Gets or sets the source VM CPU cores. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the source VM CPU cores.", + SerializedName = @"sourceCpuCores", + PossibleTypes = new [] { typeof(int) })] + int? SourceCpuCore { get; } + /// Gets or sets the source DRA name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the source DRA name.", + SerializedName = @"sourceDraName", + PossibleTypes = new [] { typeof(string) })] + string SourceDraName { get; set; } + /// Gets or sets the source VM ram memory size in megabytes. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the source VM ram memory size in megabytes.", + SerializedName = @"sourceMemoryInMegaBytes", + PossibleTypes = new [] { typeof(double) })] + double? SourceMemoryInMegaByte { get; } + /// Gets or sets the source VM display name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the source VM display name.", + SerializedName = @"sourceVmName", + PossibleTypes = new [] { typeof(string) })] + string SourceVMName { get; } + /// Gets or sets the target storage container ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the target storage container ARM Id.", + SerializedName = @"storageContainerId", + PossibleTypes = new [] { typeof(string) })] + string StorageContainerId { get; set; } + /// Gets or sets the target appliance name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the target appliance name.", + SerializedName = @"targetApplianceName", + PossibleTypes = new [] { typeof(string) })] + string TargetApplianceName { get; } + /// Gets or sets the Target Arc Cluster Custom Location ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the Target Arc Cluster Custom Location ARM Id.", + SerializedName = @"targetArcClusterCustomLocationId", + PossibleTypes = new [] { typeof(string) })] + string TargetArcClusterCustomLocationId { get; set; } + /// Gets or sets the Target AzStackHCI cluster name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the Target AzStackHCI cluster name.", + SerializedName = @"targetAzStackHciClusterName", + PossibleTypes = new [] { typeof(string) })] + string TargetAzStackHciClusterName { get; } + /// Gets or sets the target CPU cores. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the target CPU cores.", + SerializedName = @"targetCpuCores", + PossibleTypes = new [] { typeof(int) })] + int? TargetCpuCore { get; set; } + /// Gets or sets the target DRA name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the target DRA name.", + SerializedName = @"targetDraName", + PossibleTypes = new [] { typeof(string) })] + string TargetDraName { get; set; } + /// Gets or sets the Target HCI Cluster ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the Target HCI Cluster ARM Id.", + SerializedName = @"targetHciClusterId", + PossibleTypes = new [] { typeof(string) })] + string TargetHciClusterId { get; set; } + /// Gets or sets the target location. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the target location.", + SerializedName = @"targetLocation", + PossibleTypes = new [] { typeof(string) })] + string TargetLocation { get; } + /// Gets or sets the target memory in mega-bytes. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the target memory in mega-bytes.", + SerializedName = @"targetMemoryInMegaBytes", + PossibleTypes = new [] { typeof(int) })] + int? TargetMemoryInMegaByte { get; set; } + /// Gets or sets the target network Id within AzStackHCI Cluster. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the target network Id within AzStackHCI Cluster.", + SerializedName = @"targetNetworkId", + PossibleTypes = new [] { typeof(string) })] + string TargetNetworkId { get; set; } + /// Gets or sets the target resource group ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the target resource group ARM Id.", + SerializedName = @"targetResourceGroupId", + PossibleTypes = new [] { typeof(string) })] + string TargetResourceGroupId { get; set; } + /// Gets or sets the BIOS Id of the target AzStackHCI VM. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the BIOS Id of the target AzStackHCI VM.", + SerializedName = @"targetVmBiosId", + PossibleTypes = new [] { typeof(string) })] + string TargetVMBiosId { get; } + /// Gets or sets the target VM display name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the target VM display name.", + SerializedName = @"targetVmName", + PossibleTypes = new [] { typeof(string) })] + string TargetVMName { get; set; } + /// Gets or sets the target test network Id within AzStackHCI Cluster. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the target test network Id within AzStackHCI Cluster.", + SerializedName = @"testNetworkId", + PossibleTypes = new [] { typeof(string) })] + string TestNetworkId { get; set; } + + } + /// HyperV to AzStackHCI Protected item model custom properties. + internal partial interface IHyperVToAzStackHciprotectedItemModelCustomPropertiesInternal : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCustomPropertiesInternal + { + /// Gets or sets the location of the protected item. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectedItemActiveLocation? ActiveLocation { get; set; } + /// Gets or sets the location of Azure Arc HCI custom location resource. + string CustomLocationRegion { get; set; } + /// Gets or sets the list of disks to replicate. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcidiskInput[] DisksToInclude { get; set; } + /// Protected item dynamic memory config. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemDynamicMemoryConfig DynamicMemoryConfig { get; set; } + /// Gets or sets the ARM Id of the discovered machine. + string FabricDiscoveryMachineId { get; set; } + /// Gets or sets the recovery point Id to which the VM was failed over. + string FailoverRecoveryPointId { get; set; } + /// Gets or sets the firmware type. + string FirmwareType { get; set; } + /// Gets or sets the hypervisor generation of the virtual machine. + string HyperVGeneration { get; set; } + /// + /// Gets or sets the initial replication progress percentage. This is calculated based on + /// total bytes processed for all disks in the source VM. + /// + int? InitialReplicationProgressPercentage { get; set; } + /// Gets or sets a value indicating whether memory is dynamical. + bool? IsDynamicRam { get; set; } + /// Gets or sets the last recovery point Id. + string LastRecoveryPointId { get; set; } + /// Gets or sets the last recovery point received time. + global::System.DateTime? LastRecoveryPointReceived { get; set; } + /// Gets or sets the latest timestamp that replication status is updated. + global::System.DateTime? LastReplicationUpdateTime { get; set; } + /// Gets or sets the list of VM NIC to replicate. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcinicInput[] NicsToInclude { get; set; } + /// Gets or sets the name of the OS. + string OSName { get; set; } + /// Gets or sets the type of the OS. + string OSType { get; set; } + /// Gets or sets the list of protected disks. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskProperties[] ProtectedDisk { get; set; } + /// Gets or sets the VM NIC details. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicProperties[] ProtectedNic { get; set; } + /// + /// Gets or sets the resync progress percentage. This is calculated based on total bytes + /// processed for all disks in the source VM. + /// + int? ResyncProgressPercentage { get; set; } + /// Gets or sets the Run As account Id. + string RunAsAccountId { get; set; } + /// Gets or sets the source appliance name. + string SourceApplianceName { get; set; } + /// Gets or sets the source VM CPU cores. + int? SourceCpuCore { get; set; } + /// Gets or sets the source DRA name. + string SourceDraName { get; set; } + /// Gets or sets the source VM ram memory size in megabytes. + double? SourceMemoryInMegaByte { get; set; } + /// Gets or sets the source VM display name. + string SourceVMName { get; set; } + /// Gets or sets the target storage container ARM Id. + string StorageContainerId { get; set; } + /// Gets or sets the target appliance name. + string TargetApplianceName { get; set; } + /// Gets or sets the Target Arc Cluster Custom Location ARM Id. + string TargetArcClusterCustomLocationId { get; set; } + /// Gets or sets the Target AzStackHCI cluster name. + string TargetAzStackHciClusterName { get; set; } + /// Gets or sets the target CPU cores. + int? TargetCpuCore { get; set; } + /// Gets or sets the target DRA name. + string TargetDraName { get; set; } + /// Gets or sets the Target HCI Cluster ARM Id. + string TargetHciClusterId { get; set; } + /// Gets or sets the target location. + string TargetLocation { get; set; } + /// Gets or sets the target memory in mega-bytes. + int? TargetMemoryInMegaByte { get; set; } + /// Gets or sets the target network Id within AzStackHCI Cluster. + string TargetNetworkId { get; set; } + /// Gets or sets the target resource group ARM Id. + string TargetResourceGroupId { get; set; } + /// Gets or sets the BIOS Id of the target AzStackHCI VM. + string TargetVMBiosId { get; set; } + /// Gets or sets the target VM display name. + string TargetVMName { get; set; } + /// Gets or sets the target test network Id within AzStackHCI Cluster. + string TestNetworkId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciprotectedItemModelCustomProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciprotectedItemModelCustomProperties.json.cs new file mode 100644 index 000000000000..9cfb3cdbe684 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciprotectedItemModelCustomProperties.json.cs @@ -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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// HyperV to AzStackHCI Protected item model custom properties. + public partial class HyperVToAzStackHciprotectedItemModelCustomProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedItemModelCustomProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new HyperVToAzStackHciprotectedItemModelCustomProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal HyperVToAzStackHciprotectedItemModelCustomProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __protectedItemModelCustomProperties = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelCustomProperties(json); + {_activeLocation = If( json?.PropertyT("activeLocation"), out var __jsonActiveLocation) ? (string)__jsonActiveLocation : (string)ActiveLocation;} + {_targetHciClusterId = If( json?.PropertyT("targetHciClusterId"), out var __jsonTargetHciClusterId) ? (string)__jsonTargetHciClusterId : (string)TargetHciClusterId;} + {_targetArcClusterCustomLocationId = If( json?.PropertyT("targetArcClusterCustomLocationId"), out var __jsonTargetArcClusterCustomLocationId) ? (string)__jsonTargetArcClusterCustomLocationId : (string)TargetArcClusterCustomLocationId;} + {_targetAzStackHciClusterName = If( json?.PropertyT("targetAzStackHciClusterName"), out var __jsonTargetAzStackHciClusterName) ? (string)__jsonTargetAzStackHciClusterName : (string)TargetAzStackHciClusterName;} + {_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.Migrate.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.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcidiskInput) (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHcidiskInput.FromJson(__u) )) ))() : null : DisksToInclude;} + {_nicsToInclude = If( json?.PropertyT("nicsToInclude"), out var __jsonNicsToInclude) ? If( __jsonNicsToInclude as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcinicInput) (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHcinicInput.FromJson(__p) )) ))() : null : NicsToInclude;} + {_sourceVMName = If( json?.PropertyT("sourceVmName"), out var __jsonSourceVMName) ? (string)__jsonSourceVMName : (string)SourceVMName;} + {_sourceCpuCore = If( json?.PropertyT("sourceCpuCores"), out var __jsonSourceCpuCores) ? (int?)__jsonSourceCpuCores : SourceCpuCore;} + {_sourceMemoryInMegaByte = If( json?.PropertyT("sourceMemoryInMegaBytes"), out var __jsonSourceMemoryInMegaBytes) ? (double?)__jsonSourceMemoryInMegaBytes : SourceMemoryInMegaByte;} + {_targetVMName = If( json?.PropertyT("targetVmName"), out var __jsonTargetVMName) ? (string)__jsonTargetVMName : (string)TargetVMName;} + {_targetResourceGroupId = If( json?.PropertyT("targetResourceGroupId"), out var __jsonTargetResourceGroupId) ? (string)__jsonTargetResourceGroupId : (string)TargetResourceGroupId;} + {_storageContainerId = If( json?.PropertyT("storageContainerId"), out var __jsonStorageContainerId) ? (string)__jsonStorageContainerId : (string)StorageContainerId;} + {_hyperVGeneration = If( json?.PropertyT("hyperVGeneration"), out var __jsonHyperVGeneration) ? (string)__jsonHyperVGeneration : (string)HyperVGeneration;} + {_targetNetworkId = If( json?.PropertyT("targetNetworkId"), out var __jsonTargetNetworkId) ? (string)__jsonTargetNetworkId : (string)TargetNetworkId;} + {_testNetworkId = If( json?.PropertyT("testNetworkId"), out var __jsonTestNetworkId) ? (string)__jsonTestNetworkId : (string)TestNetworkId;} + {_targetCpuCore = If( json?.PropertyT("targetCpuCores"), out var __jsonTargetCpuCores) ? (int?)__jsonTargetCpuCores : TargetCpuCore;} + {_isDynamicRam = If( json?.PropertyT("isDynamicRam"), out var __jsonIsDynamicRam) ? (bool?)__jsonIsDynamicRam : IsDynamicRam;} + {_dynamicMemoryConfig = If( json?.PropertyT("dynamicMemoryConfig"), out var __jsonDynamicMemoryConfig) ? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemDynamicMemoryConfig.FromJson(__jsonDynamicMemoryConfig) : DynamicMemoryConfig;} + {_targetMemoryInMegaByte = If( json?.PropertyT("targetMemoryInMegaBytes"), out var __jsonTargetMemoryInMegaBytes) ? (int?)__jsonTargetMemoryInMegaBytes : TargetMemoryInMegaByte;} + {_runAsAccountId = If( json?.PropertyT("runAsAccountId"), out var __jsonRunAsAccountId) ? (string)__jsonRunAsAccountId : (string)RunAsAccountId;} + {_sourceDraName = If( json?.PropertyT("sourceDraName"), out var __jsonSourceDraName) ? (string)__jsonSourceDraName : (string)SourceDraName;} + {_targetDraName = If( json?.PropertyT("targetDraName"), out var __jsonTargetDraName) ? (string)__jsonTargetDraName : (string)TargetDraName;} + {_sourceApplianceName = If( json?.PropertyT("sourceApplianceName"), out var __jsonSourceApplianceName) ? (string)__jsonSourceApplianceName : (string)SourceApplianceName;} + {_targetApplianceName = If( json?.PropertyT("targetApplianceName"), out var __jsonTargetApplianceName) ? (string)__jsonTargetApplianceName : (string)TargetApplianceName;} + {_oSType = If( json?.PropertyT("osType"), out var __jsonOSType) ? (string)__jsonOSType : (string)OSType;} + {_oSName = If( json?.PropertyT("osName"), out var __jsonOSName) ? (string)__jsonOSName : (string)OSName;} + {_firmwareType = If( json?.PropertyT("firmwareType"), out var __jsonFirmwareType) ? (string)__jsonFirmwareType : (string)FirmwareType;} + {_targetLocation = If( json?.PropertyT("targetLocation"), out var __jsonTargetLocation) ? (string)__jsonTargetLocation : (string)TargetLocation;} + {_customLocationRegion = If( json?.PropertyT("customLocationRegion"), out var __jsonCustomLocationRegion) ? (string)__jsonCustomLocationRegion : (string)CustomLocationRegion;} + {_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;} + {_lastRecoveryPointId = If( json?.PropertyT("lastRecoveryPointId"), out var __jsonLastRecoveryPointId) ? (string)__jsonLastRecoveryPointId : (string)LastRecoveryPointId;} + {_initialReplicationProgressPercentage = If( json?.PropertyT("initialReplicationProgressPercentage"), out var __jsonInitialReplicationProgressPercentage) ? (int?)__jsonInitialReplicationProgressPercentage : InitialReplicationProgressPercentage;} + {_resyncProgressPercentage = If( json?.PropertyT("resyncProgressPercentage"), out var __jsonResyncProgressPercentage) ? (int?)__jsonResyncProgressPercentage : ResyncProgressPercentage;} + {_protectedDisk = If( json?.PropertyT("protectedDisks"), out var __jsonProtectedDisks) ? If( __jsonProtectedDisks as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedDiskProperties) (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHciprotectedDiskProperties.FromJson(__k) )) ))() : null : ProtectedDisk;} + {_protectedNic = If( json?.PropertyT("protectedNics"), out var __jsonProtectedNics) ? If( __jsonProtectedNics as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicProperties) (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HyperVToAzStackHciprotectedNicProperties.FromJson(__f) )) ))() : null : ProtectedNic;} + {_targetVMBiosId = If( json?.PropertyT("targetVmBiosId"), out var __jsonTargetVMBiosId) ? (string)__jsonTargetVMBiosId : (string)TargetVMBiosId;} + {_lastReplicationUpdateTime = If( json?.PropertyT("lastReplicationUpdateTime"), out var __jsonLastReplicationUpdateTime) ? global::System.DateTime.TryParse((string)__jsonLastReplicationUpdateTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastReplicationUpdateTimeValue) ? __jsonLastReplicationUpdateTimeValue : LastReplicationUpdateTime : LastReplicationUpdateTime;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __protectedItemModelCustomProperties?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._activeLocation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._activeLocation.ToString()) : null, "activeLocation" ,container.Add ); + } + AddIf( null != (((object)this._targetHciClusterId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._targetHciClusterId.ToString()) : null, "targetHciClusterId" ,container.Add ); + AddIf( null != (((object)this._targetArcClusterCustomLocationId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._targetArcClusterCustomLocationId.ToString()) : null, "targetArcClusterCustomLocationId" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._targetAzStackHciClusterName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._targetAzStackHciClusterName.ToString()) : null, "targetAzStackHciClusterName" ,container.Add ); + } + AddIf( null != (((object)this._fabricDiscoveryMachineId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._fabricDiscoveryMachineId.ToString()) : null, "fabricDiscoveryMachineId" ,container.Add ); + if (null != this._disksToInclude) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.XNodeArray(); + foreach( var __x in this._disksToInclude ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("disksToInclude",__w); + } + if (null != this._nicsToInclude) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.XNodeArray(); + foreach( var __s in this._nicsToInclude ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("nicsToInclude",__r); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._sourceVMName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._sourceVMName.ToString()) : null, "sourceVmName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._sourceCpuCore ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNumber((int)this._sourceCpuCore) : null, "sourceCpuCores" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._sourceMemoryInMegaByte ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNumber((double)this._sourceMemoryInMegaByte) : null, "sourceMemoryInMegaBytes" ,container.Add ); + } + AddIf( null != (((object)this._targetVMName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._targetVMName.ToString()) : null, "targetVmName" ,container.Add ); + AddIf( null != (((object)this._targetResourceGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._targetResourceGroupId.ToString()) : null, "targetResourceGroupId" ,container.Add ); + AddIf( null != (((object)this._storageContainerId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._storageContainerId.ToString()) : null, "storageContainerId" ,container.Add ); + AddIf( null != (((object)this._hyperVGeneration)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._hyperVGeneration.ToString()) : null, "hyperVGeneration" ,container.Add ); + AddIf( null != (((object)this._targetNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._targetNetworkId.ToString()) : null, "targetNetworkId" ,container.Add ); + AddIf( null != (((object)this._testNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._testNetworkId.ToString()) : null, "testNetworkId" ,container.Add ); + AddIf( null != this._targetCpuCore ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNumber((int)this._targetCpuCore) : null, "targetCpuCores" ,container.Add ); + AddIf( null != this._isDynamicRam ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonBoolean((bool)this._isDynamicRam) : null, "isDynamicRam" ,container.Add ); + AddIf( null != this._dynamicMemoryConfig ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._dynamicMemoryConfig.ToJson(null,serializationMode) : null, "dynamicMemoryConfig" ,container.Add ); + AddIf( null != this._targetMemoryInMegaByte ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNumber((int)this._targetMemoryInMegaByte) : null, "targetMemoryInMegaBytes" ,container.Add ); + AddIf( null != (((object)this._runAsAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._runAsAccountId.ToString()) : null, "runAsAccountId" ,container.Add ); + AddIf( null != (((object)this._sourceDraName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._sourceDraName.ToString()) : null, "sourceDraName" ,container.Add ); + AddIf( null != (((object)this._targetDraName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._targetDraName.ToString()) : null, "targetDraName" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._sourceApplianceName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._sourceApplianceName.ToString()) : null, "sourceApplianceName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._targetApplianceName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._targetApplianceName.ToString()) : null, "targetApplianceName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._oSType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._oSType.ToString()) : null, "osType" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._oSName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._oSName.ToString()) : null, "osName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._firmwareType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._firmwareType.ToString()) : null, "firmwareType" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._targetLocation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._targetLocation.ToString()) : null, "targetLocation" ,container.Add ); + } + AddIf( null != (((object)this._customLocationRegion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._customLocationRegion.ToString()) : null, "customLocationRegion" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._failoverRecoveryPointId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._failoverRecoveryPointId.ToString()) : null, "failoverRecoveryPointId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._lastRecoveryPointReceived ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._lastRecoveryPointId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._lastRecoveryPointId.ToString()) : null, "lastRecoveryPointId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._initialReplicationProgressPercentage ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNumber((int)this._initialReplicationProgressPercentage) : null, "initialReplicationProgressPercentage" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._resyncProgressPercentage ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNumber((int)this._resyncProgressPercentage) : null, "resyncProgressPercentage" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._protectedDisk) + { + var __m = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.XNodeArray(); + foreach( var __n in this._protectedDisk ) + { + AddIf(__n?.ToJson(null, serializationMode) ,__m.Add); + } + container.Add("protectedDisks",__m); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._protectedNic) + { + var __h = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.XNodeArray(); + foreach( var __i in this._protectedNic ) + { + AddIf(__i?.ToJson(null, serializationMode) ,__h.Add); + } + container.Add("protectedNics",__h); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._targetVMBiosId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._targetVMBiosId.ToString()) : null, "targetVmBiosId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._lastReplicationUpdateTime ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._lastReplicationUpdateTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastReplicationUpdateTime" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciprotectedNicProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciprotectedNicProperties.PowerShell.cs new file mode 100644 index 000000000000..96965e945c99 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciprotectedNicProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// HyperVToAzStackHCI NIC properties. + [System.ComponentModel.TypeConverter(typeof(HyperVToAzStackHciprotectedNicPropertiesTypeConverter))] + public partial class HyperVToAzStackHciprotectedNicProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVToAzStackHciprotectedNicProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVToAzStackHciprotectedNicProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVToAzStackHciprotectedNicProperties(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.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicPropertiesInternal)this).NicId = (string) content.GetValueForProperty("NicId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicPropertiesInternal)this).NicId, global::System.Convert.ToString); + } + if (content.Contains("MacAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicPropertiesInternal)this).MacAddress = (string) content.GetValueForProperty("MacAddress",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicPropertiesInternal)this).MacAddress, global::System.Convert.ToString); + } + if (content.Contains("NetworkName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicPropertiesInternal)this).NetworkName = (string) content.GetValueForProperty("NetworkName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicPropertiesInternal)this).NetworkName, global::System.Convert.ToString); + } + if (content.Contains("TargetNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicPropertiesInternal)this).TargetNetworkId = (string) content.GetValueForProperty("TargetNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicPropertiesInternal)this).TargetNetworkId, global::System.Convert.ToString); + } + if (content.Contains("TestNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicPropertiesInternal)this).TestNetworkId = (string) content.GetValueForProperty("TestNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicPropertiesInternal)this).TestNetworkId, global::System.Convert.ToString); + } + if (content.Contains("SelectionTypeForFailover")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicPropertiesInternal)this).SelectionTypeForFailover = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection?) content.GetValueForProperty("SelectionTypeForFailover",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicPropertiesInternal)this).SelectionTypeForFailover, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal HyperVToAzStackHciprotectedNicProperties(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.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicPropertiesInternal)this).NicId = (string) content.GetValueForProperty("NicId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicPropertiesInternal)this).NicId, global::System.Convert.ToString); + } + if (content.Contains("MacAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicPropertiesInternal)this).MacAddress = (string) content.GetValueForProperty("MacAddress",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicPropertiesInternal)this).MacAddress, global::System.Convert.ToString); + } + if (content.Contains("NetworkName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicPropertiesInternal)this).NetworkName = (string) content.GetValueForProperty("NetworkName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicPropertiesInternal)this).NetworkName, global::System.Convert.ToString); + } + if (content.Contains("TargetNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicPropertiesInternal)this).TargetNetworkId = (string) content.GetValueForProperty("TargetNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicPropertiesInternal)this).TargetNetworkId, global::System.Convert.ToString); + } + if (content.Contains("TestNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicPropertiesInternal)this).TestNetworkId = (string) content.GetValueForProperty("TestNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicPropertiesInternal)this).TestNetworkId, global::System.Convert.ToString); + } + if (content.Contains("SelectionTypeForFailover")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicPropertiesInternal)this).SelectionTypeForFailover = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection?) content.GetValueForProperty("SelectionTypeForFailover",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicPropertiesInternal)this).SelectionTypeForFailover, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// HyperVToAzStackHCI NIC properties. + [System.ComponentModel.TypeConverter(typeof(HyperVToAzStackHciprotectedNicPropertiesTypeConverter))] + public partial interface IHyperVToAzStackHciprotectedNicProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciprotectedNicProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciprotectedNicProperties.TypeConverter.cs new file mode 100644 index 000000000000..b6503703c7b9 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciprotectedNicProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVToAzStackHciprotectedNicPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVToAzStackHciprotectedNicProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVToAzStackHciprotectedNicProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVToAzStackHciprotectedNicProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciprotectedNicProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciprotectedNicProperties.cs new file mode 100644 index 000000000000..4fc8049e5821 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciprotectedNicProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// HyperVToAzStackHCI NIC properties. + public partial class HyperVToAzStackHciprotectedNicProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicPropertiesInternal + { + + /// Backing field for property. + private string _macAddress; + + /// Gets or sets the NIC mac address. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string MacAddress { get => this._macAddress; } + + /// Internal Acessors for MacAddress + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicPropertiesInternal.MacAddress { get => this._macAddress; set { {_macAddress = value;} } } + + /// Internal Acessors for NetworkName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicPropertiesInternal.NetworkName { get => this._networkName; set { {_networkName = value;} } } + + /// Internal Acessors for NicId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicPropertiesInternal.NicId { get => this._nicId; set { {_nicId = value;} } } + + /// Internal Acessors for SelectionTypeForFailover + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicPropertiesInternal.SelectionTypeForFailover { get => this._selectionTypeForFailover; set { {_selectionTypeForFailover = value;} } } + + /// Internal Acessors for TargetNetworkId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicPropertiesInternal.TargetNetworkId { get => this._targetNetworkId; set { {_targetNetworkId = value;} } } + + /// Internal Acessors for TestNetworkId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicPropertiesInternal.TestNetworkId { get => this._testNetworkId; set { {_testNetworkId = value;} } } + + /// Backing field for property. + private string _networkName; + + /// Gets or sets the network name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string NetworkName { get => this._networkName; } + + /// Backing field for property. + private string _nicId; + + /// Gets or sets the NIC Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string NicId { get => this._nicId; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection? _selectionTypeForFailover; + + /// Gets or sets the selection type of the NIC. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection? SelectionTypeForFailover { get => this._selectionTypeForFailover; } + + /// Backing field for property. + private string _targetNetworkId; + + /// Gets or sets the target network Id within AzStackHCI Cluster. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TargetNetworkId { get => this._targetNetworkId; } + + /// Backing field for property. + private string _testNetworkId; + + /// Gets or sets the target test network Id within AzStackHCI Cluster. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TestNetworkId { get => this._testNetworkId; } + + /// + /// Creates an new instance. + /// + public HyperVToAzStackHciprotectedNicProperties() + { + + } + } + /// HyperVToAzStackHCI NIC properties. + public partial interface IHyperVToAzStackHciprotectedNicProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the NIC mac address. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the NIC mac address.", + SerializedName = @"macAddress", + PossibleTypes = new [] { typeof(string) })] + string MacAddress { get; } + /// Gets or sets the network name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the network name.", + SerializedName = @"networkName", + PossibleTypes = new [] { typeof(string) })] + string NetworkName { get; } + /// Gets or sets the NIC Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the NIC Id.", + SerializedName = @"nicId", + PossibleTypes = new [] { typeof(string) })] + string NicId { get; } + /// Gets or sets the selection type of the NIC. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the selection type of the NIC.", + SerializedName = @"selectionTypeForFailover", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection? SelectionTypeForFailover { get; } + /// Gets or sets the target network Id within AzStackHCI Cluster. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the target network Id within AzStackHCI Cluster.", + SerializedName = @"targetNetworkId", + PossibleTypes = new [] { typeof(string) })] + string TargetNetworkId { get; } + /// Gets or sets the target test network Id within AzStackHCI Cluster. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the target test network Id within AzStackHCI Cluster.", + SerializedName = @"testNetworkId", + PossibleTypes = new [] { typeof(string) })] + string TestNetworkId { get; } + + } + /// HyperVToAzStackHCI NIC properties. + internal partial interface IHyperVToAzStackHciprotectedNicPropertiesInternal + + { + /// Gets or sets the NIC mac address. + string MacAddress { get; set; } + /// Gets or sets the network name. + string NetworkName { get; set; } + /// Gets or sets the NIC Id. + string NicId { get; set; } + /// Gets or sets the selection type of the NIC. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection? SelectionTypeForFailover { get; set; } + /// Gets or sets the target network Id within AzStackHCI Cluster. + string TargetNetworkId { get; set; } + /// Gets or sets the target test network Id within AzStackHCI Cluster. + string TestNetworkId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciprotectedNicProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciprotectedNicProperties.json.cs new file mode 100644 index 000000000000..887d63d31cc7 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHciprotectedNicProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// HyperVToAzStackHCI NIC properties. + public partial class HyperVToAzStackHciprotectedNicProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHciprotectedNicProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new HyperVToAzStackHciprotectedNicProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal HyperVToAzStackHciprotectedNicProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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;} + {_macAddress = If( json?.PropertyT("macAddress"), out var __jsonMacAddress) ? (string)__jsonMacAddress : (string)MacAddress;} + {_networkName = If( json?.PropertyT("networkName"), out var __jsonNetworkName) ? (string)__jsonNetworkName : (string)NetworkName;} + {_targetNetworkId = If( json?.PropertyT("targetNetworkId"), out var __jsonTargetNetworkId) ? (string)__jsonTargetNetworkId : (string)TargetNetworkId;} + {_testNetworkId = If( json?.PropertyT("testNetworkId"), out var __jsonTestNetworkId) ? (string)__jsonTestNetworkId : (string)TestNetworkId;} + {_selectionTypeForFailover = If( json?.PropertyT("selectionTypeForFailover"), out var __jsonSelectionTypeForFailover) ? (string)__jsonSelectionTypeForFailover : (string)SelectionTypeForFailover;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._nicId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._nicId.ToString()) : null, "nicId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._macAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._macAddress.ToString()) : null, "macAddress" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._networkName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._networkName.ToString()) : null, "networkName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._targetNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._targetNetworkId.ToString()) : null, "targetNetworkId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._testNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._testNetworkId.ToString()) : null, "testNetworkId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._selectionTypeForFailover)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._selectionTypeForFailover.ToString()) : null, "selectionTypeForFailover" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcirecoveryPointModelCustomProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcirecoveryPointModelCustomProperties.PowerShell.cs new file mode 100644 index 000000000000..7a04ffdbfc62 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcirecoveryPointModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// HyperV to AzStackHCI recovery point model custom properties. + [System.ComponentModel.TypeConverter(typeof(HyperVToAzStackHcirecoveryPointModelCustomPropertiesTypeConverter))] + public partial class HyperVToAzStackHcirecoveryPointModelCustomProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcirecoveryPointModelCustomProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVToAzStackHcirecoveryPointModelCustomProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcirecoveryPointModelCustomProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVToAzStackHcirecoveryPointModelCustomProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content + /// from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcirecoveryPointModelCustomProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVToAzStackHcirecoveryPointModelCustomProperties(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.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcirecoveryPointModelCustomPropertiesInternal)this).DiskId = (string[]) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcirecoveryPointModelCustomPropertiesInternal)this).DiskId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCustomPropertiesInternal)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 HyperVToAzStackHcirecoveryPointModelCustomProperties(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.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcirecoveryPointModelCustomPropertiesInternal)this).DiskId = (string[]) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcirecoveryPointModelCustomPropertiesInternal)this).DiskId, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCustomPropertiesInternal)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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// HyperV to AzStackHCI recovery point model custom properties. + [System.ComponentModel.TypeConverter(typeof(HyperVToAzStackHcirecoveryPointModelCustomPropertiesTypeConverter))] + public partial interface IHyperVToAzStackHcirecoveryPointModelCustomProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcirecoveryPointModelCustomProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcirecoveryPointModelCustomProperties.TypeConverter.cs new file mode 100644 index 000000000000..c8a5cdb32858 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcirecoveryPointModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVToAzStackHcirecoveryPointModelCustomPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a + /// type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcirecoveryPointModelCustomProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcirecoveryPointModelCustomProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVToAzStackHcirecoveryPointModelCustomProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVToAzStackHcirecoveryPointModelCustomProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVToAzStackHcirecoveryPointModelCustomProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcirecoveryPointModelCustomProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcirecoveryPointModelCustomProperties.cs new file mode 100644 index 000000000000..80d4efc32a0f --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcirecoveryPointModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// HyperV to AzStackHCI recovery point model custom properties. + public partial class HyperVToAzStackHcirecoveryPointModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcirecoveryPointModelCustomProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcirecoveryPointModelCustomPropertiesInternal, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCustomProperties __recoveryPointModelCustomProperties = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.RecoveryPointModelCustomProperties(); + + /// Backing field for property. + private string[] _diskId; + + /// Gets or sets the list of the disk Ids. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string[] DiskId { get => this._diskId; } + + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCustomPropertiesInternal)__recoveryPointModelCustomProperties).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCustomPropertiesInternal)__recoveryPointModelCustomProperties).InstanceType = value ; } + + /// Internal Acessors for DiskId + string[] Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcirecoveryPointModelCustomPropertiesInternal.DiskId { get => this._diskId; set { {_diskId = value;} } } + + /// + /// Creates an new instance. + /// + public HyperVToAzStackHcirecoveryPointModelCustomProperties() + { + + } + + /// 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.Migrate.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__recoveryPointModelCustomProperties), __recoveryPointModelCustomProperties); + await eventListener.AssertObjectIsValid(nameof(__recoveryPointModelCustomProperties), __recoveryPointModelCustomProperties); + } + } + /// HyperV to AzStackHCI recovery point model custom properties. + public partial interface IHyperVToAzStackHcirecoveryPointModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCustomProperties + { + /// Gets or sets the list of the disk Ids. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the list of the disk Ids.", + SerializedName = @"diskIds", + PossibleTypes = new [] { typeof(string) })] + string[] DiskId { get; } + + } + /// HyperV to AzStackHCI recovery point model custom properties. + internal partial interface IHyperVToAzStackHcirecoveryPointModelCustomPropertiesInternal : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCustomPropertiesInternal + { + /// Gets or sets the list of the disk Ids. + string[] DiskId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcirecoveryPointModelCustomProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcirecoveryPointModelCustomProperties.json.cs new file mode 100644 index 000000000000..55579b2f12e1 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcirecoveryPointModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// HyperV to AzStackHCI recovery point model custom properties. + public partial class HyperVToAzStackHcirecoveryPointModelCustomProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcirecoveryPointModelCustomProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcirecoveryPointModelCustomProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcirecoveryPointModelCustomProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new HyperVToAzStackHcirecoveryPointModelCustomProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal HyperVToAzStackHcirecoveryPointModelCustomProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __recoveryPointModelCustomProperties = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.RecoveryPointModelCustomProperties(json); + {_diskId = If( json?.PropertyT("diskIds"), out var __jsonDiskIds) ? If( __jsonDiskIds as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : DiskId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __recoveryPointModelCustomProperties?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._diskId) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.XNodeArray(); + foreach( var __x in this._diskId ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("diskIds",__w); + } + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcireplicationExtensionModelCustomProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcireplicationExtensionModelCustomProperties.PowerShell.cs new file mode 100644 index 000000000000..88ee63f6f9b7 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcireplicationExtensionModelCustomProperties.PowerShell.cs @@ -0,0 +1,277 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// HyperV to AzStackHCI Replication extension model custom properties. + [System.ComponentModel.TypeConverter(typeof(HyperVToAzStackHcireplicationExtensionModelCustomPropertiesTypeConverter))] + public partial class HyperVToAzStackHcireplicationExtensionModelCustomProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new HyperVToAzStackHcireplicationExtensionModelCustomProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new HyperVToAzStackHcireplicationExtensionModelCustomProperties(content); + } + + /// + /// Creates a new instance of , deserializing the + /// content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal HyperVToAzStackHcireplicationExtensionModelCustomProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("HyperVFabricArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).HyperVFabricArmId = (string) content.GetValueForProperty("HyperVFabricArmId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).HyperVFabricArmId, global::System.Convert.ToString); + } + if (content.Contains("HyperVSiteId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).HyperVSiteId = (string) content.GetValueForProperty("HyperVSiteId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).HyperVSiteId, global::System.Convert.ToString); + } + if (content.Contains("AzStackHciFabricArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).AzStackHciFabricArmId = (string) content.GetValueForProperty("AzStackHciFabricArmId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).AzStackHciFabricArmId, global::System.Convert.ToString); + } + if (content.Contains("AzStackHciSiteId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).AzStackHciSiteId = (string) content.GetValueForProperty("AzStackHciSiteId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).AzStackHciSiteId, global::System.Convert.ToString); + } + if (content.Contains("StorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).StorageAccountId = (string) content.GetValueForProperty("StorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).StorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("StorageAccountSasSecretName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).StorageAccountSasSecretName = (string) content.GetValueForProperty("StorageAccountSasSecretName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).StorageAccountSasSecretName, global::System.Convert.ToString); + } + if (content.Contains("AsrServiceUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).AsrServiceUri = (string) content.GetValueForProperty("AsrServiceUri",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).AsrServiceUri, global::System.Convert.ToString); + } + if (content.Contains("RcmServiceUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).RcmServiceUri = (string) content.GetValueForProperty("RcmServiceUri",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).RcmServiceUri, global::System.Convert.ToString); + } + if (content.Contains("GatewayServiceUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).GatewayServiceUri = (string) content.GetValueForProperty("GatewayServiceUri",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).GatewayServiceUri, global::System.Convert.ToString); + } + if (content.Contains("SourceGatewayServiceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).SourceGatewayServiceId = (string) content.GetValueForProperty("SourceGatewayServiceId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).SourceGatewayServiceId, global::System.Convert.ToString); + } + if (content.Contains("TargetGatewayServiceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).TargetGatewayServiceId = (string) content.GetValueForProperty("TargetGatewayServiceId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).TargetGatewayServiceId, global::System.Convert.ToString); + } + if (content.Contains("SourceStorageContainerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).SourceStorageContainerName = (string) content.GetValueForProperty("SourceStorageContainerName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).SourceStorageContainerName, global::System.Convert.ToString); + } + if (content.Contains("TargetStorageContainerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).TargetStorageContainerName = (string) content.GetValueForProperty("TargetStorageContainerName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).TargetStorageContainerName, global::System.Convert.ToString); + } + if (content.Contains("ResourceLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).ResourceLocation = (string) content.GetValueForProperty("ResourceLocation",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).ResourceLocation, global::System.Convert.ToString); + } + if (content.Contains("SubscriptionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).SubscriptionId, global::System.Convert.ToString); + } + if (content.Contains("ResourceGroup")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).ResourceGroup = (string) content.GetValueForProperty("ResourceGroup",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).ResourceGroup, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCustomPropertiesInternal)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 HyperVToAzStackHcireplicationExtensionModelCustomProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("HyperVFabricArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).HyperVFabricArmId = (string) content.GetValueForProperty("HyperVFabricArmId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).HyperVFabricArmId, global::System.Convert.ToString); + } + if (content.Contains("HyperVSiteId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).HyperVSiteId = (string) content.GetValueForProperty("HyperVSiteId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).HyperVSiteId, global::System.Convert.ToString); + } + if (content.Contains("AzStackHciFabricArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).AzStackHciFabricArmId = (string) content.GetValueForProperty("AzStackHciFabricArmId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).AzStackHciFabricArmId, global::System.Convert.ToString); + } + if (content.Contains("AzStackHciSiteId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).AzStackHciSiteId = (string) content.GetValueForProperty("AzStackHciSiteId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).AzStackHciSiteId, global::System.Convert.ToString); + } + if (content.Contains("StorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).StorageAccountId = (string) content.GetValueForProperty("StorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).StorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("StorageAccountSasSecretName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).StorageAccountSasSecretName = (string) content.GetValueForProperty("StorageAccountSasSecretName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).StorageAccountSasSecretName, global::System.Convert.ToString); + } + if (content.Contains("AsrServiceUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).AsrServiceUri = (string) content.GetValueForProperty("AsrServiceUri",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).AsrServiceUri, global::System.Convert.ToString); + } + if (content.Contains("RcmServiceUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).RcmServiceUri = (string) content.GetValueForProperty("RcmServiceUri",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).RcmServiceUri, global::System.Convert.ToString); + } + if (content.Contains("GatewayServiceUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).GatewayServiceUri = (string) content.GetValueForProperty("GatewayServiceUri",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).GatewayServiceUri, global::System.Convert.ToString); + } + if (content.Contains("SourceGatewayServiceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).SourceGatewayServiceId = (string) content.GetValueForProperty("SourceGatewayServiceId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).SourceGatewayServiceId, global::System.Convert.ToString); + } + if (content.Contains("TargetGatewayServiceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).TargetGatewayServiceId = (string) content.GetValueForProperty("TargetGatewayServiceId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).TargetGatewayServiceId, global::System.Convert.ToString); + } + if (content.Contains("SourceStorageContainerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).SourceStorageContainerName = (string) content.GetValueForProperty("SourceStorageContainerName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).SourceStorageContainerName, global::System.Convert.ToString); + } + if (content.Contains("TargetStorageContainerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).TargetStorageContainerName = (string) content.GetValueForProperty("TargetStorageContainerName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).TargetStorageContainerName, global::System.Convert.ToString); + } + if (content.Contains("ResourceLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).ResourceLocation = (string) content.GetValueForProperty("ResourceLocation",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).ResourceLocation, global::System.Convert.ToString); + } + if (content.Contains("SubscriptionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).SubscriptionId, global::System.Convert.ToString); + } + if (content.Contains("ResourceGroup")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).ResourceGroup = (string) content.GetValueForProperty("ResourceGroup",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).ResourceGroup, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCustomPropertiesInternal)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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// HyperV to AzStackHCI Replication extension model custom properties. + [System.ComponentModel.TypeConverter(typeof(HyperVToAzStackHcireplicationExtensionModelCustomPropertiesTypeConverter))] + public partial interface IHyperVToAzStackHcireplicationExtensionModelCustomProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcireplicationExtensionModelCustomProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcireplicationExtensionModelCustomProperties.TypeConverter.cs new file mode 100644 index 000000000000..1a0c226d056c --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcireplicationExtensionModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class HyperVToAzStackHcireplicationExtensionModelCustomPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is + /// no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is + /// no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return HyperVToAzStackHcireplicationExtensionModelCustomProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return HyperVToAzStackHcireplicationExtensionModelCustomProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return HyperVToAzStackHcireplicationExtensionModelCustomProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcireplicationExtensionModelCustomProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcireplicationExtensionModelCustomProperties.cs new file mode 100644 index 000000000000..ba1341388295 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcireplicationExtensionModelCustomProperties.cs @@ -0,0 +1,367 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// HyperV to AzStackHCI Replication extension model custom properties. + public partial class HyperVToAzStackHcireplicationExtensionModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCustomProperties __replicationExtensionModelCustomProperties = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ReplicationExtensionModelCustomProperties(); + + /// Backing field for property. + private string _asrServiceUri; + + /// Gets or sets the Uri of ASR. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string AsrServiceUri { get => this._asrServiceUri; } + + /// Backing field for property. + private string _azStackHciFabricArmId; + + /// Gets or sets the ARM Id of the target AzStackHCI fabric. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string AzStackHciFabricArmId { get => this._azStackHciFabricArmId; set => this._azStackHciFabricArmId = value; } + + /// Backing field for property. + private string _azStackHciSiteId; + + /// Gets or sets the ARM Id of the AzStackHCI site. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string AzStackHciSiteId { get => this._azStackHciSiteId; } + + /// Backing field for property. + private string _gatewayServiceUri; + + /// Gets or sets the Uri of Gateway. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string GatewayServiceUri { get => this._gatewayServiceUri; } + + /// Backing field for property. + private string _hyperVFabricArmId; + + /// Gets or sets the ARM Id of the source HyperV fabric. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string HyperVFabricArmId { get => this._hyperVFabricArmId; set => this._hyperVFabricArmId = value; } + + /// Backing field for property. + private string _hyperVSiteId; + + /// Gets or sets the ARM Id of the HyperV site. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string HyperVSiteId { get => this._hyperVSiteId; } + + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCustomPropertiesInternal)__replicationExtensionModelCustomProperties).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCustomPropertiesInternal)__replicationExtensionModelCustomProperties).InstanceType = value ; } + + /// Internal Acessors for AsrServiceUri + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal.AsrServiceUri { get => this._asrServiceUri; set { {_asrServiceUri = value;} } } + + /// Internal Acessors for AzStackHciSiteId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal.AzStackHciSiteId { get => this._azStackHciSiteId; set { {_azStackHciSiteId = value;} } } + + /// Internal Acessors for GatewayServiceUri + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal.GatewayServiceUri { get => this._gatewayServiceUri; set { {_gatewayServiceUri = value;} } } + + /// Internal Acessors for HyperVSiteId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal.HyperVSiteId { get => this._hyperVSiteId; set { {_hyperVSiteId = value;} } } + + /// Internal Acessors for RcmServiceUri + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal.RcmServiceUri { get => this._rcmServiceUri; set { {_rcmServiceUri = value;} } } + + /// Internal Acessors for ResourceGroup + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal.ResourceGroup { get => this._resourceGroup; set { {_resourceGroup = value;} } } + + /// Internal Acessors for ResourceLocation + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal.ResourceLocation { get => this._resourceLocation; set { {_resourceLocation = value;} } } + + /// Internal Acessors for SourceGatewayServiceId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal.SourceGatewayServiceId { get => this._sourceGatewayServiceId; set { {_sourceGatewayServiceId = value;} } } + + /// Internal Acessors for SourceStorageContainerName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal.SourceStorageContainerName { get => this._sourceStorageContainerName; set { {_sourceStorageContainerName = value;} } } + + /// Internal Acessors for SubscriptionId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal.SubscriptionId { get => this._subscriptionId; set { {_subscriptionId = value;} } } + + /// Internal Acessors for TargetGatewayServiceId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal.TargetGatewayServiceId { get => this._targetGatewayServiceId; set { {_targetGatewayServiceId = value;} } } + + /// Internal Acessors for TargetStorageContainerName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal.TargetStorageContainerName { get => this._targetStorageContainerName; set { {_targetStorageContainerName = value;} } } + + /// Backing field for property. + private string _rcmServiceUri; + + /// Gets or sets the Uri of Rcm. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string RcmServiceUri { get => this._rcmServiceUri; } + + /// Backing field for property. + private string _resourceGroup; + + /// Gets or sets the resource group. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string ResourceGroup { get => this._resourceGroup; } + + /// Backing field for property. + private string _resourceLocation; + + /// Gets or sets the resource location. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string ResourceLocation { get => this._resourceLocation; } + + /// Backing field for property. + private string _sourceGatewayServiceId; + + /// Gets or sets the gateway service Id of source. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string SourceGatewayServiceId { get => this._sourceGatewayServiceId; } + + /// Backing field for property. + private string _sourceStorageContainerName; + + /// Gets or sets the source storage container name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string SourceStorageContainerName { get => this._sourceStorageContainerName; } + + /// Backing field for property. + private string _storageAccountId; + + /// Gets or sets the storage account Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string StorageAccountId { get => this._storageAccountId; set => this._storageAccountId = value; } + + /// Backing field for property. + private string _storageAccountSasSecretName; + + /// Gets or sets the Sas Secret of storage account. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string StorageAccountSasSecretName { get => this._storageAccountSasSecretName; set => this._storageAccountSasSecretName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// Gets or sets the subscription. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string SubscriptionId { get => this._subscriptionId; } + + /// Backing field for property. + private string _targetGatewayServiceId; + + /// Gets or sets the gateway service Id of target. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TargetGatewayServiceId { get => this._targetGatewayServiceId; } + + /// Backing field for property. + private string _targetStorageContainerName; + + /// Gets or sets the target storage container name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TargetStorageContainerName { get => this._targetStorageContainerName; } + + /// + /// Creates an new instance. + /// + public HyperVToAzStackHcireplicationExtensionModelCustomProperties() + { + + } + + /// 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.Migrate.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__replicationExtensionModelCustomProperties), __replicationExtensionModelCustomProperties); + await eventListener.AssertObjectIsValid(nameof(__replicationExtensionModelCustomProperties), __replicationExtensionModelCustomProperties); + } + } + /// HyperV to AzStackHCI Replication extension model custom properties. + public partial interface IHyperVToAzStackHcireplicationExtensionModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCustomProperties + { + /// Gets or sets the Uri of ASR. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the Uri of ASR.", + SerializedName = @"asrServiceUri", + PossibleTypes = new [] { typeof(string) })] + string AsrServiceUri { get; } + /// Gets or sets the ARM Id of the target AzStackHCI fabric. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the ARM Id of the target AzStackHCI fabric.", + SerializedName = @"azStackHciFabricArmId", + PossibleTypes = new [] { typeof(string) })] + string AzStackHciFabricArmId { get; set; } + /// Gets or sets the ARM Id of the AzStackHCI site. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the ARM Id of the AzStackHCI site.", + SerializedName = @"azStackHciSiteId", + PossibleTypes = new [] { typeof(string) })] + string AzStackHciSiteId { get; } + /// Gets or sets the Uri of Gateway. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the Uri of Gateway.", + SerializedName = @"gatewayServiceUri", + PossibleTypes = new [] { typeof(string) })] + string GatewayServiceUri { get; } + /// Gets or sets the ARM Id of the source HyperV fabric. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the ARM Id of the source HyperV fabric.", + SerializedName = @"hyperVFabricArmId", + PossibleTypes = new [] { typeof(string) })] + string HyperVFabricArmId { get; set; } + /// Gets or sets the ARM Id of the HyperV site. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the ARM Id of the HyperV site.", + SerializedName = @"hyperVSiteId", + PossibleTypes = new [] { typeof(string) })] + string HyperVSiteId { get; } + /// Gets or sets the Uri of Rcm. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the Uri of Rcm.", + SerializedName = @"rcmServiceUri", + PossibleTypes = new [] { typeof(string) })] + string RcmServiceUri { get; } + /// Gets or sets the resource group. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the resource group.", + SerializedName = @"resourceGroup", + PossibleTypes = new [] { typeof(string) })] + string ResourceGroup { get; } + /// Gets or sets the resource location. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the resource location.", + SerializedName = @"resourceLocation", + PossibleTypes = new [] { typeof(string) })] + string ResourceLocation { get; } + /// Gets or sets the gateway service Id of source. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the gateway service Id of source.", + SerializedName = @"sourceGatewayServiceId", + PossibleTypes = new [] { typeof(string) })] + string SourceGatewayServiceId { get; } + /// Gets or sets the source storage container name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the source storage container name.", + SerializedName = @"sourceStorageContainerName", + PossibleTypes = new [] { typeof(string) })] + string SourceStorageContainerName { get; } + /// Gets or sets the storage account Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the storage account Id.", + SerializedName = @"storageAccountId", + PossibleTypes = new [] { typeof(string) })] + string StorageAccountId { get; set; } + /// Gets or sets the Sas Secret of storage account. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the Sas Secret of storage account.", + SerializedName = @"storageAccountSasSecretName", + PossibleTypes = new [] { typeof(string) })] + string StorageAccountSasSecretName { get; set; } + /// Gets or sets the subscription. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + string SubscriptionId { get; } + /// Gets or sets the gateway service Id of target. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the gateway service Id of target.", + SerializedName = @"targetGatewayServiceId", + PossibleTypes = new [] { typeof(string) })] + string TargetGatewayServiceId { get; } + /// Gets or sets the target storage container name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the target storage container name.", + SerializedName = @"targetStorageContainerName", + PossibleTypes = new [] { typeof(string) })] + string TargetStorageContainerName { get; } + + } + /// HyperV to AzStackHCI Replication extension model custom properties. + internal partial interface IHyperVToAzStackHcireplicationExtensionModelCustomPropertiesInternal : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCustomPropertiesInternal + { + /// Gets or sets the Uri of ASR. + string AsrServiceUri { get; set; } + /// Gets or sets the ARM Id of the target AzStackHCI fabric. + string AzStackHciFabricArmId { get; set; } + /// Gets or sets the ARM Id of the AzStackHCI site. + string AzStackHciSiteId { get; set; } + /// Gets or sets the Uri of Gateway. + string GatewayServiceUri { get; set; } + /// Gets or sets the ARM Id of the source HyperV fabric. + string HyperVFabricArmId { get; set; } + /// Gets or sets the ARM Id of the HyperV site. + string HyperVSiteId { get; set; } + /// Gets or sets the Uri of Rcm. + string RcmServiceUri { get; set; } + /// Gets or sets the resource group. + string ResourceGroup { get; set; } + /// Gets or sets the resource location. + string ResourceLocation { get; set; } + /// Gets or sets the gateway service Id of source. + string SourceGatewayServiceId { get; set; } + /// Gets or sets the source storage container name. + string SourceStorageContainerName { get; set; } + /// Gets or sets the storage account Id. + string StorageAccountId { get; set; } + /// Gets or sets the Sas Secret of storage account. + string StorageAccountSasSecretName { get; set; } + /// Gets or sets the subscription. + string SubscriptionId { get; set; } + /// Gets or sets the gateway service Id of target. + string TargetGatewayServiceId { get; set; } + /// Gets or sets the target storage container name. + string TargetStorageContainerName { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcireplicationExtensionModelCustomProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcireplicationExtensionModelCustomProperties.json.cs new file mode 100644 index 000000000000..2ecbee92ea42 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/HyperVToAzStackHcireplicationExtensionModelCustomProperties.json.cs @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// HyperV to AzStackHCI Replication extension model custom properties. + public partial class HyperVToAzStackHcireplicationExtensionModelCustomProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHyperVToAzStackHcireplicationExtensionModelCustomProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new HyperVToAzStackHcireplicationExtensionModelCustomProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal HyperVToAzStackHcireplicationExtensionModelCustomProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __replicationExtensionModelCustomProperties = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ReplicationExtensionModelCustomProperties(json); + {_hyperVFabricArmId = If( json?.PropertyT("hyperVFabricArmId"), out var __jsonHyperVFabricArmId) ? (string)__jsonHyperVFabricArmId : (string)HyperVFabricArmId;} + {_hyperVSiteId = If( json?.PropertyT("hyperVSiteId"), out var __jsonHyperVSiteId) ? (string)__jsonHyperVSiteId : (string)HyperVSiteId;} + {_azStackHciFabricArmId = If( json?.PropertyT("azStackHciFabricArmId"), out var __jsonAzStackHciFabricArmId) ? (string)__jsonAzStackHciFabricArmId : (string)AzStackHciFabricArmId;} + {_azStackHciSiteId = If( json?.PropertyT("azStackHciSiteId"), out var __jsonAzStackHciSiteId) ? (string)__jsonAzStackHciSiteId : (string)AzStackHciSiteId;} + {_storageAccountId = If( json?.PropertyT("storageAccountId"), out var __jsonStorageAccountId) ? (string)__jsonStorageAccountId : (string)StorageAccountId;} + {_storageAccountSasSecretName = If( json?.PropertyT("storageAccountSasSecretName"), out var __jsonStorageAccountSasSecretName) ? (string)__jsonStorageAccountSasSecretName : (string)StorageAccountSasSecretName;} + {_asrServiceUri = If( json?.PropertyT("asrServiceUri"), out var __jsonAsrServiceUri) ? (string)__jsonAsrServiceUri : (string)AsrServiceUri;} + {_rcmServiceUri = If( json?.PropertyT("rcmServiceUri"), out var __jsonRcmServiceUri) ? (string)__jsonRcmServiceUri : (string)RcmServiceUri;} + {_gatewayServiceUri = If( json?.PropertyT("gatewayServiceUri"), out var __jsonGatewayServiceUri) ? (string)__jsonGatewayServiceUri : (string)GatewayServiceUri;} + {_sourceGatewayServiceId = If( json?.PropertyT("sourceGatewayServiceId"), out var __jsonSourceGatewayServiceId) ? (string)__jsonSourceGatewayServiceId : (string)SourceGatewayServiceId;} + {_targetGatewayServiceId = If( json?.PropertyT("targetGatewayServiceId"), out var __jsonTargetGatewayServiceId) ? (string)__jsonTargetGatewayServiceId : (string)TargetGatewayServiceId;} + {_sourceStorageContainerName = If( json?.PropertyT("sourceStorageContainerName"), out var __jsonSourceStorageContainerName) ? (string)__jsonSourceStorageContainerName : (string)SourceStorageContainerName;} + {_targetStorageContainerName = If( json?.PropertyT("targetStorageContainerName"), out var __jsonTargetStorageContainerName) ? (string)__jsonTargetStorageContainerName : (string)TargetStorageContainerName;} + {_resourceLocation = If( json?.PropertyT("resourceLocation"), out var __jsonResourceLocation) ? (string)__jsonResourceLocation : (string)ResourceLocation;} + {_subscriptionId = If( json?.PropertyT("subscriptionId"), out var __jsonSubscriptionId) ? (string)__jsonSubscriptionId : (string)SubscriptionId;} + {_resourceGroup = If( json?.PropertyT("resourceGroup"), out var __jsonResourceGroup) ? (string)__jsonResourceGroup : (string)ResourceGroup;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __replicationExtensionModelCustomProperties?.ToJson(container, serializationMode); + AddIf( null != (((object)this._hyperVFabricArmId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._hyperVFabricArmId.ToString()) : null, "hyperVFabricArmId" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._hyperVSiteId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._hyperVSiteId.ToString()) : null, "hyperVSiteId" ,container.Add ); + } + AddIf( null != (((object)this._azStackHciFabricArmId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._azStackHciFabricArmId.ToString()) : null, "azStackHciFabricArmId" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._azStackHciSiteId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._azStackHciSiteId.ToString()) : null, "azStackHciSiteId" ,container.Add ); + } + AddIf( null != (((object)this._storageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._storageAccountId.ToString()) : null, "storageAccountId" ,container.Add ); + AddIf( null != (((object)this._storageAccountSasSecretName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._storageAccountSasSecretName.ToString()) : null, "storageAccountSasSecretName" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._asrServiceUri)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._asrServiceUri.ToString()) : null, "asrServiceUri" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._rcmServiceUri)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._rcmServiceUri.ToString()) : null, "rcmServiceUri" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._gatewayServiceUri)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._gatewayServiceUri.ToString()) : null, "gatewayServiceUri" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._sourceGatewayServiceId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._sourceGatewayServiceId.ToString()) : null, "sourceGatewayServiceId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._targetGatewayServiceId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._targetGatewayServiceId.ToString()) : null, "targetGatewayServiceId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._sourceStorageContainerName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._sourceStorageContainerName.ToString()) : null, "sourceStorageContainerName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._targetStorageContainerName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._targetStorageContainerName.ToString()) : null, "targetStorageContainerName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._resourceLocation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._resourceLocation.ToString()) : null, "resourceLocation" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._subscriptionId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._subscriptionId.ToString()) : null, "subscriptionId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._resourceGroup)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._resourceGroup.ToString()) : null, "resourceGroup" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/IdentityModel.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/IdentityModel.PowerShell.cs new file mode 100644 index 000000000000..9ecee3d16c56 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/IdentityModel.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Identity model. + [System.ComponentModel.TypeConverter(typeof(IdentityModelTypeConverter))] + public partial class IdentityModel + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModel DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new IdentityModel(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModel DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new IdentityModel(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModel FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal IdentityModel(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.Migrate.Models.Api20210216Preview.IIdentityModelInternal)this).TenantId = (string) content.GetValueForProperty("TenantId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)this).TenantId, global::System.Convert.ToString); + } + if (content.Contains("ApplicationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)this).ApplicationId = (string) content.GetValueForProperty("ApplicationId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)this).ApplicationId, global::System.Convert.ToString); + } + if (content.Contains("ObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)this).ObjectId = (string) content.GetValueForProperty("ObjectId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)this).ObjectId, global::System.Convert.ToString); + } + if (content.Contains("Audience")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)this).Audience = (string) content.GetValueForProperty("Audience",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)this).Audience, global::System.Convert.ToString); + } + if (content.Contains("AadAuthority")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)this).AadAuthority = (string) content.GetValueForProperty("AadAuthority",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)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 IdentityModel(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.Migrate.Models.Api20210216Preview.IIdentityModelInternal)this).TenantId = (string) content.GetValueForProperty("TenantId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)this).TenantId, global::System.Convert.ToString); + } + if (content.Contains("ApplicationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)this).ApplicationId = (string) content.GetValueForProperty("ApplicationId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)this).ApplicationId, global::System.Convert.ToString); + } + if (content.Contains("ObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)this).ObjectId = (string) content.GetValueForProperty("ObjectId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)this).ObjectId, global::System.Convert.ToString); + } + if (content.Contains("Audience")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)this).Audience = (string) content.GetValueForProperty("Audience",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)this).Audience, global::System.Convert.ToString); + } + if (content.Contains("AadAuthority")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)this).AadAuthority = (string) content.GetValueForProperty("AadAuthority",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Identity model. + [System.ComponentModel.TypeConverter(typeof(IdentityModelTypeConverter))] + public partial interface IIdentityModel + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/IdentityModel.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/IdentityModel.TypeConverter.cs new file mode 100644 index 000000000000..5bb00e348ac6 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/IdentityModel.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class IdentityModelTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModel ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModel).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return IdentityModel.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return IdentityModel.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return IdentityModel.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/IdentityModel.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/IdentityModel.cs new file mode 100644 index 000000000000..77b1606b25e7 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/IdentityModel.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Identity model. + public partial class IdentityModel : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModel, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal + { + + /// Backing field for property. + private string _aadAuthority; + + /// Gets or sets the authority of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string AadAuthority { get => this._aadAuthority; set => this._aadAuthority = value; } + + /// Backing field for property. + private string _applicationId; + + /// + /// Gets or sets the client/application Id of the SPN with which Dra communicates to + /// service. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string ApplicationId { get => this._applicationId; set => this._applicationId = value; } + + /// Backing field for property. + private string _audience; + + /// Gets or sets the audience of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Audience { get => this._audience; set => this._audience = value; } + + /// Backing field for property. + private string _objectId; + + /// Gets or sets the object Id of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string ObjectId { get => this._objectId; set => this._objectId = value; } + + /// Backing field for property. + private string _tenantId; + + /// Gets or sets the tenant Id of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TenantId { get => this._tenantId; set => this._tenantId = value; } + + /// Creates an new instance. + public IdentityModel() + { + + } + } + /// Identity model. + public partial interface IIdentityModel : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the authority of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the authority of the SPN with which Dra communicates to service.", + SerializedName = @"aadAuthority", + PossibleTypes = new [] { typeof(string) })] + string AadAuthority { get; set; } + /// + /// Gets or sets the client/application Id of the SPN with which Dra communicates to + /// service. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the client/application Id of the SPN with which Dra communicates to + service.", + SerializedName = @"applicationId", + PossibleTypes = new [] { typeof(string) })] + string ApplicationId { get; set; } + /// Gets or sets the audience of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the audience of the SPN with which Dra communicates to service.", + SerializedName = @"audience", + PossibleTypes = new [] { typeof(string) })] + string Audience { get; set; } + /// Gets or sets the object Id of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the object Id of the SPN with which Dra communicates to service.", + SerializedName = @"objectId", + PossibleTypes = new [] { typeof(string) })] + string ObjectId { get; set; } + /// Gets or sets the tenant Id of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the tenant Id of the SPN with which Dra communicates to service.", + SerializedName = @"tenantId", + PossibleTypes = new [] { typeof(string) })] + string TenantId { get; set; } + + } + /// Identity model. + internal partial interface IIdentityModelInternal + + { + /// Gets or sets the authority of the SPN with which Dra communicates to service. + string AadAuthority { get; set; } + /// + /// Gets or sets the client/application Id of the SPN with which Dra communicates to + /// service. + /// + string ApplicationId { get; set; } + /// Gets or sets the audience of the SPN with which Dra communicates to service. + string Audience { get; set; } + /// Gets or sets the object Id of the SPN with which Dra communicates to service. + string ObjectId { get; set; } + /// Gets or sets the tenant Id of the SPN with which Dra communicates to service. + string TenantId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/IdentityModel.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/IdentityModel.json.cs new file mode 100644 index 000000000000..b1e836bf594f --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/IdentityModel.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Identity model. + public partial class IdentityModel + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModel. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModel. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModel FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new IdentityModel(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal IdentityModel(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._tenantId.ToString()) : null, "tenantId" ,container.Add ); + AddIf( null != (((object)this._applicationId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._applicationId.ToString()) : null, "applicationId" ,container.Add ); + AddIf( null != (((object)this._objectId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._objectId.ToString()) : null, "objectId" ,container.Add ); + AddIf( null != (((object)this._audience)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._audience.ToString()) : null, "audience" ,container.Add ); + AddIf( null != (((object)this._aadAuthority)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._aadAuthority.ToString()) : null, "aadAuthority" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/InnerHealthErrorModel.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/InnerHealthErrorModel.PowerShell.cs new file mode 100644 index 000000000000..3587563a23e3 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/InnerHealthErrorModel.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Inner health error model. + [System.ComponentModel.TypeConverter(typeof(InnerHealthErrorModelTypeConverter))] + public partial class InnerHealthErrorModel + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModel DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InnerHealthErrorModel(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModel DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InnerHealthErrorModel(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModel FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InnerHealthErrorModel(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.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("HealthCategory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal)this).HealthCategory = (string) content.GetValueForProperty("HealthCategory",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal)this).HealthCategory, global::System.Convert.ToString); + } + if (content.Contains("Category")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal)this).Category = (string) content.GetValueForProperty("Category",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal)this).Category, global::System.Convert.ToString); + } + if (content.Contains("Severity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal)this).Severity = (string) content.GetValueForProperty("Severity",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal)this).Severity, global::System.Convert.ToString); + } + if (content.Contains("Source")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal)this).Source = (string) content.GetValueForProperty("Source",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal)this).Source, global::System.Convert.ToString); + } + if (content.Contains("CreationTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal)this).CreationTime = (global::System.DateTime?) content.GetValueForProperty("CreationTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal)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("IsCustomerResolvable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal)this).IsCustomerResolvable = (bool?) content.GetValueForProperty("IsCustomerResolvable",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal)this).IsCustomerResolvable, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("Summary")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal)this).Summary = (string) content.GetValueForProperty("Summary",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal)this).Summary, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Caus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal)this).Caus = (string) content.GetValueForProperty("Caus",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal)this).Caus, global::System.Convert.ToString); + } + if (content.Contains("Recommendation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal)this).Recommendation = (string) content.GetValueForProperty("Recommendation",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal)this).Recommendation, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InnerHealthErrorModel(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.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("HealthCategory")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal)this).HealthCategory = (string) content.GetValueForProperty("HealthCategory",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal)this).HealthCategory, global::System.Convert.ToString); + } + if (content.Contains("Category")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal)this).Category = (string) content.GetValueForProperty("Category",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal)this).Category, global::System.Convert.ToString); + } + if (content.Contains("Severity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal)this).Severity = (string) content.GetValueForProperty("Severity",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal)this).Severity, global::System.Convert.ToString); + } + if (content.Contains("Source")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal)this).Source = (string) content.GetValueForProperty("Source",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal)this).Source, global::System.Convert.ToString); + } + if (content.Contains("CreationTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal)this).CreationTime = (global::System.DateTime?) content.GetValueForProperty("CreationTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal)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("IsCustomerResolvable")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal)this).IsCustomerResolvable = (bool?) content.GetValueForProperty("IsCustomerResolvable",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal)this).IsCustomerResolvable, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("Summary")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal)this).Summary = (string) content.GetValueForProperty("Summary",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal)this).Summary, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Caus")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal)this).Caus = (string) content.GetValueForProperty("Caus",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal)this).Caus, global::System.Convert.ToString); + } + if (content.Contains("Recommendation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal)this).Recommendation = (string) content.GetValueForProperty("Recommendation",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal)this).Recommendation, 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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Inner health error model. + [System.ComponentModel.TypeConverter(typeof(InnerHealthErrorModelTypeConverter))] + public partial interface IInnerHealthErrorModel + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/InnerHealthErrorModel.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/InnerHealthErrorModel.TypeConverter.cs new file mode 100644 index 000000000000..d5c68e30c9fb --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/InnerHealthErrorModel.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InnerHealthErrorModelTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModel ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModel).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InnerHealthErrorModel.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InnerHealthErrorModel.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InnerHealthErrorModel.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/InnerHealthErrorModel.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/InnerHealthErrorModel.cs new file mode 100644 index 000000000000..42d3a9279776 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/InnerHealthErrorModel.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Inner health error model. + public partial class InnerHealthErrorModel : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModel, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal + { + + /// Backing field for property. + private string _category; + + /// Gets or sets the error category. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Category { get => this._category; } + + /// Backing field for property. + private string _caus; + + /// Gets or sets possible causes of the error. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Caus { get => this._caus; } + + /// Backing field for property. + private string _code; + + /// Gets or sets the error code. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Code { get => this._code; } + + /// Backing field for property. + private global::System.DateTime? _creationTime; + + /// Gets or sets the error creation time. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public global::System.DateTime? CreationTime { get => this._creationTime; } + + /// Backing field for property. + private string _healthCategory; + + /// Gets or sets the health category. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string HealthCategory { get => this._healthCategory; } + + /// Backing field for property. + private bool? _isCustomerResolvable; + + /// Gets or sets a value indicating whether the error is customer resolvable. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public bool? IsCustomerResolvable { get => this._isCustomerResolvable; } + + /// Backing field for property. + private string _message; + + /// Gets or sets the error message. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Message { get => this._message; } + + /// Internal Acessors for Category + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal.Category { get => this._category; set { {_category = value;} } } + + /// Internal Acessors for Caus + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal.Caus { get => this._caus; set { {_caus = value;} } } + + /// Internal Acessors for Code + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal.Code { get => this._code; set { {_code = value;} } } + + /// Internal Acessors for CreationTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal.CreationTime { get => this._creationTime; set { {_creationTime = value;} } } + + /// Internal Acessors for HealthCategory + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal.HealthCategory { get => this._healthCategory; set { {_healthCategory = value;} } } + + /// Internal Acessors for IsCustomerResolvable + bool? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal.IsCustomerResolvable { get => this._isCustomerResolvable; set { {_isCustomerResolvable = value;} } } + + /// Internal Acessors for Message + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal.Message { get => this._message; set { {_message = value;} } } + + /// Internal Acessors for Recommendation + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal.Recommendation { get => this._recommendation; set { {_recommendation = value;} } } + + /// Internal Acessors for Severity + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal.Severity { get => this._severity; set { {_severity = value;} } } + + /// Internal Acessors for Source + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal.Source { get => this._source; set { {_source = value;} } } + + /// Internal Acessors for Summary + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModelInternal.Summary { get => this._summary; set { {_summary = value;} } } + + /// Backing field for property. + private string _recommendation; + + /// Gets or sets recommended action to resolve the error. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Recommendation { get => this._recommendation; } + + /// Backing field for property. + private string _severity; + + /// Gets or sets the error severity. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Severity { get => this._severity; } + + /// Backing field for property. + private string _source; + + /// Gets or sets the error source. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Source { get => this._source; } + + /// Backing field for property. + private string _summary; + + /// Gets or sets the error summary. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Summary { get => this._summary; } + + /// Creates an new instance. + public InnerHealthErrorModel() + { + + } + } + /// Inner health error model. + public partial interface IInnerHealthErrorModel : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the error category. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the error category.", + SerializedName = @"category", + PossibleTypes = new [] { typeof(string) })] + string Category { get; } + /// Gets or sets possible causes of the error. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets possible causes of the error.", + SerializedName = @"causes", + PossibleTypes = new [] { typeof(string) })] + string Caus { get; } + /// Gets or sets the error code. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the error code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string Code { get; } + /// Gets or sets the error creation time. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the error creation time.", + SerializedName = @"creationTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? CreationTime { get; } + /// Gets or sets the health category. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the health category.", + SerializedName = @"healthCategory", + PossibleTypes = new [] { typeof(string) })] + string HealthCategory { get; } + /// Gets or sets a value indicating whether the error is customer resolvable. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets a value indicating whether the error is customer resolvable.", + SerializedName = @"isCustomerResolvable", + PossibleTypes = new [] { typeof(bool) })] + bool? IsCustomerResolvable { get; } + /// Gets or sets the error message. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the error message.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; } + /// Gets or sets recommended action to resolve the error. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets recommended action to resolve the error.", + SerializedName = @"recommendation", + PossibleTypes = new [] { typeof(string) })] + string Recommendation { get; } + /// Gets or sets the error severity. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the error severity.", + SerializedName = @"severity", + PossibleTypes = new [] { typeof(string) })] + string Severity { get; } + /// Gets or sets the error source. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the error source.", + SerializedName = @"source", + PossibleTypes = new [] { typeof(string) })] + string Source { get; } + /// Gets or sets the error summary. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the error summary.", + SerializedName = @"summary", + PossibleTypes = new [] { typeof(string) })] + string Summary { get; } + + } + /// Inner health error model. + internal partial interface IInnerHealthErrorModelInternal + + { + /// Gets or sets the error category. + string Category { get; set; } + /// Gets or sets possible causes of the error. + string Caus { get; set; } + /// Gets or sets the error code. + string Code { get; set; } + /// Gets or sets the error creation time. + global::System.DateTime? CreationTime { get; set; } + /// Gets or sets the health category. + string HealthCategory { get; set; } + /// Gets or sets a value indicating whether the error is customer resolvable. + bool? IsCustomerResolvable { get; set; } + /// Gets or sets the error message. + string Message { get; set; } + /// Gets or sets recommended action to resolve the error. + string Recommendation { get; set; } + /// Gets or sets the error severity. + string Severity { get; set; } + /// Gets or sets the error source. + string Source { get; set; } + /// Gets or sets the error summary. + string Summary { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/InnerHealthErrorModel.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/InnerHealthErrorModel.json.cs new file mode 100644 index 000000000000..1ff95056764f --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/InnerHealthErrorModel.json.cs @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Inner health error model. + public partial class InnerHealthErrorModel + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModel. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModel. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IInnerHealthErrorModel FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new InnerHealthErrorModel(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal InnerHealthErrorModel(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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;} + {_healthCategory = If( json?.PropertyT("healthCategory"), out var __jsonHealthCategory) ? (string)__jsonHealthCategory : (string)HealthCategory;} + {_category = If( json?.PropertyT("category"), out var __jsonCategory) ? (string)__jsonCategory : (string)Category;} + {_severity = If( json?.PropertyT("severity"), out var __jsonSeverity) ? (string)__jsonSeverity : (string)Severity;} + {_source = If( json?.PropertyT("source"), out var __jsonSource) ? (string)__jsonSource : (string)Source;} + {_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;} + {_isCustomerResolvable = If( json?.PropertyT("isCustomerResolvable"), out var __jsonIsCustomerResolvable) ? (bool?)__jsonIsCustomerResolvable : IsCustomerResolvable;} + {_summary = If( json?.PropertyT("summary"), out var __jsonSummary) ? (string)__jsonSummary : (string)Summary;} + {_message = If( json?.PropertyT("message"), out var __jsonMessage) ? (string)__jsonMessage : (string)Message;} + {_caus = If( json?.PropertyT("causes"), out var __jsonCauses) ? (string)__jsonCauses : (string)Caus;} + {_recommendation = If( json?.PropertyT("recommendation"), out var __jsonRecommendation) ? (string)__jsonRecommendation : (string)Recommendation;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._code)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._code.ToString()) : null, "code" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._healthCategory)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._healthCategory.ToString()) : null, "healthCategory" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._category)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._category.ToString()) : null, "category" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._severity)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._severity.ToString()) : null, "severity" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._source)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._source.ToString()) : null, "source" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._creationTime ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._creationTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "creationTime" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._isCustomerResolvable ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonBoolean((bool)this._isCustomerResolvable) : null, "isCustomerResolvable" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._summary)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._summary.ToString()) : null, "summary" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._message)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._message.ToString()) : null, "message" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._caus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._caus.ToString()) : null, "causes" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._recommendation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._recommendation.ToString()) : null, "recommendation" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationModel.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationModel.PowerShell.cs new file mode 100644 index 000000000000..b21479e8154c --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationModel.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Operation model. + [System.ComponentModel.TypeConverter(typeof(OperationModelTypeConverter))] + public partial class OperationModel + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModel DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new OperationModel(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModel DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new OperationModel(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModel FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal OperationModel(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.Migrate.Models.Api20210216Preview.IOperationModelInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelProperties) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.OperationModelPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("IsDataAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelInternal)this).IsDataAction = (bool?) content.GetValueForProperty("IsDataAction",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelInternal)this).IsDataAction, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("Origin")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelInternal)this).Origin = (string) content.GetValueForProperty("Origin",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelInternal)this).Origin, global::System.Convert.ToString); + } + if (content.Contains("DisplayProvider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelInternal)this).DisplayProvider, global::System.Convert.ToString); + } + if (content.Contains("DisplayResource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelInternal)this).DisplayResource, global::System.Convert.ToString); + } + if (content.Contains("DisplayOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelInternal)this).DisplayOperation, global::System.Convert.ToString); + } + if (content.Contains("DisplayDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelInternal)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 OperationModel(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.Migrate.Models.Api20210216Preview.IOperationModelInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelProperties) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.OperationModelPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("IsDataAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelInternal)this).IsDataAction = (bool?) content.GetValueForProperty("IsDataAction",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelInternal)this).IsDataAction, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("Origin")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelInternal)this).Origin = (string) content.GetValueForProperty("Origin",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelInternal)this).Origin, global::System.Convert.ToString); + } + if (content.Contains("DisplayProvider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelInternal)this).DisplayProvider, global::System.Convert.ToString); + } + if (content.Contains("DisplayResource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelInternal)this).DisplayResource, global::System.Convert.ToString); + } + if (content.Contains("DisplayOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelInternal)this).DisplayOperation, global::System.Convert.ToString); + } + if (content.Contains("DisplayDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelInternal)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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Operation model. + [System.ComponentModel.TypeConverter(typeof(OperationModelTypeConverter))] + public partial interface IOperationModel + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationModel.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationModel.TypeConverter.cs new file mode 100644 index 000000000000..6aef129aeabd --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationModel.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class OperationModelTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModel ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModel).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return OperationModel.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return OperationModel.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return OperationModel.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationModel.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationModel.cs new file mode 100644 index 000000000000..458cd4981793 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationModel.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Operation model. + public partial class OperationModel : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModel, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelProperties _display; + + /// Operation model properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelProperties Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.OperationModelProperties()); set => this._display = value; } + + /// Gets or sets the description. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string DisplayDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelPropertiesInternal)Display).Description; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelPropertiesInternal)Display).Description = value ?? null; } + + /// Gets or sets the operation. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string DisplayOperation { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelPropertiesInternal)Display).Operation; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelPropertiesInternal)Display).Operation = value ?? null; } + + /// Gets or sets the resource provider name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string DisplayProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelPropertiesInternal)Display).Provider; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelPropertiesInternal)Display).Provider = value ?? null; } + + /// Gets or sets resource name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string DisplayResource { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelPropertiesInternal)Display).Resource; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelPropertiesInternal)Display).Resource = value ?? null; } + + /// Backing field for property. + private bool? _isDataAction; + + /// + /// Gets or sets a value indicating whether the action is specific to data plane or + /// control plane. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public bool? IsDataAction { get => this._isDataAction; set => this._isDataAction = value; } + + /// Internal Acessors for Display + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelProperties Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelInternal.Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.OperationModelProperties()); set { {_display = value;} } } + + /// Backing field for property. + private string _name; + + /// Gets or sets the name of the operation. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private string _origin; + + /// Gets or sets the executor of the operation. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Origin { get => this._origin; set => this._origin = value; } + + /// Creates an new instance. + public OperationModel() + { + + } + } + /// Operation model. + public partial interface IOperationModel : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the description. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the description.", + SerializedName = @"description", + PossibleTypes = new [] { typeof(string) })] + string DisplayDescription { get; set; } + /// Gets or sets the operation. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the operation.", + SerializedName = @"operation", + PossibleTypes = new [] { typeof(string) })] + string DisplayOperation { get; set; } + /// Gets or sets the resource provider name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the resource provider name.", + SerializedName = @"provider", + PossibleTypes = new [] { typeof(string) })] + string DisplayProvider { get; set; } + /// Gets or sets resource name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets resource name.", + SerializedName = @"resource", + PossibleTypes = new [] { typeof(string) })] + string DisplayResource { get; set; } + /// + /// Gets or sets a value indicating whether the action is specific to data plane or + /// control plane. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets a value indicating whether the action is specific to data plane or + control plane.", + SerializedName = @"isDataAction", + PossibleTypes = new [] { typeof(bool) })] + bool? IsDataAction { get; set; } + /// Gets or sets the name of the operation. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the name of the operation.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + /// Gets or sets the executor of the operation. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the executor of the operation.", + SerializedName = @"origin", + PossibleTypes = new [] { typeof(string) })] + string Origin { get; set; } + + } + /// Operation model. + internal partial interface IOperationModelInternal + + { + /// Operation model properties. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelProperties Display { get; set; } + /// Gets or sets the description. + string DisplayDescription { get; set; } + /// Gets or sets the operation. + string DisplayOperation { get; set; } + /// Gets or sets the resource provider name. + string DisplayProvider { get; set; } + /// Gets or sets resource name. + string DisplayResource { get; set; } + /// + /// Gets or sets a value indicating whether the action is specific to data plane or + /// control plane. + /// + bool? IsDataAction { get; set; } + /// Gets or sets the name of the operation. + string Name { get; set; } + /// Gets or sets the executor of the operation. + string Origin { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationModel.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationModel.json.cs new file mode 100644 index 000000000000..4a96141f5dd9 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationModel.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Operation model. + public partial class OperationModel + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModel. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModel. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModel FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new OperationModel(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal OperationModel(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api20210216Preview.OperationModelProperties.FromJson(__jsonDisplay) : Display;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_isDataAction = If( json?.PropertyT("isDataAction"), out var __jsonIsDataAction) ? (bool?)__jsonIsDataAction : IsDataAction;} + {_origin = If( json?.PropertyT("origin"), out var __jsonOrigin) ? (string)__jsonOrigin : (string)Origin;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._display ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._display.ToJson(null,serializationMode) : null, "display" ,container.Add ); + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AddIf( null != this._isDataAction ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonBoolean((bool)this._isDataAction) : null, "isDataAction" ,container.Add ); + AddIf( null != (((object)this._origin)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._origin.ToString()) : null, "origin" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationModelCollection.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationModelCollection.PowerShell.cs new file mode 100644 index 000000000000..9e2e2f46583f --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationModelCollection.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Available operations of the service. + [System.ComponentModel.TypeConverter(typeof(OperationModelCollectionTypeConverter))] + public partial class OperationModelCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new OperationModelCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new OperationModelCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal OperationModelCollection(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.Migrate.Models.Api20210216Preview.IOperationModelCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModel[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.OperationModelTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelCollectionInternal)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 OperationModelCollection(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.Migrate.Models.Api20210216Preview.IOperationModelCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModel[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.OperationModelTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelCollectionInternal)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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Available operations of the service. + [System.ComponentModel.TypeConverter(typeof(OperationModelCollectionTypeConverter))] + public partial interface IOperationModelCollection + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationModelCollection.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationModelCollection.TypeConverter.cs new file mode 100644 index 000000000000..43ab294972bd --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationModelCollection.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class OperationModelCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return OperationModelCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return OperationModelCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return OperationModelCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationModelCollection.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationModelCollection.cs new file mode 100644 index 000000000000..e2386e98e6a7 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationModelCollection.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Available operations of the service. + public partial class OperationModelCollection : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelCollection, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// Gets or sets the value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModel[] _value; + + /// Gets or sets the list of operations. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModel[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public OperationModelCollection() + { + + } + } + /// Available operations of the service. + public partial interface IOperationModelCollection : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the value of next link.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// Gets or sets the list of operations. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the list of operations.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModel) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModel[] Value { get; set; } + + } + /// Available operations of the service. + internal partial interface IOperationModelCollectionInternal + + { + /// Gets or sets the value of next link. + string NextLink { get; set; } + /// Gets or sets the list of operations. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModel[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationModelCollection.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationModelCollection.json.cs new file mode 100644 index 000000000000..e242a8dcd587 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationModelCollection.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Available operations of the service. + public partial class OperationModelCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new OperationModelCollection(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal OperationModelCollection(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Models.Api20210216Preview.IOperationModel) (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.OperationModel.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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationModelProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationModelProperties.PowerShell.cs new file mode 100644 index 000000000000..1786cae67369 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationModelProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Operation model properties. + [System.ComponentModel.TypeConverter(typeof(OperationModelPropertiesTypeConverter))] + public partial class OperationModelProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new OperationModelProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new OperationModelProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal OperationModelProperties(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.Migrate.Models.Api20210216Preview.IOperationModelPropertiesInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelPropertiesInternal)this).Provider, global::System.Convert.ToString); + } + if (content.Contains("Resource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelPropertiesInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelPropertiesInternal)this).Resource, global::System.Convert.ToString); + } + if (content.Contains("Operation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelPropertiesInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelPropertiesInternal)this).Operation, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelPropertiesInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelPropertiesInternal)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 OperationModelProperties(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.Migrate.Models.Api20210216Preview.IOperationModelPropertiesInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelPropertiesInternal)this).Provider, global::System.Convert.ToString); + } + if (content.Contains("Resource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelPropertiesInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelPropertiesInternal)this).Resource, global::System.Convert.ToString); + } + if (content.Contains("Operation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelPropertiesInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelPropertiesInternal)this).Operation, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelPropertiesInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelPropertiesInternal)this).Description, 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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Operation model properties. + [System.ComponentModel.TypeConverter(typeof(OperationModelPropertiesTypeConverter))] + public partial interface IOperationModelProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationModelProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationModelProperties.TypeConverter.cs new file mode 100644 index 000000000000..59c8897acfb8 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationModelProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class OperationModelPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return OperationModelProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return OperationModelProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return OperationModelProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationModelProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationModelProperties.cs new file mode 100644 index 000000000000..f6d96137c4d0 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationModelProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Operation model properties. + public partial class OperationModelProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelPropertiesInternal + { + + /// Backing field for property. + private string _description; + + /// Gets or sets the description. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Description { get => this._description; set => this._description = value; } + + /// Backing field for property. + private string _operation; + + /// Gets or sets the operation. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Operation { get => this._operation; set => this._operation = value; } + + /// Backing field for property. + private string _provider; + + /// Gets or sets the resource provider name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Provider { get => this._provider; set => this._provider = value; } + + /// Backing field for property. + private string _resource; + + /// Gets or sets resource name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Resource { get => this._resource; set => this._resource = value; } + + /// Creates an new instance. + public OperationModelProperties() + { + + } + } + /// Operation model properties. + public partial interface IOperationModelProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the description. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the description.", + SerializedName = @"description", + PossibleTypes = new [] { typeof(string) })] + string Description { get; set; } + /// Gets or sets the operation. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the operation.", + SerializedName = @"operation", + PossibleTypes = new [] { typeof(string) })] + string Operation { get; set; } + /// Gets or sets the resource provider name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the resource provider name.", + SerializedName = @"provider", + PossibleTypes = new [] { typeof(string) })] + string Provider { get; set; } + /// Gets or sets resource name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets resource name.", + SerializedName = @"resource", + PossibleTypes = new [] { typeof(string) })] + string Resource { get; set; } + + } + /// Operation model properties. + internal partial interface IOperationModelPropertiesInternal + + { + /// Gets or sets the description. + string Description { get; set; } + /// Gets or sets the operation. + string Operation { get; set; } + /// Gets or sets the resource provider name. + string Provider { get; set; } + /// Gets or sets resource name. + string Resource { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationModelProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationModelProperties.json.cs new file mode 100644 index 000000000000..56709a5d532a --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationModelProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Operation model properties. + public partial class OperationModelProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationModelProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new OperationModelProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal OperationModelProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._provider.ToString()) : null, "provider" ,container.Add ); + AddIf( null != (((object)this._resource)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._resource.ToString()) : null, "resource" ,container.Add ); + AddIf( null != (((object)this._operation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._operation.ToString()) : null, "operation" ,container.Add ); + AddIf( null != (((object)this._description)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._description.ToString()) : null, "description" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationStatusAutoGenerated.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationStatusAutoGenerated.PowerShell.cs new file mode 100644 index 000000000000..de2b10e8ae9a --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationStatusAutoGenerated.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Defines the operation status. + [System.ComponentModel.TypeConverter(typeof(OperationStatusAutoGeneratedTypeConverter))] + public partial class OperationStatusAutoGenerated + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationStatusAutoGenerated DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new OperationStatusAutoGenerated(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationStatusAutoGenerated DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new OperationStatusAutoGenerated(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationStatusAutoGenerated FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal OperationStatusAutoGenerated(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.Migrate.Models.Api20210216Preview.IOperationStatusAutoGeneratedInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationStatusAutoGeneratedInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationStatusAutoGeneratedInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationStatusAutoGeneratedInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationStatusAutoGeneratedInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationStatusAutoGeneratedInternal)this).Status, global::System.Convert.ToString); + } + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationStatusAutoGeneratedInternal)this).StartTime = (string) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationStatusAutoGeneratedInternal)this).StartTime, global::System.Convert.ToString); + } + if (content.Contains("EndTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationStatusAutoGeneratedInternal)this).EndTime = (string) content.GetValueForProperty("EndTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationStatusAutoGeneratedInternal)this).EndTime, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal OperationStatusAutoGenerated(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.Migrate.Models.Api20210216Preview.IOperationStatusAutoGeneratedInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationStatusAutoGeneratedInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationStatusAutoGeneratedInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationStatusAutoGeneratedInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Status")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationStatusAutoGeneratedInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationStatusAutoGeneratedInternal)this).Status, global::System.Convert.ToString); + } + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationStatusAutoGeneratedInternal)this).StartTime = (string) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationStatusAutoGeneratedInternal)this).StartTime, global::System.Convert.ToString); + } + if (content.Contains("EndTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationStatusAutoGeneratedInternal)this).EndTime = (string) content.GetValueForProperty("EndTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationStatusAutoGeneratedInternal)this).EndTime, 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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Defines the operation status. + [System.ComponentModel.TypeConverter(typeof(OperationStatusAutoGeneratedTypeConverter))] + public partial interface IOperationStatusAutoGenerated + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationStatusAutoGenerated.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationStatusAutoGenerated.TypeConverter.cs new file mode 100644 index 000000000000..ec36182f2acc --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationStatusAutoGenerated.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class OperationStatusAutoGeneratedTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationStatusAutoGenerated ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationStatusAutoGenerated).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return OperationStatusAutoGenerated.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return OperationStatusAutoGenerated.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return OperationStatusAutoGenerated.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationStatusAutoGenerated.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationStatusAutoGenerated.cs new file mode 100644 index 000000000000..e2b3cf3edd23 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationStatusAutoGenerated.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Defines the operation status. + public partial class OperationStatusAutoGenerated : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationStatusAutoGenerated, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationStatusAutoGeneratedInternal + { + + /// Backing field for property. + private string _endTime; + + /// Gets or sets the end time. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string EndTime { get => this._endTime; set => this._endTime = value; } + + /// Backing field for property. + private string _id; + + /// Gets or sets the Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Id { get => this._id; set => this._id = value; } + + /// Backing field for property. + private string _name; + + /// Gets or sets the operation name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private string _startTime; + + /// Gets or sets the start time. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string StartTime { get => this._startTime; set => this._startTime = value; } + + /// Backing field for property. + private string _status; + + /// + /// Gets or sets the status of the operation. ARM expects the terminal status to be one of + /// Succeeded/ Failed/ Canceled. All other values imply that the operation is still running. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Status { get => this._status; set => this._status = value; } + + /// Creates an new instance. + public OperationStatusAutoGenerated() + { + + } + } + /// Defines the operation status. + public partial interface IOperationStatusAutoGenerated : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the end time. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the end time.", + SerializedName = @"endTime", + PossibleTypes = new [] { typeof(string) })] + string EndTime { get; set; } + /// Gets or sets the Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the Id.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; set; } + /// Gets or sets the operation name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the operation name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + /// Gets or sets the start time. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the start time.", + SerializedName = @"startTime", + PossibleTypes = new [] { typeof(string) })] + string StartTime { get; set; } + /// + /// Gets or sets the status of the operation. ARM expects the terminal status to be one of + /// Succeeded/ Failed/ Canceled. All other values imply that the operation is still running. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the status of the operation. ARM expects the terminal status to be one of + Succeeded/ Failed/ Canceled. All other values imply that the operation is still running.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(string) })] + string Status { get; set; } + + } + /// Defines the operation status. + internal partial interface IOperationStatusAutoGeneratedInternal + + { + /// Gets or sets the end time. + string EndTime { get; set; } + /// Gets or sets the Id. + string Id { get; set; } + /// Gets or sets the operation name. + string Name { get; set; } + /// Gets or sets the start time. + string StartTime { get; set; } + /// + /// Gets or sets the status of the operation. ARM expects the terminal status to be one of + /// Succeeded/ Failed/ Canceled. All other values imply that the operation is still running. + /// + string Status { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationStatusAutoGenerated.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationStatusAutoGenerated.json.cs new file mode 100644 index 000000000000..c57dae86404a --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/OperationStatusAutoGenerated.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Defines the operation status. + public partial class OperationStatusAutoGenerated + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationStatusAutoGenerated. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationStatusAutoGenerated. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationStatusAutoGenerated FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new OperationStatusAutoGenerated(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal OperationStatusAutoGenerated(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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;} + {_status = If( json?.PropertyT("status"), out var __jsonStatus) ? (string)__jsonStatus : (string)Status;} + {_startTime = If( json?.PropertyT("startTime"), out var __jsonStartTime) ? (string)__jsonStartTime : (string)StartTime;} + {_endTime = If( json?.PropertyT("endTime"), out var __jsonEndTime) ? (string)__jsonEndTime : (string)EndTime;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AddIf( null != (((object)this._status)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._status.ToString()) : null, "status" ,container.Add ); + AddIf( null != (((object)this._startTime)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._startTime.ToString()) : null, "startTime" ,container.Add ); + AddIf( null != (((object)this._endTime)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._endTime.ToString()) : null, "endTime" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PlannedFailoverModel.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PlannedFailoverModel.PowerShell.cs new file mode 100644 index 000000000000..d6518ff3a61d --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PlannedFailoverModel.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Planned failover model. + [System.ComponentModel.TypeConverter(typeof(PlannedFailoverModelTypeConverter))] + public partial class PlannedFailoverModel + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModel DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PlannedFailoverModel(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModel DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PlannedFailoverModel(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModel FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PlannedFailoverModel(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.Migrate.Models.Api20210216Preview.IPlannedFailoverModelInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PlannedFailoverModelPropertiesTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PlannedFailoverModel(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.Migrate.Models.Api20210216Preview.IPlannedFailoverModelInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PlannedFailoverModelPropertiesTypeConverter.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Planned failover model. + [System.ComponentModel.TypeConverter(typeof(PlannedFailoverModelTypeConverter))] + public partial interface IPlannedFailoverModel + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PlannedFailoverModel.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PlannedFailoverModel.TypeConverter.cs new file mode 100644 index 000000000000..4696659e8ec6 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PlannedFailoverModel.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PlannedFailoverModelTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModel ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModel).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PlannedFailoverModel.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PlannedFailoverModel.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PlannedFailoverModel.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PlannedFailoverModel.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PlannedFailoverModel.cs new file mode 100644 index 000000000000..9651939accd8 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PlannedFailoverModel.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Planned failover model. + public partial class PlannedFailoverModel : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModel, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelProperties _property; + + /// Planned failover model properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PlannedFailoverModelProperties()); set => this._property = value; } + + /// Creates an new instance. + public PlannedFailoverModel() + { + + } + } + /// Planned failover model. + public partial interface IPlannedFailoverModel : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Planned failover model properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Planned failover model properties.", + SerializedName = @"properties", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelProperties) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelProperties Property { get; set; } + + } + /// Planned failover model. + internal partial interface IPlannedFailoverModelInternal + + { + /// Planned failover model properties. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelProperties Property { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PlannedFailoverModel.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PlannedFailoverModel.json.cs new file mode 100644 index 000000000000..d239527e6cbd --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PlannedFailoverModel.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Planned failover model. + public partial class PlannedFailoverModel + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModel. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModel. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModel FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new PlannedFailoverModel(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal PlannedFailoverModel(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api20210216Preview.PlannedFailoverModelProperties.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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.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/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PlannedFailoverModelCustomProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PlannedFailoverModelCustomProperties.PowerShell.cs new file mode 100644 index 000000000000..8b7ffc9e758d --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PlannedFailoverModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Planned failover model custom properties. + [System.ComponentModel.TypeConverter(typeof(PlannedFailoverModelCustomPropertiesTypeConverter))] + public partial class PlannedFailoverModelCustomProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelCustomProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PlannedFailoverModelCustomProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelCustomProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PlannedFailoverModelCustomProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelCustomProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PlannedFailoverModelCustomProperties(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.Migrate.Models.Api20210216Preview.IPlannedFailoverModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelCustomPropertiesInternal)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 PlannedFailoverModelCustomProperties(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.Migrate.Models.Api20210216Preview.IPlannedFailoverModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelCustomPropertiesInternal)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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Planned failover model custom properties. + [System.ComponentModel.TypeConverter(typeof(PlannedFailoverModelCustomPropertiesTypeConverter))] + public partial interface IPlannedFailoverModelCustomProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PlannedFailoverModelCustomProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PlannedFailoverModelCustomProperties.TypeConverter.cs new file mode 100644 index 000000000000..c9ed55c7695b --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PlannedFailoverModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PlannedFailoverModelCustomPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelCustomProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelCustomProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PlannedFailoverModelCustomProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PlannedFailoverModelCustomProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PlannedFailoverModelCustomProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PlannedFailoverModelCustomProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PlannedFailoverModelCustomProperties.cs new file mode 100644 index 000000000000..57f2b2b618da --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PlannedFailoverModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Planned failover model custom properties. + public partial class PlannedFailoverModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelCustomProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelCustomPropertiesInternal + { + + /// Backing field for property. + private string _instanceType; + + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Creates an new instance. + public PlannedFailoverModelCustomProperties() + { + + } + } + /// Planned failover model custom properties. + public partial interface IPlannedFailoverModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Planned failover model custom properties. + internal partial interface IPlannedFailoverModelCustomPropertiesInternal + + { + /// Gets or sets the instance type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PlannedFailoverModelCustomProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PlannedFailoverModelCustomProperties.json.cs new file mode 100644 index 000000000000..62ace576a987 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PlannedFailoverModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Planned failover model custom properties. + public partial class PlannedFailoverModelCustomProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelCustomProperties. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelCustomProperties 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.Migrate.Models.Api20210216Preview.IPlannedFailoverModelCustomProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelCustomProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "HyperVToAzStackHCI": + { + return new HyperVToAzStackHciplannedFailoverModelCustomProperties(json); + } + case "VMwareToAzStackHCI": + { + return new VMwareToAzStackHciplannedFailoverModelCustomProperties(json); + } + } + return new PlannedFailoverModelCustomProperties(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal PlannedFailoverModelCustomProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PlannedFailoverModelProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PlannedFailoverModelProperties.PowerShell.cs new file mode 100644 index 000000000000..2a55e61ac734 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PlannedFailoverModelProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Planned failover model properties. + [System.ComponentModel.TypeConverter(typeof(PlannedFailoverModelPropertiesTypeConverter))] + public partial class PlannedFailoverModelProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PlannedFailoverModelProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PlannedFailoverModelProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PlannedFailoverModelProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CustomProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelPropertiesInternal)this).CustomProperty = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelCustomProperties) content.GetValueForProperty("CustomProperty",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelPropertiesInternal)this).CustomProperty, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PlannedFailoverModelCustomPropertiesTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PlannedFailoverModelProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CustomProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelPropertiesInternal)this).CustomProperty = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelCustomProperties) content.GetValueForProperty("CustomProperty",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelPropertiesInternal)this).CustomProperty, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PlannedFailoverModelCustomPropertiesTypeConverter.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Planned failover model properties. + [System.ComponentModel.TypeConverter(typeof(PlannedFailoverModelPropertiesTypeConverter))] + public partial interface IPlannedFailoverModelProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PlannedFailoverModelProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PlannedFailoverModelProperties.TypeConverter.cs new file mode 100644 index 000000000000..558720047280 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PlannedFailoverModelProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PlannedFailoverModelPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PlannedFailoverModelProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PlannedFailoverModelProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PlannedFailoverModelProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PlannedFailoverModelProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PlannedFailoverModelProperties.cs new file mode 100644 index 000000000000..72082bd628c0 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PlannedFailoverModelProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Planned failover model properties. + public partial class PlannedFailoverModelProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelPropertiesInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelCustomProperties _customProperty; + + /// Planned failover model custom properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelCustomProperties CustomProperty { get => (this._customProperty = this._customProperty ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PlannedFailoverModelCustomProperties()); set => this._customProperty = value; } + + /// Creates an new instance. + public PlannedFailoverModelProperties() + { + + } + } + /// Planned failover model properties. + public partial interface IPlannedFailoverModelProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Planned failover model custom properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Planned failover model custom properties.", + SerializedName = @"customProperties", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelCustomProperties) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelCustomProperties CustomProperty { get; set; } + + } + /// Planned failover model properties. + internal partial interface IPlannedFailoverModelPropertiesInternal + + { + /// Planned failover model custom properties. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelCustomProperties CustomProperty { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PlannedFailoverModelProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PlannedFailoverModelProperties.json.cs new file mode 100644 index 000000000000..41df3da45e71 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PlannedFailoverModelProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Planned failover model properties. + public partial class PlannedFailoverModelProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new PlannedFailoverModelProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal PlannedFailoverModelProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_customProperty = If( json?.PropertyT("customProperties"), out var __jsonCustomProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PlannedFailoverModelCustomProperties.FromJson(__jsonCustomProperties) : CustomProperty;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._customProperty ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._customProperty.ToJson(null,serializationMode) : null, "customProperties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModel.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModel.PowerShell.cs new file mode 100644 index 000000000000..f906c1f6f32d --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModel.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Policy model. + [System.ComponentModel.TypeConverter(typeof(PolicyModelTypeConverter))] + public partial class PolicyModel + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PolicyModel(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PolicyModel(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PolicyModel(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModelTypeConverter.ConvertFrom); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PolicyModelPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal)this).SystemDataLastModifiedAt, (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 PolicyModel(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModelTypeConverter.ConvertFrom); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PolicyModelPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal)this).SystemDataLastModifiedAt, (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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Policy model. + [System.ComponentModel.TypeConverter(typeof(PolicyModelTypeConverter))] + public partial interface IPolicyModel + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModel.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModel.TypeConverter.cs new file mode 100644 index 000000000000..4584202eaa7e --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModel.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PolicyModelTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PolicyModel.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PolicyModel.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PolicyModel.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModel.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModel.cs new file mode 100644 index 000000000000..8e52f84acfcb --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModel.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Policy model. + public partial class PolicyModel : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal + { + + /// Backing field for property. + private string _id; + + /// Gets or sets the Id of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Id { get => this._id; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal.Id { get => this._id; set { {_id = value;} } } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal.Name { get => this._name; set { {_name = value;} } } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal.SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel()); set { {_systemData = value;} } } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelInternal.Type { get => this._type; set { {_type = value;} } } + + /// Backing field for property. + private string _name; + + /// Gets or sets the name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Name { get => this._name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelProperties _property; + + /// Policy model properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PolicyModelProperties()); set => this._property = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel _systemData; + + /// System data required to be defined for Azure resources. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel()); } + + /// Gets or sets the timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedByType = value ?? null; } + + /// Gets or sets the timestamp of resource last modification (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets the identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedByType = value ?? null; } + + /// Backing field for property. + private string _type; + + /// Gets or sets the type of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Type { get => this._type; } + + /// Creates an new instance. + public PolicyModel() + { + + } + } + /// Policy model. + public partial interface IPolicyModel : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the Id of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the Id of the resource.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; } + /// Gets or sets the name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the name of the resource.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; } + /// Policy model properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Policy model properties.", + SerializedName = @"properties", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelProperties) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelProperties Property { get; set; } + /// Gets or sets the timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the timestamp of resource creation (UTC).", + SerializedName = @"createdAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataCreatedAt { get; set; } + /// Gets or sets identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets identity that created the resource.", + SerializedName = @"createdBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataCreatedBy { get; set; } + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the type of identity that created the resource: user, application, + managedIdentity.", + SerializedName = @"createdByType", + PossibleTypes = new [] { typeof(string) })] + string SystemDataCreatedByType { get; set; } + /// Gets or sets the timestamp of resource last modification (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the timestamp of resource last modification (UTC).", + SerializedName = @"lastModifiedAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataLastModifiedAt { get; set; } + /// Gets or sets the identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the identity that last modified the resource.", + SerializedName = @"lastModifiedBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataLastModifiedBy { get; set; } + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the type of identity that last modified the resource: user, application, + managedIdentity.", + SerializedName = @"lastModifiedByType", + PossibleTypes = new [] { typeof(string) })] + string SystemDataLastModifiedByType { get; set; } + /// Gets or sets the type of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the type of the resource.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; } + + } + /// Policy model. + internal partial interface IPolicyModelInternal + + { + /// Gets or sets the Id of the resource. + string Id { get; set; } + /// Gets or sets the name of the resource. + string Name { get; set; } + /// Policy model properties. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelProperties Property { get; set; } + /// System data required to be defined for Azure resources. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel SystemData { get; set; } + /// Gets or sets the timestamp of resource creation (UTC). + global::System.DateTime? SystemDataCreatedAt { get; set; } + /// Gets or sets identity that created the resource. + string SystemDataCreatedBy { get; set; } + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + string SystemDataCreatedByType { get; set; } + /// Gets or sets the timestamp of resource last modification (UTC). + global::System.DateTime? SystemDataLastModifiedAt { get; set; } + /// Gets or sets the identity that last modified the resource. + string SystemDataLastModifiedBy { get; set; } + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + string SystemDataLastModifiedByType { get; set; } + /// Gets or sets the type of the resource. + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModel.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModel.json.cs new file mode 100644 index 000000000000..d5d3ffaf95ea --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModel.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Policy model. + public partial class PolicyModel + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new PolicyModel(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal PolicyModel(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_systemData = If( json?.PropertyT("systemData"), out var __jsonSystemData) ? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel.FromJson(__jsonSystemData) : SystemData;} + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PolicyModelProperties.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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._systemData ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._systemData.ToJson(null,serializationMode) : null, "systemData" ,container.Add ); + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelCollection.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelCollection.PowerShell.cs new file mode 100644 index 000000000000..90ee719bf6bb --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelCollection.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Policy model collection. + [System.ComponentModel.TypeConverter(typeof(PolicyModelCollectionTypeConverter))] + public partial class PolicyModelCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PolicyModelCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PolicyModelCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PolicyModelCollection(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.Migrate.Models.Api20210216Preview.IPolicyModelCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PolicyModelTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCollectionInternal)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 PolicyModelCollection(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.Migrate.Models.Api20210216Preview.IPolicyModelCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PolicyModelTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCollectionInternal)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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Policy model collection. + [System.ComponentModel.TypeConverter(typeof(PolicyModelCollectionTypeConverter))] + public partial interface IPolicyModelCollection + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelCollection.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelCollection.TypeConverter.cs new file mode 100644 index 000000000000..bed4e82c62eb --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelCollection.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PolicyModelCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PolicyModelCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PolicyModelCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PolicyModelCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelCollection.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelCollection.cs new file mode 100644 index 000000000000..85fce8202a9e --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelCollection.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Policy model collection. + public partial class PolicyModelCollection : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCollection, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// Gets or sets the value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel[] _value; + + /// Gets or sets the list of policies. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public PolicyModelCollection() + { + + } + } + /// Policy model collection. + public partial interface IPolicyModelCollection : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the value of next link.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// Gets or sets the list of policies. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the list of policies.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel[] Value { get; set; } + + } + /// Policy model collection. + internal partial interface IPolicyModelCollectionInternal + + { + /// Gets or sets the value of next link. + string NextLink { get; set; } + /// Gets or sets the list of policies. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelCollection.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelCollection.json.cs new file mode 100644 index 000000000000..47d81e9e4e13 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelCollection.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Policy model collection. + public partial class PolicyModelCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new PolicyModelCollection(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal PolicyModelCollection(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Models.Api20210216Preview.IPolicyModel) (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PolicyModel.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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelCustomProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelCustomProperties.PowerShell.cs new file mode 100644 index 000000000000..a5a037b8db68 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Policy model custom properties. + [System.ComponentModel.TypeConverter(typeof(PolicyModelCustomPropertiesTypeConverter))] + public partial class PolicyModelCustomProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCustomProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PolicyModelCustomProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCustomProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PolicyModelCustomProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCustomProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PolicyModelCustomProperties(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.Migrate.Models.Api20210216Preview.IPolicyModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCustomPropertiesInternal)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 PolicyModelCustomProperties(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.Migrate.Models.Api20210216Preview.IPolicyModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCustomPropertiesInternal)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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Policy model custom properties. + [System.ComponentModel.TypeConverter(typeof(PolicyModelCustomPropertiesTypeConverter))] + public partial interface IPolicyModelCustomProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelCustomProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelCustomProperties.TypeConverter.cs new file mode 100644 index 000000000000..46cd468c3b9d --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelCustomProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PolicyModelCustomPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCustomProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCustomProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PolicyModelCustomProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PolicyModelCustomProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PolicyModelCustomProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelCustomProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelCustomProperties.cs new file mode 100644 index 000000000000..27461ebec8d0 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Policy model custom properties. + public partial class PolicyModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCustomProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCustomPropertiesInternal + { + + /// Backing field for property. + private string _instanceType; + + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Creates an new instance. + public PolicyModelCustomProperties() + { + + } + } + /// Policy model custom properties. + public partial interface IPolicyModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Policy model custom properties. + internal partial interface IPolicyModelCustomPropertiesInternal + + { + /// Gets or sets the instance type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelCustomProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelCustomProperties.json.cs new file mode 100644 index 000000000000..fb0945d1ecc5 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Policy model custom properties. + public partial class PolicyModelCustomProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCustomProperties. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCustomProperties 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.Migrate.Models.Api20210216Preview.IPolicyModelCustomProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCustomProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "HyperVToAzStackHCI": + { + return new HyperVToAzStackHcipolicyModelCustomProperties(json); + } + case "VMwareToAzStackHCI": + { + return new VMwareToAzStackHcipolicyModelCustomProperties(json); + } + } + return new PolicyModelCustomProperties(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal PolicyModelCustomProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelProperties.PowerShell.cs new file mode 100644 index 000000000000..fabb0733283d --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Policy model properties. + [System.ComponentModel.TypeConverter(typeof(PolicyModelPropertiesTypeConverter))] + public partial class PolicyModelProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PolicyModelProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PolicyModelProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PolicyModelProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelPropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelPropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState.CreateFrom); + } + if (content.Contains("CustomProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelPropertiesInternal)this).CustomProperty = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCustomProperties) content.GetValueForProperty("CustomProperty",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelPropertiesInternal)this).CustomProperty, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PolicyModelCustomPropertiesTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PolicyModelProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelPropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelPropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState.CreateFrom); + } + if (content.Contains("CustomProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelPropertiesInternal)this).CustomProperty = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCustomProperties) content.GetValueForProperty("CustomProperty",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelPropertiesInternal)this).CustomProperty, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PolicyModelCustomPropertiesTypeConverter.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Policy model properties. + [System.ComponentModel.TypeConverter(typeof(PolicyModelPropertiesTypeConverter))] + public partial interface IPolicyModelProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelProperties.TypeConverter.cs new file mode 100644 index 000000000000..c686743ce835 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PolicyModelPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PolicyModelProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PolicyModelProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PolicyModelProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelProperties.cs new file mode 100644 index 000000000000..394480bd0cdf --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Policy model properties. + public partial class PolicyModelProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelPropertiesInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCustomProperties _customProperty; + + /// Policy model custom properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCustomProperties CustomProperty { get => (this._customProperty = this._customProperty ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PolicyModelCustomProperties()); set => this._customProperty = value; } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelPropertiesInternal.ProvisioningState { get => this._provisioningState; set { {_provisioningState = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState? _provisioningState; + + /// Gets or sets the provisioning state of the policy. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState? ProvisioningState { get => this._provisioningState; } + + /// Creates an new instance. + public PolicyModelProperties() + { + + } + } + /// Policy model properties. + public partial interface IPolicyModelProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Policy model custom properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Policy model custom properties.", + SerializedName = @"customProperties", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCustomProperties) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCustomProperties CustomProperty { get; set; } + /// Gets or sets the provisioning state of the policy. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the provisioning state of the policy.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState? ProvisioningState { get; } + + } + /// Policy model properties. + internal partial interface IPolicyModelPropertiesInternal + + { + /// Policy model custom properties. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCustomProperties CustomProperty { get; set; } + /// Gets or sets the provisioning state of the policy. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState? ProvisioningState { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelProperties.json.cs new file mode 100644 index 000000000000..fb5c5116a86c --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Policy model properties. + public partial class PolicyModelProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new PolicyModelProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal PolicyModelProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)ProvisioningState;} + {_customProperty = If( json?.PropertyT("customProperties"), out var __jsonCustomProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PolicyModelCustomProperties.FromJson(__jsonCustomProperties) : CustomProperty;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); + } + AddIf( null != this._customProperty ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._customProperty.ToJson(null,serializationMode) : null, "customProperties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelSystemData.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelSystemData.PowerShell.cs new file mode 100644 index 000000000000..4ac813af96bb --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelSystemData.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(PolicyModelSystemDataTypeConverter))] + public partial class PolicyModelSystemData + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelSystemData DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PolicyModelSystemData(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelSystemData DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PolicyModelSystemData(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelSystemData FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PolicyModelSystemData(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy, global::System.Convert.ToString); + } + if (content.Contains("CreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType = (string) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType, global::System.Convert.ToString); + } + if (content.Contains("CreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType = (string) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt, (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 PolicyModelSystemData(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy, global::System.Convert.ToString); + } + if (content.Contains("CreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType = (string) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType, global::System.Convert.ToString); + } + if (content.Contains("CreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType = (string) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt, (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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + [System.ComponentModel.TypeConverter(typeof(PolicyModelSystemDataTypeConverter))] + public partial interface IPolicyModelSystemData + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelSystemData.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelSystemData.TypeConverter.cs new file mode 100644 index 000000000000..44b636190499 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelSystemData.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PolicyModelSystemDataTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelSystemData ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelSystemData).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PolicyModelSystemData.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PolicyModelSystemData.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PolicyModelSystemData.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelSystemData.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelSystemData.cs new file mode 100644 index 000000000000..111bbdc0406b --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelSystemData.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + public partial class PolicyModelSystemData : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelSystemData, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelSystemDataInternal, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel __systemDataModel = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel(); + + /// Gets or sets the timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public global::System.DateTime? CreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string CreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string CreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedByType = value ?? null; } + + /// Gets or sets the timestamp of resource last modification (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public global::System.DateTime? LastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets the identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string LastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string LastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedByType = value ?? null; } + + /// Creates an new instance. + public PolicyModelSystemData() + { + + } + + /// 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.Migrate.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__systemDataModel), __systemDataModel); + await eventListener.AssertObjectIsValid(nameof(__systemDataModel), __systemDataModel); + } + } + public partial interface IPolicyModelSystemData : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel + { + + } + internal partial interface IPolicyModelSystemDataInternal : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelSystemData.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelSystemData.json.cs new file mode 100644 index 000000000000..e3112221f0a3 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/PolicyModelSystemData.json.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + public partial class PolicyModelSystemData + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelSystemData. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelSystemData. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelSystemData FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new PolicyModelSystemData(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal PolicyModelSystemData(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __systemDataModel = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __systemDataModel?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemDynamicMemoryConfig.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemDynamicMemoryConfig.PowerShell.cs new file mode 100644 index 000000000000..a8817d71a13d --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemDynamicMemoryConfig.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Protected item dynamic memory config. + [System.ComponentModel.TypeConverter(typeof(ProtectedItemDynamicMemoryConfigTypeConverter))] + public partial class ProtectedItemDynamicMemoryConfig + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemDynamicMemoryConfig DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ProtectedItemDynamicMemoryConfig(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemDynamicMemoryConfig DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ProtectedItemDynamicMemoryConfig(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemDynamicMemoryConfig FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ProtectedItemDynamicMemoryConfig(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("MaximumMemoryInMegaByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemDynamicMemoryConfigInternal)this).MaximumMemoryInMegaByte = (long) content.GetValueForProperty("MaximumMemoryInMegaByte",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemDynamicMemoryConfigInternal)this).MaximumMemoryInMegaByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("MinimumMemoryInMegaByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemDynamicMemoryConfigInternal)this).MinimumMemoryInMegaByte = (long) content.GetValueForProperty("MinimumMemoryInMegaByte",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemDynamicMemoryConfigInternal)this).MinimumMemoryInMegaByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("TargetMemoryBufferPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemDynamicMemoryConfigInternal)this).TargetMemoryBufferPercentage = (int) content.GetValueForProperty("TargetMemoryBufferPercentage",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemDynamicMemoryConfigInternal)this).TargetMemoryBufferPercentage, (__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 ProtectedItemDynamicMemoryConfig(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("MaximumMemoryInMegaByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemDynamicMemoryConfigInternal)this).MaximumMemoryInMegaByte = (long) content.GetValueForProperty("MaximumMemoryInMegaByte",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemDynamicMemoryConfigInternal)this).MaximumMemoryInMegaByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("MinimumMemoryInMegaByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemDynamicMemoryConfigInternal)this).MinimumMemoryInMegaByte = (long) content.GetValueForProperty("MinimumMemoryInMegaByte",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemDynamicMemoryConfigInternal)this).MinimumMemoryInMegaByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("TargetMemoryBufferPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemDynamicMemoryConfigInternal)this).TargetMemoryBufferPercentage = (int) content.GetValueForProperty("TargetMemoryBufferPercentage",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemDynamicMemoryConfigInternal)this).TargetMemoryBufferPercentage, (__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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Protected item dynamic memory config. + [System.ComponentModel.TypeConverter(typeof(ProtectedItemDynamicMemoryConfigTypeConverter))] + public partial interface IProtectedItemDynamicMemoryConfig + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemDynamicMemoryConfig.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemDynamicMemoryConfig.TypeConverter.cs new file mode 100644 index 000000000000..cb9f70e968d9 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemDynamicMemoryConfig.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ProtectedItemDynamicMemoryConfigTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemDynamicMemoryConfig ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemDynamicMemoryConfig).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ProtectedItemDynamicMemoryConfig.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ProtectedItemDynamicMemoryConfig.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ProtectedItemDynamicMemoryConfig.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemDynamicMemoryConfig.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemDynamicMemoryConfig.cs new file mode 100644 index 000000000000..29e026099f75 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemDynamicMemoryConfig.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Protected item dynamic memory config. + public partial class ProtectedItemDynamicMemoryConfig : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemDynamicMemoryConfig, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemDynamicMemoryConfigInternal + { + + /// Backing field for property. + private long _maximumMemoryInMegaByte; + + /// Gets or sets maximum memory in MB. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public long MaximumMemoryInMegaByte { get => this._maximumMemoryInMegaByte; set => this._maximumMemoryInMegaByte = value; } + + /// Backing field for property. + private long _minimumMemoryInMegaByte; + + /// Gets or sets minimum memory in MB. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public long MinimumMemoryInMegaByte { get => this._minimumMemoryInMegaByte; set => this._minimumMemoryInMegaByte = value; } + + /// Backing field for property. + private int _targetMemoryBufferPercentage; + + /// Gets or sets target memory buffer in %. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public int TargetMemoryBufferPercentage { get => this._targetMemoryBufferPercentage; set => this._targetMemoryBufferPercentage = value; } + + /// Creates an new instance. + public ProtectedItemDynamicMemoryConfig() + { + + } + } + /// Protected item dynamic memory config. + public partial interface IProtectedItemDynamicMemoryConfig : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets maximum memory in MB. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets maximum memory in MB.", + SerializedName = @"maximumMemoryInMegaBytes", + PossibleTypes = new [] { typeof(long) })] + long MaximumMemoryInMegaByte { get; set; } + /// Gets or sets minimum memory in MB. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets minimum memory in MB.", + SerializedName = @"minimumMemoryInMegaBytes", + PossibleTypes = new [] { typeof(long) })] + long MinimumMemoryInMegaByte { get; set; } + /// Gets or sets target memory buffer in %. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets target memory buffer in %.", + SerializedName = @"targetMemoryBufferPercentage", + PossibleTypes = new [] { typeof(int) })] + int TargetMemoryBufferPercentage { get; set; } + + } + /// Protected item dynamic memory config. + internal partial interface IProtectedItemDynamicMemoryConfigInternal + + { + /// Gets or sets maximum memory in MB. + long MaximumMemoryInMegaByte { get; set; } + /// Gets or sets minimum memory in MB. + long MinimumMemoryInMegaByte { get; set; } + /// Gets or sets target memory buffer in %. + int TargetMemoryBufferPercentage { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemDynamicMemoryConfig.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemDynamicMemoryConfig.json.cs new file mode 100644 index 000000000000..a38f44c1ca2f --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemDynamicMemoryConfig.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Protected item dynamic memory config. + public partial class ProtectedItemDynamicMemoryConfig + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemDynamicMemoryConfig. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemDynamicMemoryConfig. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemDynamicMemoryConfig FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new ProtectedItemDynamicMemoryConfig(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal ProtectedItemDynamicMemoryConfig(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_maximumMemoryInMegaByte = If( json?.PropertyT("maximumMemoryInMegaBytes"), out var __jsonMaximumMemoryInMegaBytes) ? (long)__jsonMaximumMemoryInMegaBytes : MaximumMemoryInMegaByte;} + {_minimumMemoryInMegaByte = If( json?.PropertyT("minimumMemoryInMegaBytes"), out var __jsonMinimumMemoryInMegaBytes) ? (long)__jsonMinimumMemoryInMegaBytes : MinimumMemoryInMegaByte;} + {_targetMemoryBufferPercentage = If( json?.PropertyT("targetMemoryBufferPercentage"), out var __jsonTargetMemoryBufferPercentage) ? (int)__jsonTargetMemoryBufferPercentage : TargetMemoryBufferPercentage;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNumber(this._maximumMemoryInMegaByte), "maximumMemoryInMegaBytes" ,container.Add ); + AddIf( (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNumber(this._minimumMemoryInMegaByte), "minimumMemoryInMegaBytes" ,container.Add ); + AddIf( (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNumber(this._targetMemoryBufferPercentage), "targetMemoryBufferPercentage" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemJobProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemJobProperties.PowerShell.cs new file mode 100644 index 000000000000..001082604d20 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemJobProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Protected item job properties. + [System.ComponentModel.TypeConverter(typeof(ProtectedItemJobPropertiesTypeConverter))] + public partial class ProtectedItemJobProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ProtectedItemJobProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ProtectedItemJobProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ProtectedItemJobProperties(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.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).ScenarioName = (string) content.GetValueForProperty("ScenarioName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).ScenarioName, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("DisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).DisplayName, global::System.Convert.ToString); + } + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).State, global::System.Convert.ToString); + } + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).StartTime = (global::System.DateTime?) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)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.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).EndTime = (global::System.DateTime?) content.GetValueForProperty("EndTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)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 ProtectedItemJobProperties(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.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).ScenarioName = (string) content.GetValueForProperty("ScenarioName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).ScenarioName, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("DisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).DisplayName, global::System.Convert.ToString); + } + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).State, global::System.Convert.ToString); + } + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).StartTime = (global::System.DateTime?) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)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.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).EndTime = (global::System.DateTime?) content.GetValueForProperty("EndTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).EndTime, (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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Protected item job properties. + [System.ComponentModel.TypeConverter(typeof(ProtectedItemJobPropertiesTypeConverter))] + public partial interface IProtectedItemJobProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemJobProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemJobProperties.TypeConverter.cs new file mode 100644 index 000000000000..fe5dee72319d --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemJobProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ProtectedItemJobPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ProtectedItemJobProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ProtectedItemJobProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ProtectedItemJobProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemJobProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemJobProperties.cs new file mode 100644 index 000000000000..1d2d4c6f6f1a --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemJobProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Protected item job properties. + public partial class ProtectedItemJobProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal + { + + /// Backing field for property. + private string _displayName; + + /// Gets or sets the workflow friendly display name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string DisplayName { get => this._displayName; } + + /// Backing field for property. + private global::System.DateTime? _endTime; + + /// Gets or sets end time of the workflow. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public global::System.DateTime? EndTime { get => this._endTime; } + + /// Backing field for property. + private string _id; + + /// Gets or sets workflow Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Id { get => this._id; } + + /// Internal Acessors for DisplayName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal.DisplayName { get => this._displayName; set { {_displayName = value;} } } + + /// Internal Acessors for EndTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal.EndTime { get => this._endTime; set { {_endTime = value;} } } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal.Id { get => this._id; set { {_id = value;} } } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal.Name { get => this._name; set { {_name = value;} } } + + /// Internal Acessors for ScenarioName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal.ScenarioName { get => this._scenarioName; set { {_scenarioName = value;} } } + + /// Internal Acessors for StartTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal.StartTime { get => this._startTime; set { {_startTime = value;} } } + + /// Internal Acessors for State + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal.State { get => this._state; set { {_state = value;} } } + + /// Backing field for property. + private string _name; + + /// Gets or sets workflow name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Name { get => this._name; } + + /// Backing field for property. + private string _scenarioName; + + /// Gets or sets protection scenario name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string ScenarioName { get => this._scenarioName; } + + /// Backing field for property. + private global::System.DateTime? _startTime; + + /// Gets or sets start time of the workflow. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public global::System.DateTime? StartTime { get => this._startTime; } + + /// Backing field for property. + private string _state; + + /// Gets or sets workflow state. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string State { get => this._state; } + + /// Creates an new instance. + public ProtectedItemJobProperties() + { + + } + } + /// Protected item job properties. + public partial interface IProtectedItemJobProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the workflow friendly display name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the workflow friendly display name.", + SerializedName = @"displayName", + PossibleTypes = new [] { typeof(string) })] + string DisplayName { get; } + /// Gets or sets end time of the workflow. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets end time of the workflow.", + SerializedName = @"endTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? EndTime { get; } + /// Gets or sets workflow Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets workflow Id.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; } + /// Gets or sets workflow name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets workflow name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; } + /// Gets or sets protection scenario name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets protection scenario name.", + SerializedName = @"scenarioName", + PossibleTypes = new [] { typeof(string) })] + string ScenarioName { get; } + /// Gets or sets start time of the workflow. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets start time of the workflow.", + SerializedName = @"startTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? StartTime { get; } + /// Gets or sets workflow state. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets workflow state.", + SerializedName = @"state", + PossibleTypes = new [] { typeof(string) })] + string State { get; } + + } + /// Protected item job properties. + internal partial interface IProtectedItemJobPropertiesInternal + + { + /// Gets or sets the workflow friendly display name. + string DisplayName { get; set; } + /// Gets or sets end time of the workflow. + global::System.DateTime? EndTime { get; set; } + /// Gets or sets workflow Id. + string Id { get; set; } + /// Gets or sets workflow name. + string Name { get; set; } + /// Gets or sets protection scenario name. + string ScenarioName { get; set; } + /// Gets or sets start time of the workflow. + global::System.DateTime? StartTime { get; set; } + /// Gets or sets workflow state. + string State { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemJobProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemJobProperties.json.cs new file mode 100644 index 000000000000..1ebae0807e65 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemJobProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Protected item job properties. + public partial class ProtectedItemJobProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new ProtectedItemJobProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal ProtectedItemJobProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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;} + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_displayName = If( json?.PropertyT("displayName"), out var __jsonDisplayName) ? (string)__jsonDisplayName : (string)DisplayName;} + {_state = If( json?.PropertyT("state"), out var __jsonState) ? (string)__jsonState : (string)State;} + {_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); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._scenarioName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._scenarioName.ToString()) : null, "scenarioName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._displayName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._displayName.ToString()) : null, "displayName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._state)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._state.ToString()) : null, "state" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._startTime ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._endTime ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModel.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModel.PowerShell.cs new file mode 100644 index 000000000000..3aaba13cbd74 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModel.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Protected item model. + [System.ComponentModel.TypeConverter(typeof(ProtectedItemModelTypeConverter))] + public partial class ProtectedItemModel + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ProtectedItemModel(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ProtectedItemModel(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ProtectedItemModel(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModelTypeConverter.ConvertFrom); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal)this).SystemDataLastModifiedAt, (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 ProtectedItemModel(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModelTypeConverter.ConvertFrom); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal)this).SystemDataLastModifiedAt, (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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Protected item model. + [System.ComponentModel.TypeConverter(typeof(ProtectedItemModelTypeConverter))] + public partial interface IProtectedItemModel + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModel.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModel.TypeConverter.cs new file mode 100644 index 000000000000..9c3233f191ea --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModel.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ProtectedItemModelTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ProtectedItemModel.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ProtectedItemModel.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ProtectedItemModel.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModel.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModel.cs new file mode 100644 index 000000000000..591bcf25f0b6 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModel.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Protected item model. + public partial class ProtectedItemModel : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal + { + + /// Backing field for property. + private string _id; + + /// Gets or sets the Id of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Id { get => this._id; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal.Id { get => this._id; set { {_id = value;} } } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal.Name { get => this._name; set { {_name = value;} } } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal.SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel()); set { {_systemData = value;} } } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelInternal.Type { get => this._type; set { {_type = value;} } } + + /// Backing field for property. + private string _name; + + /// Gets or sets the name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Name { get => this._name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelProperties _property; + + /// Protected item model properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelProperties()); set => this._property = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel _systemData; + + /// System data required to be defined for Azure resources. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel()); } + + /// Gets or sets the timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedByType = value ?? null; } + + /// Gets or sets the timestamp of resource last modification (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets the identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedByType = value ?? null; } + + /// Backing field for property. + private string _type; + + /// Gets or sets the type of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Type { get => this._type; } + + /// Creates an new instance. + public ProtectedItemModel() + { + + } + } + /// Protected item model. + public partial interface IProtectedItemModel : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the Id of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the Id of the resource.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; } + /// Gets or sets the name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the name of the resource.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; } + /// Protected item model properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protected item model properties.", + SerializedName = @"properties", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelProperties) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelProperties Property { get; set; } + /// Gets or sets the timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the timestamp of resource creation (UTC).", + SerializedName = @"createdAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataCreatedAt { get; set; } + /// Gets or sets identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets identity that created the resource.", + SerializedName = @"createdBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataCreatedBy { get; set; } + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the type of identity that created the resource: user, application, + managedIdentity.", + SerializedName = @"createdByType", + PossibleTypes = new [] { typeof(string) })] + string SystemDataCreatedByType { get; set; } + /// Gets or sets the timestamp of resource last modification (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the timestamp of resource last modification (UTC).", + SerializedName = @"lastModifiedAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataLastModifiedAt { get; set; } + /// Gets or sets the identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the identity that last modified the resource.", + SerializedName = @"lastModifiedBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataLastModifiedBy { get; set; } + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the type of identity that last modified the resource: user, application, + managedIdentity.", + SerializedName = @"lastModifiedByType", + PossibleTypes = new [] { typeof(string) })] + string SystemDataLastModifiedByType { get; set; } + /// Gets or sets the type of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the type of the resource.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; } + + } + /// Protected item model. + internal partial interface IProtectedItemModelInternal + + { + /// Gets or sets the Id of the resource. + string Id { get; set; } + /// Gets or sets the name of the resource. + string Name { get; set; } + /// Protected item model properties. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelProperties Property { get; set; } + /// System data required to be defined for Azure resources. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel SystemData { get; set; } + /// Gets or sets the timestamp of resource creation (UTC). + global::System.DateTime? SystemDataCreatedAt { get; set; } + /// Gets or sets identity that created the resource. + string SystemDataCreatedBy { get; set; } + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + string SystemDataCreatedByType { get; set; } + /// Gets or sets the timestamp of resource last modification (UTC). + global::System.DateTime? SystemDataLastModifiedAt { get; set; } + /// Gets or sets the identity that last modified the resource. + string SystemDataLastModifiedBy { get; set; } + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + string SystemDataLastModifiedByType { get; set; } + /// Gets or sets the type of the resource. + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModel.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModel.json.cs new file mode 100644 index 000000000000..59200abe7584 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModel.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Protected item model. + public partial class ProtectedItemModel + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new ProtectedItemModel(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal ProtectedItemModel(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_systemData = If( json?.PropertyT("systemData"), out var __jsonSystemData) ? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel.FromJson(__jsonSystemData) : SystemData;} + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelProperties.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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._systemData ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._systemData.ToJson(null,serializationMode) : null, "systemData" ,container.Add ); + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelCollection.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelCollection.PowerShell.cs new file mode 100644 index 000000000000..d1096fb4cd74 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelCollection.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Protected item model collection. + [System.ComponentModel.TypeConverter(typeof(ProtectedItemModelCollectionTypeConverter))] + public partial class ProtectedItemModelCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ProtectedItemModelCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ProtectedItemModelCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ProtectedItemModelCollection(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.Migrate.Models.Api20210216Preview.IProtectedItemModelCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCollectionInternal)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 ProtectedItemModelCollection(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.Migrate.Models.Api20210216Preview.IProtectedItemModelCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCollectionInternal)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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Protected item model collection. + [System.ComponentModel.TypeConverter(typeof(ProtectedItemModelCollectionTypeConverter))] + public partial interface IProtectedItemModelCollection + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelCollection.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelCollection.TypeConverter.cs new file mode 100644 index 000000000000..f3ca6fd45c9a --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelCollection.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ProtectedItemModelCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ProtectedItemModelCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ProtectedItemModelCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ProtectedItemModelCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelCollection.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelCollection.cs new file mode 100644 index 000000000000..d3d8d9922fa9 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelCollection.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Protected item model collection. + public partial class ProtectedItemModelCollection : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCollection, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// Gets or sets the value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel[] _value; + + /// Gets or sets the list of protected items. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public ProtectedItemModelCollection() + { + + } + } + /// Protected item model collection. + public partial interface IProtectedItemModelCollection : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the value of next link.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// Gets or sets the list of protected items. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the list of protected items.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel[] Value { get; set; } + + } + /// Protected item model collection. + internal partial interface IProtectedItemModelCollectionInternal + + { + /// Gets or sets the value of next link. + string NextLink { get; set; } + /// Gets or sets the list of protected items. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelCollection.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelCollection.json.cs new file mode 100644 index 000000000000..07cf82ed82e2 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelCollection.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Protected item model collection. + public partial class ProtectedItemModelCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new ProtectedItemModelCollection(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal ProtectedItemModelCollection(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Models.Api20210216Preview.IProtectedItemModel) (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModel.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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelCustomProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelCustomProperties.PowerShell.cs new file mode 100644 index 000000000000..8a14f50a8c16 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Protected item model custom properties. + [System.ComponentModel.TypeConverter(typeof(ProtectedItemModelCustomPropertiesTypeConverter))] + public partial class ProtectedItemModelCustomProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCustomProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ProtectedItemModelCustomProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCustomProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ProtectedItemModelCustomProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCustomProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ProtectedItemModelCustomProperties(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.Migrate.Models.Api20210216Preview.IProtectedItemModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCustomPropertiesInternal)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 ProtectedItemModelCustomProperties(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.Migrate.Models.Api20210216Preview.IProtectedItemModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCustomPropertiesInternal)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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Protected item model custom properties. + [System.ComponentModel.TypeConverter(typeof(ProtectedItemModelCustomPropertiesTypeConverter))] + public partial interface IProtectedItemModelCustomProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelCustomProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelCustomProperties.TypeConverter.cs new file mode 100644 index 000000000000..dd45c0beec41 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ProtectedItemModelCustomPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCustomProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCustomProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ProtectedItemModelCustomProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ProtectedItemModelCustomProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ProtectedItemModelCustomProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelCustomProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelCustomProperties.cs new file mode 100644 index 000000000000..21a481919e10 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Protected item model custom properties. + public partial class ProtectedItemModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCustomProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCustomPropertiesInternal + { + + /// Backing field for property. + private string _instanceType; + + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Creates an new instance. + public ProtectedItemModelCustomProperties() + { + + } + } + /// Protected item model custom properties. + public partial interface IProtectedItemModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Protected item model custom properties. + internal partial interface IProtectedItemModelCustomPropertiesInternal + + { + /// Gets or sets the instance type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelCustomProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelCustomProperties.json.cs new file mode 100644 index 000000000000..3634643c9ae9 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Protected item model custom properties. + public partial class ProtectedItemModelCustomProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCustomProperties. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCustomProperties 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.Migrate.Models.Api20210216Preview.IProtectedItemModelCustomProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCustomProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "HyperVToAzStackHCI": + { + return new HyperVToAzStackHciprotectedItemModelCustomProperties(json); + } + case "VMwareToAzStackHCI": + { + return new VMwareToAzStackHciprotectedItemModelCustomProperties(json); + } + } + return new ProtectedItemModelCustomProperties(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal ProtectedItemModelCustomProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelProperties.PowerShell.cs new file mode 100644 index 000000000000..c8cfe5dd20d2 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelProperties.PowerShell.cs @@ -0,0 +1,370 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Protected item model properties. + [System.ComponentModel.TypeConverter(typeof(ProtectedItemModelPropertiesTypeConverter))] + public partial class ProtectedItemModelProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ProtectedItemModelProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ProtectedItemModelProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ProtectedItemModelProperties(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.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).PolicyName = (string) content.GetValueForProperty("PolicyName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).PolicyName, global::System.Convert.ToString); + } + if (content.Contains("ReplicationExtensionName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).ReplicationExtensionName = (string) content.GetValueForProperty("ReplicationExtensionName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).ReplicationExtensionName, global::System.Convert.ToString); + } + if (content.Contains("CorrelationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).CorrelationId = (string) content.GetValueForProperty("CorrelationId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).CorrelationId, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState.CreateFrom); + } + if (content.Contains("ProtectionState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).ProtectionState = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState?) content.GetValueForProperty("ProtectionState",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).ProtectionState, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState.CreateFrom); + } + if (content.Contains("ProtectionStateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).ProtectionStateDescription = (string) content.GetValueForProperty("ProtectionStateDescription",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).ProtectionStateDescription, global::System.Convert.ToString); + } + if (content.Contains("TestFailoverState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).TestFailoverState = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.TestFailoverState?) content.GetValueForProperty("TestFailoverState",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).TestFailoverState, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.TestFailoverState.CreateFrom); + } + if (content.Contains("TestFailoverStateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).TestFailoverStateDescription = (string) content.GetValueForProperty("TestFailoverStateDescription",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).TestFailoverStateDescription, global::System.Convert.ToString); + } + if (content.Contains("ResynchronizationState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).ResynchronizationState = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ResynchronizationState?) content.GetValueForProperty("ResynchronizationState",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).ResynchronizationState, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ResynchronizationState.CreateFrom); + } + if (content.Contains("FabricObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).FabricObjectId = (string) content.GetValueForProperty("FabricObjectId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).FabricObjectId, global::System.Convert.ToString); + } + if (content.Contains("FabricObjectName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).FabricObjectName = (string) content.GetValueForProperty("FabricObjectName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).FabricObjectName, global::System.Convert.ToString); + } + if (content.Contains("SourceFabricProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).SourceFabricProviderId = (string) content.GetValueForProperty("SourceFabricProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).SourceFabricProviderId, global::System.Convert.ToString); + } + if (content.Contains("TargetFabricProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).TargetFabricProviderId = (string) content.GetValueForProperty("TargetFabricProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).TargetFabricProviderId, global::System.Convert.ToString); + } + if (content.Contains("FabricId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).FabricId = (string) content.GetValueForProperty("FabricId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).FabricId, global::System.Convert.ToString); + } + if (content.Contains("TargetFabricId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).TargetFabricId = (string) content.GetValueForProperty("TargetFabricId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).TargetFabricId, global::System.Convert.ToString); + } + if (content.Contains("DraId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).DraId = (string) content.GetValueForProperty("DraId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).DraId, global::System.Convert.ToString); + } + if (content.Contains("TargetDraId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).TargetDraId = (string) content.GetValueForProperty("TargetDraId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).TargetDraId, global::System.Convert.ToString); + } + if (content.Contains("ResyncRequired")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).ResyncRequired = (bool?) content.GetValueForProperty("ResyncRequired",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).ResyncRequired, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LastSuccessfulPlannedFailoverTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).LastSuccessfulPlannedFailoverTime = (global::System.DateTime?) content.GetValueForProperty("LastSuccessfulPlannedFailoverTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).LastSuccessfulPlannedFailoverTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastSuccessfulUnplannedFailoverTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).LastSuccessfulUnplannedFailoverTime = (global::System.DateTime?) content.GetValueForProperty("LastSuccessfulUnplannedFailoverTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).LastSuccessfulUnplannedFailoverTime, (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.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).LastSuccessfulTestFailoverTime = (global::System.DateTime?) content.GetValueForProperty("LastSuccessfulTestFailoverTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)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("CurrentJob")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).CurrentJob = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties) content.GetValueForProperty("CurrentJob",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).CurrentJob, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemJobPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("AllowedJob")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).AllowedJob = (string[]) content.GetValueForProperty("AllowedJob",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).AllowedJob, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("LastFailedEnableProtectionJob")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).LastFailedEnableProtectionJob = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties) content.GetValueForProperty("LastFailedEnableProtectionJob",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).LastFailedEnableProtectionJob, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemJobPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("LastFailedPlannedFailoverJob")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).LastFailedPlannedFailoverJob = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties) content.GetValueForProperty("LastFailedPlannedFailoverJob",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).LastFailedPlannedFailoverJob, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemJobPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("LastTestFailoverJob")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).LastTestFailoverJob = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties) content.GetValueForProperty("LastTestFailoverJob",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).LastTestFailoverJob, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemJobPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ReplicationHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).ReplicationHealth = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.HealthStatus?) content.GetValueForProperty("ReplicationHealth",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).ReplicationHealth, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.HealthStatus.CreateFrom); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HealthErrorModelTypeConverter.ConvertFrom)); + } + if (content.Contains("CustomProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).CustomProperty = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCustomProperties) content.GetValueForProperty("CustomProperty",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).CustomProperty, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelCustomPropertiesTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ProtectedItemModelProperties(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.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).PolicyName = (string) content.GetValueForProperty("PolicyName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).PolicyName, global::System.Convert.ToString); + } + if (content.Contains("ReplicationExtensionName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).ReplicationExtensionName = (string) content.GetValueForProperty("ReplicationExtensionName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).ReplicationExtensionName, global::System.Convert.ToString); + } + if (content.Contains("CorrelationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).CorrelationId = (string) content.GetValueForProperty("CorrelationId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).CorrelationId, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState.CreateFrom); + } + if (content.Contains("ProtectionState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).ProtectionState = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState?) content.GetValueForProperty("ProtectionState",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).ProtectionState, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState.CreateFrom); + } + if (content.Contains("ProtectionStateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).ProtectionStateDescription = (string) content.GetValueForProperty("ProtectionStateDescription",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).ProtectionStateDescription, global::System.Convert.ToString); + } + if (content.Contains("TestFailoverState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).TestFailoverState = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.TestFailoverState?) content.GetValueForProperty("TestFailoverState",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).TestFailoverState, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.TestFailoverState.CreateFrom); + } + if (content.Contains("TestFailoverStateDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).TestFailoverStateDescription = (string) content.GetValueForProperty("TestFailoverStateDescription",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).TestFailoverStateDescription, global::System.Convert.ToString); + } + if (content.Contains("ResynchronizationState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).ResynchronizationState = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ResynchronizationState?) content.GetValueForProperty("ResynchronizationState",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).ResynchronizationState, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ResynchronizationState.CreateFrom); + } + if (content.Contains("FabricObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).FabricObjectId = (string) content.GetValueForProperty("FabricObjectId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).FabricObjectId, global::System.Convert.ToString); + } + if (content.Contains("FabricObjectName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).FabricObjectName = (string) content.GetValueForProperty("FabricObjectName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).FabricObjectName, global::System.Convert.ToString); + } + if (content.Contains("SourceFabricProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).SourceFabricProviderId = (string) content.GetValueForProperty("SourceFabricProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).SourceFabricProviderId, global::System.Convert.ToString); + } + if (content.Contains("TargetFabricProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).TargetFabricProviderId = (string) content.GetValueForProperty("TargetFabricProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).TargetFabricProviderId, global::System.Convert.ToString); + } + if (content.Contains("FabricId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).FabricId = (string) content.GetValueForProperty("FabricId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).FabricId, global::System.Convert.ToString); + } + if (content.Contains("TargetFabricId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).TargetFabricId = (string) content.GetValueForProperty("TargetFabricId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).TargetFabricId, global::System.Convert.ToString); + } + if (content.Contains("DraId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).DraId = (string) content.GetValueForProperty("DraId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).DraId, global::System.Convert.ToString); + } + if (content.Contains("TargetDraId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).TargetDraId = (string) content.GetValueForProperty("TargetDraId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).TargetDraId, global::System.Convert.ToString); + } + if (content.Contains("ResyncRequired")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).ResyncRequired = (bool?) content.GetValueForProperty("ResyncRequired",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).ResyncRequired, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("LastSuccessfulPlannedFailoverTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).LastSuccessfulPlannedFailoverTime = (global::System.DateTime?) content.GetValueForProperty("LastSuccessfulPlannedFailoverTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).LastSuccessfulPlannedFailoverTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastSuccessfulUnplannedFailoverTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).LastSuccessfulUnplannedFailoverTime = (global::System.DateTime?) content.GetValueForProperty("LastSuccessfulUnplannedFailoverTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).LastSuccessfulUnplannedFailoverTime, (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.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).LastSuccessfulTestFailoverTime = (global::System.DateTime?) content.GetValueForProperty("LastSuccessfulTestFailoverTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)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("CurrentJob")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).CurrentJob = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties) content.GetValueForProperty("CurrentJob",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).CurrentJob, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemJobPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("AllowedJob")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).AllowedJob = (string[]) content.GetValueForProperty("AllowedJob",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).AllowedJob, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("LastFailedEnableProtectionJob")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).LastFailedEnableProtectionJob = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties) content.GetValueForProperty("LastFailedEnableProtectionJob",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).LastFailedEnableProtectionJob, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemJobPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("LastFailedPlannedFailoverJob")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).LastFailedPlannedFailoverJob = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties) content.GetValueForProperty("LastFailedPlannedFailoverJob",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).LastFailedPlannedFailoverJob, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemJobPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("LastTestFailoverJob")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).LastTestFailoverJob = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties) content.GetValueForProperty("LastTestFailoverJob",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).LastTestFailoverJob, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemJobPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ReplicationHealth")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).ReplicationHealth = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.HealthStatus?) content.GetValueForProperty("ReplicationHealth",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).ReplicationHealth, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.HealthStatus.CreateFrom); + } + if (content.Contains("HealthError")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).HealthError = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel[]) content.GetValueForProperty("HealthError",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).HealthError, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HealthErrorModelTypeConverter.ConvertFrom)); + } + if (content.Contains("CustomProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).CustomProperty = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCustomProperties) content.GetValueForProperty("CustomProperty",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal)this).CustomProperty, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelCustomPropertiesTypeConverter.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Protected item model properties. + [System.ComponentModel.TypeConverter(typeof(ProtectedItemModelPropertiesTypeConverter))] + public partial interface IProtectedItemModelProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelProperties.TypeConverter.cs new file mode 100644 index 000000000000..9be2c0a414e9 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ProtectedItemModelPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ProtectedItemModelProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ProtectedItemModelProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ProtectedItemModelProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelProperties.cs new file mode 100644 index 000000000000..678a226db076 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelProperties.cs @@ -0,0 +1,605 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Protected item model properties. + public partial class ProtectedItemModelProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal + { + + /// Backing field for property. + private string[] _allowedJob; + + /// Gets or sets the allowed scenarios on the protected item. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string[] AllowedJob { get => this._allowedJob; } + + /// Backing field for property. + private string _correlationId; + + /// Gets or sets the protected item correlation Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string CorrelationId { get => this._correlationId; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties _currentJob; + + /// Protected item job properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties CurrentJob { get => (this._currentJob = this._currentJob ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemJobProperties()); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCustomProperties _customProperty; + + /// Protected item model custom properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCustomProperties CustomProperty { get => (this._customProperty = this._customProperty ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelCustomProperties()); set => this._customProperty = value; } + + /// Backing field for property. + private string _draId; + + /// Gets or sets the DRA Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string DraId { get => this._draId; } + + /// Backing field for property. + private string _fabricId; + + /// Gets or sets the fabric Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string FabricId { get => this._fabricId; } + + /// Backing field for property. + private string _fabricObjectId; + + /// Gets or sets the fabric object Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string FabricObjectId { get => this._fabricObjectId; } + + /// Backing field for property. + private string _fabricObjectName; + + /// Gets or sets the fabric object name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string FabricObjectName { get => this._fabricObjectName; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel[] _healthError; + + /// Gets or sets the list of health errors. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel[] HealthError { get => this._healthError; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties _lastFailedEnableProtectionJob; + + /// Protected item job properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties LastFailedEnableProtectionJob { get => (this._lastFailedEnableProtectionJob = this._lastFailedEnableProtectionJob ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemJobProperties()); } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties _lastFailedPlannedFailoverJob; + + /// Protected item job properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties LastFailedPlannedFailoverJob { get => (this._lastFailedPlannedFailoverJob = this._lastFailedPlannedFailoverJob ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemJobProperties()); } + + /// Backing field for property. + private global::System.DateTime? _lastSuccessfulPlannedFailoverTime; + + /// Gets or sets the Last successful planned failover time. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public global::System.DateTime? LastSuccessfulPlannedFailoverTime { get => this._lastSuccessfulPlannedFailoverTime; } + + /// Backing field for property. + private global::System.DateTime? _lastSuccessfulTestFailoverTime; + + /// Gets or sets the Last successful test failover time. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public global::System.DateTime? LastSuccessfulTestFailoverTime { get => this._lastSuccessfulTestFailoverTime; } + + /// Backing field for property. + private global::System.DateTime? _lastSuccessfulUnplannedFailoverTime; + + /// Gets or sets the Last successful unplanned failover time. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public global::System.DateTime? LastSuccessfulUnplannedFailoverTime { get => this._lastSuccessfulUnplannedFailoverTime; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties _lastTestFailoverJob; + + /// Protected item job properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties LastTestFailoverJob { get => (this._lastTestFailoverJob = this._lastTestFailoverJob ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemJobProperties()); } + + /// Internal Acessors for AllowedJob + string[] Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal.AllowedJob { get => this._allowedJob; set { {_allowedJob = value;} } } + + /// Internal Acessors for CorrelationId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal.CorrelationId { get => this._correlationId; set { {_correlationId = value;} } } + + /// Internal Acessors for CurrentJob + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal.CurrentJob { get => (this._currentJob = this._currentJob ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemJobProperties()); set { {_currentJob = value;} } } + + /// Internal Acessors for DraId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal.DraId { get => this._draId; set { {_draId = value;} } } + + /// Internal Acessors for FabricId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal.FabricId { get => this._fabricId; set { {_fabricId = value;} } } + + /// Internal Acessors for FabricObjectId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal.FabricObjectId { get => this._fabricObjectId; set { {_fabricObjectId = value;} } } + + /// Internal Acessors for FabricObjectName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal.FabricObjectName { get => this._fabricObjectName; set { {_fabricObjectName = value;} } } + + /// Internal Acessors for HealthError + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel[] Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal.HealthError { get => this._healthError; set { {_healthError = value;} } } + + /// Internal Acessors for LastFailedEnableProtectionJob + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal.LastFailedEnableProtectionJob { get => (this._lastFailedEnableProtectionJob = this._lastFailedEnableProtectionJob ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemJobProperties()); set { {_lastFailedEnableProtectionJob = value;} } } + + /// Internal Acessors for LastFailedPlannedFailoverJob + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal.LastFailedPlannedFailoverJob { get => (this._lastFailedPlannedFailoverJob = this._lastFailedPlannedFailoverJob ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemJobProperties()); set { {_lastFailedPlannedFailoverJob = value;} } } + + /// Internal Acessors for LastSuccessfulPlannedFailoverTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal.LastSuccessfulPlannedFailoverTime { get => this._lastSuccessfulPlannedFailoverTime; set { {_lastSuccessfulPlannedFailoverTime = value;} } } + + /// Internal Acessors for LastSuccessfulTestFailoverTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal.LastSuccessfulTestFailoverTime { get => this._lastSuccessfulTestFailoverTime; set { {_lastSuccessfulTestFailoverTime = value;} } } + + /// Internal Acessors for LastSuccessfulUnplannedFailoverTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal.LastSuccessfulUnplannedFailoverTime { get => this._lastSuccessfulUnplannedFailoverTime; set { {_lastSuccessfulUnplannedFailoverTime = value;} } } + + /// Internal Acessors for LastTestFailoverJob + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal.LastTestFailoverJob { get => (this._lastTestFailoverJob = this._lastTestFailoverJob ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemJobProperties()); set { {_lastTestFailoverJob = value;} } } + + /// Internal Acessors for ProtectionState + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal.ProtectionState { get => this._protectionState; set { {_protectionState = value;} } } + + /// Internal Acessors for ProtectionStateDescription + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal.ProtectionStateDescription { get => this._protectionStateDescription; set { {_protectionStateDescription = value;} } } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal.ProvisioningState { get => this._provisioningState; set { {_provisioningState = value;} } } + + /// Internal Acessors for ReplicationHealth + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.HealthStatus? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal.ReplicationHealth { get => this._replicationHealth; set { {_replicationHealth = value;} } } + + /// Internal Acessors for ResyncRequired + bool? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal.ResyncRequired { get => this._resyncRequired; set { {_resyncRequired = value;} } } + + /// Internal Acessors for ResynchronizationState + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ResynchronizationState? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal.ResynchronizationState { get => this._resynchronizationState; set { {_resynchronizationState = value;} } } + + /// Internal Acessors for SourceFabricProviderId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal.SourceFabricProviderId { get => this._sourceFabricProviderId; set { {_sourceFabricProviderId = value;} } } + + /// Internal Acessors for TargetDraId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal.TargetDraId { get => this._targetDraId; set { {_targetDraId = value;} } } + + /// Internal Acessors for TargetFabricId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal.TargetFabricId { get => this._targetFabricId; set { {_targetFabricId = value;} } } + + /// Internal Acessors for TargetFabricProviderId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal.TargetFabricProviderId { get => this._targetFabricProviderId; set { {_targetFabricProviderId = value;} } } + + /// Internal Acessors for TestFailoverState + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.TestFailoverState? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal.TestFailoverState { get => this._testFailoverState; set { {_testFailoverState = value;} } } + + /// Internal Acessors for TestFailoverStateDescription + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesInternal.TestFailoverStateDescription { get => this._testFailoverStateDescription; set { {_testFailoverStateDescription = value;} } } + + /// Backing field for property. + private string _policyName; + + /// Gets or sets the policy name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string PolicyName { get => this._policyName; set => this._policyName = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState? _protectionState; + + /// Gets or sets the protection state. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState? ProtectionState { get => this._protectionState; } + + /// Backing field for property. + private string _protectionStateDescription; + + /// Gets or sets the protection state description. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string ProtectionStateDescription { get => this._protectionStateDescription; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState? _provisioningState; + + /// Gets or sets the provisioning state of the Dra. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState? ProvisioningState { get => this._provisioningState; } + + /// Backing field for property. + private string _replicationExtensionName; + + /// Gets or sets the replication extension name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string ReplicationExtensionName { get => this._replicationExtensionName; set => this._replicationExtensionName = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.HealthStatus? _replicationHealth; + + /// Gets or sets protected item replication health. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.HealthStatus? ReplicationHealth { get => this._replicationHealth; } + + /// Backing field for property. + private bool? _resyncRequired; + + /// Gets or sets a value indicating whether resynchronization is required or not. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public bool? ResyncRequired { get => this._resyncRequired; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ResynchronizationState? _resynchronizationState; + + /// Gets or sets the resynchronization state. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ResynchronizationState? ResynchronizationState { get => this._resynchronizationState; } + + /// Backing field for property. + private string _sourceFabricProviderId; + + /// Gets or sets the source fabric provider Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string SourceFabricProviderId { get => this._sourceFabricProviderId; } + + /// Backing field for property. + private string _targetDraId; + + /// Gets or sets the target DRA Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TargetDraId { get => this._targetDraId; } + + /// Backing field for property. + private string _targetFabricId; + + /// Gets or sets the target fabric Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TargetFabricId { get => this._targetFabricId; } + + /// Backing field for property. + private string _targetFabricProviderId; + + /// Gets or sets the target fabric provider Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TargetFabricProviderId { get => this._targetFabricProviderId; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.TestFailoverState? _testFailoverState; + + /// Gets or sets the test failover state. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.TestFailoverState? TestFailoverState { get => this._testFailoverState; } + + /// Backing field for property. + private string _testFailoverStateDescription; + + /// Gets or sets the Test failover state description. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TestFailoverStateDescription { get => this._testFailoverStateDescription; } + + /// Creates an new instance. + public ProtectedItemModelProperties() + { + + } + } + /// Protected item model properties. + public partial interface IProtectedItemModelProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the allowed scenarios on the protected item. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the allowed scenarios on the protected item.", + SerializedName = @"allowedJobs", + PossibleTypes = new [] { typeof(string) })] + string[] AllowedJob { get; } + /// Gets or sets the protected item correlation Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the protected item correlation Id.", + SerializedName = @"correlationId", + PossibleTypes = new [] { typeof(string) })] + string CorrelationId { get; } + /// Protected item job properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Protected item job properties.", + SerializedName = @"currentJob", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties CurrentJob { get; } + /// Protected item model custom properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protected item model custom properties.", + SerializedName = @"customProperties", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCustomProperties) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCustomProperties CustomProperty { get; set; } + /// Gets or sets the DRA Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the DRA Id.", + SerializedName = @"draId", + PossibleTypes = new [] { typeof(string) })] + string DraId { get; } + /// Gets or sets the fabric Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the fabric Id.", + SerializedName = @"fabricId", + PossibleTypes = new [] { typeof(string) })] + string FabricId { get; } + /// Gets or sets the fabric object Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the fabric object Id.", + SerializedName = @"fabricObjectId", + PossibleTypes = new [] { typeof(string) })] + string FabricObjectId { get; } + /// Gets or sets the fabric object name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the fabric object name.", + SerializedName = @"fabricObjectName", + PossibleTypes = new [] { typeof(string) })] + string FabricObjectName { get; } + /// Gets or sets the list of health errors. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the list of health errors.", + SerializedName = @"healthErrors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel[] HealthError { get; } + /// Protected item job properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Protected item job properties.", + SerializedName = @"lastFailedEnableProtectionJob", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties LastFailedEnableProtectionJob { get; } + /// Protected item job properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Protected item job properties.", + SerializedName = @"lastFailedPlannedFailoverJob", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties LastFailedPlannedFailoverJob { get; } + /// Gets or sets the Last successful planned failover time. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the Last successful planned failover time.", + SerializedName = @"lastSuccessfulPlannedFailoverTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastSuccessfulPlannedFailoverTime { get; } + /// Gets or sets the Last successful test failover time. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the Last successful test failover time.", + SerializedName = @"lastSuccessfulTestFailoverTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastSuccessfulTestFailoverTime { get; } + /// Gets or sets the Last successful unplanned failover time. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the Last successful unplanned failover time.", + SerializedName = @"lastSuccessfulUnplannedFailoverTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastSuccessfulUnplannedFailoverTime { get; } + /// Protected item job properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Protected item job properties.", + SerializedName = @"lastTestFailoverJob", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties LastTestFailoverJob { get; } + /// Gets or sets the policy name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the policy name.", + SerializedName = @"policyName", + PossibleTypes = new [] { typeof(string) })] + string PolicyName { get; set; } + /// Gets or sets the protection state. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the protection state.", + SerializedName = @"protectionState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState? ProtectionState { get; } + /// Gets or sets the protection state description. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the protection state description.", + SerializedName = @"protectionStateDescription", + PossibleTypes = new [] { typeof(string) })] + string ProtectionStateDescription { get; } + /// Gets or sets the provisioning state of the Dra. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the provisioning state of the Dra.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState? ProvisioningState { get; } + /// Gets or sets the replication extension name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the replication extension name.", + SerializedName = @"replicationExtensionName", + PossibleTypes = new [] { typeof(string) })] + string ReplicationExtensionName { get; set; } + /// Gets or sets protected item replication health. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets protected item replication health.", + SerializedName = @"replicationHealth", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.HealthStatus) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.HealthStatus? ReplicationHealth { get; } + /// Gets or sets a value indicating whether resynchronization is required or not. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets a value indicating whether resynchronization is required or not.", + SerializedName = @"resyncRequired", + PossibleTypes = new [] { typeof(bool) })] + bool? ResyncRequired { get; } + /// Gets or sets the resynchronization state. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the resynchronization state.", + SerializedName = @"resynchronizationState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ResynchronizationState) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ResynchronizationState? ResynchronizationState { get; } + /// Gets or sets the source fabric provider Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the source fabric provider Id.", + SerializedName = @"sourceFabricProviderId", + PossibleTypes = new [] { typeof(string) })] + string SourceFabricProviderId { get; } + /// Gets or sets the target DRA Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the target DRA Id.", + SerializedName = @"targetDraId", + PossibleTypes = new [] { typeof(string) })] + string TargetDraId { get; } + /// Gets or sets the target fabric Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the target fabric Id.", + SerializedName = @"targetFabricId", + PossibleTypes = new [] { typeof(string) })] + string TargetFabricId { get; } + /// Gets or sets the target fabric provider Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the target fabric provider Id.", + SerializedName = @"targetFabricProviderId", + PossibleTypes = new [] { typeof(string) })] + string TargetFabricProviderId { get; } + /// Gets or sets the test failover state. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the test failover state.", + SerializedName = @"testFailoverState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.TestFailoverState) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.TestFailoverState? TestFailoverState { get; } + /// Gets or sets the Test failover state description. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the Test failover state description.", + SerializedName = @"testFailoverStateDescription", + PossibleTypes = new [] { typeof(string) })] + string TestFailoverStateDescription { get; } + + } + /// Protected item model properties. + internal partial interface IProtectedItemModelPropertiesInternal + + { + /// Gets or sets the allowed scenarios on the protected item. + string[] AllowedJob { get; set; } + /// Gets or sets the protected item correlation Id. + string CorrelationId { get; set; } + /// Protected item job properties. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties CurrentJob { get; set; } + /// Protected item model custom properties. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCustomProperties CustomProperty { get; set; } + /// Gets or sets the DRA Id. + string DraId { get; set; } + /// Gets or sets the fabric Id. + string FabricId { get; set; } + /// Gets or sets the fabric object Id. + string FabricObjectId { get; set; } + /// Gets or sets the fabric object name. + string FabricObjectName { get; set; } + /// Gets or sets the list of health errors. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IHealthErrorModel[] HealthError { get; set; } + /// Protected item job properties. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties LastFailedEnableProtectionJob { get; set; } + /// Protected item job properties. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties LastFailedPlannedFailoverJob { get; set; } + /// Gets or sets the Last successful planned failover time. + global::System.DateTime? LastSuccessfulPlannedFailoverTime { get; set; } + /// Gets or sets the Last successful test failover time. + global::System.DateTime? LastSuccessfulTestFailoverTime { get; set; } + /// Gets or sets the Last successful unplanned failover time. + global::System.DateTime? LastSuccessfulUnplannedFailoverTime { get; set; } + /// Protected item job properties. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties LastTestFailoverJob { get; set; } + /// Gets or sets the policy name. + string PolicyName { get; set; } + /// Gets or sets the protection state. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState? ProtectionState { get; set; } + /// Gets or sets the protection state description. + string ProtectionStateDescription { get; set; } + /// Gets or sets the provisioning state of the Dra. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState? ProvisioningState { get; set; } + /// Gets or sets the replication extension name. + string ReplicationExtensionName { get; set; } + /// Gets or sets protected item replication health. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.HealthStatus? ReplicationHealth { get; set; } + /// Gets or sets a value indicating whether resynchronization is required or not. + bool? ResyncRequired { get; set; } + /// Gets or sets the resynchronization state. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ResynchronizationState? ResynchronizationState { get; set; } + /// Gets or sets the source fabric provider Id. + string SourceFabricProviderId { get; set; } + /// Gets or sets the target DRA Id. + string TargetDraId { get; set; } + /// Gets or sets the target fabric Id. + string TargetFabricId { get; set; } + /// Gets or sets the target fabric provider Id. + string TargetFabricProviderId { get; set; } + /// Gets or sets the test failover state. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.TestFailoverState? TestFailoverState { get; set; } + /// Gets or sets the Test failover state description. + string TestFailoverStateDescription { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelProperties.json.cs new file mode 100644 index 000000000000..a9e9d2950b50 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Protected item model properties. + public partial class ProtectedItemModelProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new ProtectedItemModelProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal ProtectedItemModelProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_policyName = If( json?.PropertyT("policyName"), out var __jsonPolicyName) ? (string)__jsonPolicyName : (string)PolicyName;} + {_replicationExtensionName = If( json?.PropertyT("replicationExtensionName"), out var __jsonReplicationExtensionName) ? (string)__jsonReplicationExtensionName : (string)ReplicationExtensionName;} + {_correlationId = If( json?.PropertyT("correlationId"), out var __jsonCorrelationId) ? (string)__jsonCorrelationId : (string)CorrelationId;} + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)ProvisioningState;} + {_protectionState = If( json?.PropertyT("protectionState"), out var __jsonProtectionState) ? (string)__jsonProtectionState : (string)ProtectionState;} + {_protectionStateDescription = If( json?.PropertyT("protectionStateDescription"), out var __jsonProtectionStateDescription) ? (string)__jsonProtectionStateDescription : (string)ProtectionStateDescription;} + {_testFailoverState = If( json?.PropertyT("testFailoverState"), out var __jsonTestFailoverState) ? (string)__jsonTestFailoverState : (string)TestFailoverState;} + {_testFailoverStateDescription = If( json?.PropertyT("testFailoverStateDescription"), out var __jsonTestFailoverStateDescription) ? (string)__jsonTestFailoverStateDescription : (string)TestFailoverStateDescription;} + {_resynchronizationState = If( json?.PropertyT("resynchronizationState"), out var __jsonResynchronizationState) ? (string)__jsonResynchronizationState : (string)ResynchronizationState;} + {_fabricObjectId = If( json?.PropertyT("fabricObjectId"), out var __jsonFabricObjectId) ? (string)__jsonFabricObjectId : (string)FabricObjectId;} + {_fabricObjectName = If( json?.PropertyT("fabricObjectName"), out var __jsonFabricObjectName) ? (string)__jsonFabricObjectName : (string)FabricObjectName;} + {_sourceFabricProviderId = If( json?.PropertyT("sourceFabricProviderId"), out var __jsonSourceFabricProviderId) ? (string)__jsonSourceFabricProviderId : (string)SourceFabricProviderId;} + {_targetFabricProviderId = If( json?.PropertyT("targetFabricProviderId"), out var __jsonTargetFabricProviderId) ? (string)__jsonTargetFabricProviderId : (string)TargetFabricProviderId;} + {_fabricId = If( json?.PropertyT("fabricId"), out var __jsonFabricId) ? (string)__jsonFabricId : (string)FabricId;} + {_targetFabricId = If( json?.PropertyT("targetFabricId"), out var __jsonTargetFabricId) ? (string)__jsonTargetFabricId : (string)TargetFabricId;} + {_draId = If( json?.PropertyT("draId"), out var __jsonDraId) ? (string)__jsonDraId : (string)DraId;} + {_targetDraId = If( json?.PropertyT("targetDraId"), out var __jsonTargetDraId) ? (string)__jsonTargetDraId : (string)TargetDraId;} + {_resyncRequired = If( json?.PropertyT("resyncRequired"), out var __jsonResyncRequired) ? (bool?)__jsonResyncRequired : ResyncRequired;} + {_lastSuccessfulPlannedFailoverTime = If( json?.PropertyT("lastSuccessfulPlannedFailoverTime"), out var __jsonLastSuccessfulPlannedFailoverTime) ? global::System.DateTime.TryParse((string)__jsonLastSuccessfulPlannedFailoverTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastSuccessfulPlannedFailoverTimeValue) ? __jsonLastSuccessfulPlannedFailoverTimeValue : LastSuccessfulPlannedFailoverTime : LastSuccessfulPlannedFailoverTime;} + {_lastSuccessfulUnplannedFailoverTime = If( json?.PropertyT("lastSuccessfulUnplannedFailoverTime"), out var __jsonLastSuccessfulUnplannedFailoverTime) ? global::System.DateTime.TryParse((string)__jsonLastSuccessfulUnplannedFailoverTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastSuccessfulUnplannedFailoverTimeValue) ? __jsonLastSuccessfulUnplannedFailoverTimeValue : LastSuccessfulUnplannedFailoverTime : LastSuccessfulUnplannedFailoverTime;} + {_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;} + {_currentJob = If( json?.PropertyT("currentJob"), out var __jsonCurrentJob) ? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemJobProperties.FromJson(__jsonCurrentJob) : CurrentJob;} + {_allowedJob = If( json?.PropertyT("allowedJobs"), out var __jsonAllowedJobs) ? If( __jsonAllowedJobs as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : AllowedJob;} + {_lastFailedEnableProtectionJob = If( json?.PropertyT("lastFailedEnableProtectionJob"), out var __jsonLastFailedEnableProtectionJob) ? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemJobProperties.FromJson(__jsonLastFailedEnableProtectionJob) : LastFailedEnableProtectionJob;} + {_lastFailedPlannedFailoverJob = If( json?.PropertyT("lastFailedPlannedFailoverJob"), out var __jsonLastFailedPlannedFailoverJob) ? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemJobProperties.FromJson(__jsonLastFailedPlannedFailoverJob) : LastFailedPlannedFailoverJob;} + {_lastTestFailoverJob = If( json?.PropertyT("lastTestFailoverJob"), out var __jsonLastTestFailoverJob) ? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemJobProperties.FromJson(__jsonLastTestFailoverJob) : LastTestFailoverJob;} + {_replicationHealth = If( json?.PropertyT("replicationHealth"), out var __jsonReplicationHealth) ? (string)__jsonReplicationHealth : (string)ReplicationHealth;} + {_healthError = If( json?.PropertyT("healthErrors"), out var __jsonHealthErrors) ? If( __jsonHealthErrors as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api20210216Preview.IHealthErrorModel) (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.HealthErrorModel.FromJson(__p) )) ))() : null : HealthError;} + {_customProperty = If( json?.PropertyT("customProperties"), out var __jsonCustomProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelCustomProperties.FromJson(__jsonCustomProperties) : CustomProperty;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._policyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._policyName.ToString()) : null, "policyName" ,container.Add ); + AddIf( null != (((object)this._replicationExtensionName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._replicationExtensionName.ToString()) : null, "replicationExtensionName" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._correlationId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._correlationId.ToString()) : null, "correlationId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._protectionState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._protectionState.ToString()) : null, "protectionState" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._protectionStateDescription)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._protectionStateDescription.ToString()) : null, "protectionStateDescription" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._testFailoverState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._testFailoverState.ToString()) : null, "testFailoverState" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._testFailoverStateDescription)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._testFailoverStateDescription.ToString()) : null, "testFailoverStateDescription" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._resynchronizationState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._resynchronizationState.ToString()) : null, "resynchronizationState" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._fabricObjectId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._fabricObjectId.ToString()) : null, "fabricObjectId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._fabricObjectName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._fabricObjectName.ToString()) : null, "fabricObjectName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._sourceFabricProviderId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._sourceFabricProviderId.ToString()) : null, "sourceFabricProviderId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._targetFabricProviderId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._targetFabricProviderId.ToString()) : null, "targetFabricProviderId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._fabricId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._fabricId.ToString()) : null, "fabricId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._targetFabricId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._targetFabricId.ToString()) : null, "targetFabricId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._draId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._draId.ToString()) : null, "draId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._targetDraId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._targetDraId.ToString()) : null, "targetDraId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._resyncRequired ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonBoolean((bool)this._resyncRequired) : null, "resyncRequired" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._lastSuccessfulPlannedFailoverTime ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._lastSuccessfulPlannedFailoverTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastSuccessfulPlannedFailoverTime" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._lastSuccessfulUnplannedFailoverTime ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._lastSuccessfulUnplannedFailoverTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastSuccessfulUnplannedFailoverTime" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._lastSuccessfulTestFailoverTime ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._lastSuccessfulTestFailoverTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastSuccessfulTestFailoverTime" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._currentJob ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._currentJob.ToJson(null,serializationMode) : null, "currentJob" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._allowedJob) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.XNodeArray(); + foreach( var __x in this._allowedJob ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("allowedJobs",__w); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._lastFailedEnableProtectionJob ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._lastFailedEnableProtectionJob.ToJson(null,serializationMode) : null, "lastFailedEnableProtectionJob" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._lastFailedPlannedFailoverJob ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._lastFailedPlannedFailoverJob.ToJson(null,serializationMode) : null, "lastFailedPlannedFailoverJob" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._lastTestFailoverJob ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._lastTestFailoverJob.ToJson(null,serializationMode) : null, "lastTestFailoverJob" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._replicationHealth)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._replicationHealth.ToString()) : null, "replicationHealth" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._healthError) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.XNodeArray(); + foreach( var __s in this._healthError ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("healthErrors",__r); + } + } + AddIf( null != this._customProperty ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._customProperty.ToJson(null,serializationMode) : null, "customProperties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesCurrentJob.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesCurrentJob.PowerShell.cs new file mode 100644 index 000000000000..0bd91c789dc6 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesCurrentJob.PowerShell.cs @@ -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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(ProtectedItemModelPropertiesCurrentJobTypeConverter))] + public partial class ProtectedItemModelPropertiesCurrentJob + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesCurrentJob DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ProtectedItemModelPropertiesCurrentJob(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesCurrentJob DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ProtectedItemModelPropertiesCurrentJob(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesCurrentJob FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ProtectedItemModelPropertiesCurrentJob(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.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).ScenarioName = (string) content.GetValueForProperty("ScenarioName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).ScenarioName, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("DisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).DisplayName, global::System.Convert.ToString); + } + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).State, global::System.Convert.ToString); + } + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).StartTime = (global::System.DateTime?) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)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.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).EndTime = (global::System.DateTime?) content.GetValueForProperty("EndTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)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 ProtectedItemModelPropertiesCurrentJob(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.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).ScenarioName = (string) content.GetValueForProperty("ScenarioName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).ScenarioName, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("DisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).DisplayName, global::System.Convert.ToString); + } + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).State, global::System.Convert.ToString); + } + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).StartTime = (global::System.DateTime?) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)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.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).EndTime = (global::System.DateTime?) content.GetValueForProperty("EndTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).EndTime, (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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + [System.ComponentModel.TypeConverter(typeof(ProtectedItemModelPropertiesCurrentJobTypeConverter))] + public partial interface IProtectedItemModelPropertiesCurrentJob + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesCurrentJob.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesCurrentJob.TypeConverter.cs new file mode 100644 index 000000000000..3e6e640d5e94 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesCurrentJob.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ProtectedItemModelPropertiesCurrentJobTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesCurrentJob ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesCurrentJob).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ProtectedItemModelPropertiesCurrentJob.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ProtectedItemModelPropertiesCurrentJob.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ProtectedItemModelPropertiesCurrentJob.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesCurrentJob.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesCurrentJob.cs new file mode 100644 index 000000000000..8ffea53deac6 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesCurrentJob.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + public partial class ProtectedItemModelPropertiesCurrentJob : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesCurrentJob, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesCurrentJobInternal, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties __protectedItemJobProperties = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemJobProperties(); + + /// Gets or sets the workflow friendly display name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string DisplayName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).DisplayName; } + + /// Gets or sets end time of the workflow. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public global::System.DateTime? EndTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).EndTime; } + + /// Gets or sets workflow Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).Id; } + + /// Internal Acessors for DisplayName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal.DisplayName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).DisplayName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).DisplayName = value; } + + /// Internal Acessors for EndTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal.EndTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).EndTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).EndTime = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).Name = value; } + + /// Internal Acessors for ScenarioName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal.ScenarioName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).ScenarioName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).ScenarioName = value; } + + /// Internal Acessors for StartTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal.StartTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).StartTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).StartTime = value; } + + /// Internal Acessors for State + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal.State { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).State; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).State = value; } + + /// Gets or sets workflow name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).Name; } + + /// Gets or sets protection scenario name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string ScenarioName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).ScenarioName; } + + /// Gets or sets start time of the workflow. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public global::System.DateTime? StartTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).StartTime; } + + /// Gets or sets workflow state. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string State { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).State; } + + /// Creates an new instance. + public ProtectedItemModelPropertiesCurrentJob() + { + + } + + /// 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.Migrate.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__protectedItemJobProperties), __protectedItemJobProperties); + await eventListener.AssertObjectIsValid(nameof(__protectedItemJobProperties), __protectedItemJobProperties); + } + } + public partial interface IProtectedItemModelPropertiesCurrentJob : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties + { + + } + internal partial interface IProtectedItemModelPropertiesCurrentJobInternal : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesCurrentJob.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesCurrentJob.json.cs new file mode 100644 index 000000000000..9374153b48e0 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesCurrentJob.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + public partial class ProtectedItemModelPropertiesCurrentJob + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesCurrentJob. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesCurrentJob. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesCurrentJob FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new ProtectedItemModelPropertiesCurrentJob(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal ProtectedItemModelPropertiesCurrentJob(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __protectedItemJobProperties = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemJobProperties(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __protectedItemJobProperties?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesLastFailedEnableProtectionJob.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesLastFailedEnableProtectionJob.PowerShell.cs new file mode 100644 index 000000000000..6c6285effec6 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesLastFailedEnableProtectionJob.PowerShell.cs @@ -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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(ProtectedItemModelPropertiesLastFailedEnableProtectionJobTypeConverter))] + public partial class ProtectedItemModelPropertiesLastFailedEnableProtectionJob + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesLastFailedEnableProtectionJob DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ProtectedItemModelPropertiesLastFailedEnableProtectionJob(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesLastFailedEnableProtectionJob DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ProtectedItemModelPropertiesLastFailedEnableProtectionJob(content); + } + + /// + /// Creates a new instance of , deserializing the + /// content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesLastFailedEnableProtectionJob FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ProtectedItemModelPropertiesLastFailedEnableProtectionJob(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.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).ScenarioName = (string) content.GetValueForProperty("ScenarioName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).ScenarioName, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("DisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).DisplayName, global::System.Convert.ToString); + } + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).State, global::System.Convert.ToString); + } + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).StartTime = (global::System.DateTime?) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)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.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).EndTime = (global::System.DateTime?) content.GetValueForProperty("EndTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)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 ProtectedItemModelPropertiesLastFailedEnableProtectionJob(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.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).ScenarioName = (string) content.GetValueForProperty("ScenarioName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).ScenarioName, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("DisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).DisplayName, global::System.Convert.ToString); + } + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).State, global::System.Convert.ToString); + } + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).StartTime = (global::System.DateTime?) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)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.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).EndTime = (global::System.DateTime?) content.GetValueForProperty("EndTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).EndTime, (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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + [System.ComponentModel.TypeConverter(typeof(ProtectedItemModelPropertiesLastFailedEnableProtectionJobTypeConverter))] + public partial interface IProtectedItemModelPropertiesLastFailedEnableProtectionJob + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesLastFailedEnableProtectionJob.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesLastFailedEnableProtectionJob.TypeConverter.cs new file mode 100644 index 000000000000..9f3dc3fa1670 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesLastFailedEnableProtectionJob.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ProtectedItemModelPropertiesLastFailedEnableProtectionJobTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no + /// suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no + /// suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesLastFailedEnableProtectionJob ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesLastFailedEnableProtectionJob).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ProtectedItemModelPropertiesLastFailedEnableProtectionJob.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ProtectedItemModelPropertiesLastFailedEnableProtectionJob.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ProtectedItemModelPropertiesLastFailedEnableProtectionJob.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesLastFailedEnableProtectionJob.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesLastFailedEnableProtectionJob.cs new file mode 100644 index 000000000000..012576f6ae8e --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesLastFailedEnableProtectionJob.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + public partial class ProtectedItemModelPropertiesLastFailedEnableProtectionJob : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesLastFailedEnableProtectionJob, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesLastFailedEnableProtectionJobInternal, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties __protectedItemJobProperties = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemJobProperties(); + + /// Gets or sets the workflow friendly display name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string DisplayName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).DisplayName; } + + /// Gets or sets end time of the workflow. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public global::System.DateTime? EndTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).EndTime; } + + /// Gets or sets workflow Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).Id; } + + /// Internal Acessors for DisplayName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal.DisplayName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).DisplayName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).DisplayName = value; } + + /// Internal Acessors for EndTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal.EndTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).EndTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).EndTime = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).Name = value; } + + /// Internal Acessors for ScenarioName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal.ScenarioName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).ScenarioName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).ScenarioName = value; } + + /// Internal Acessors for StartTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal.StartTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).StartTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).StartTime = value; } + + /// Internal Acessors for State + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal.State { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).State; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).State = value; } + + /// Gets or sets workflow name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).Name; } + + /// Gets or sets protection scenario name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string ScenarioName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).ScenarioName; } + + /// Gets or sets start time of the workflow. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public global::System.DateTime? StartTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).StartTime; } + + /// Gets or sets workflow state. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string State { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).State; } + + /// + /// Creates an new instance. + /// + public ProtectedItemModelPropertiesLastFailedEnableProtectionJob() + { + + } + + /// 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.Migrate.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__protectedItemJobProperties), __protectedItemJobProperties); + await eventListener.AssertObjectIsValid(nameof(__protectedItemJobProperties), __protectedItemJobProperties); + } + } + public partial interface IProtectedItemModelPropertiesLastFailedEnableProtectionJob : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties + { + + } + internal partial interface IProtectedItemModelPropertiesLastFailedEnableProtectionJobInternal : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesLastFailedEnableProtectionJob.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesLastFailedEnableProtectionJob.json.cs new file mode 100644 index 000000000000..cfc595fd1690 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesLastFailedEnableProtectionJob.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + public partial class ProtectedItemModelPropertiesLastFailedEnableProtectionJob + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesLastFailedEnableProtectionJob. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesLastFailedEnableProtectionJob. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesLastFailedEnableProtectionJob FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new ProtectedItemModelPropertiesLastFailedEnableProtectionJob(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal ProtectedItemModelPropertiesLastFailedEnableProtectionJob(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __protectedItemJobProperties = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemJobProperties(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __protectedItemJobProperties?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesLastFailedPlannedFailoverJob.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesLastFailedPlannedFailoverJob.PowerShell.cs new file mode 100644 index 000000000000..2613e9659688 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesLastFailedPlannedFailoverJob.PowerShell.cs @@ -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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(ProtectedItemModelPropertiesLastFailedPlannedFailoverJobTypeConverter))] + public partial class ProtectedItemModelPropertiesLastFailedPlannedFailoverJob + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesLastFailedPlannedFailoverJob DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ProtectedItemModelPropertiesLastFailedPlannedFailoverJob(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesLastFailedPlannedFailoverJob DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ProtectedItemModelPropertiesLastFailedPlannedFailoverJob(content); + } + + /// + /// Creates a new instance of , deserializing the content + /// from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesLastFailedPlannedFailoverJob FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ProtectedItemModelPropertiesLastFailedPlannedFailoverJob(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.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).ScenarioName = (string) content.GetValueForProperty("ScenarioName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).ScenarioName, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("DisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).DisplayName, global::System.Convert.ToString); + } + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).State, global::System.Convert.ToString); + } + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).StartTime = (global::System.DateTime?) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)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.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).EndTime = (global::System.DateTime?) content.GetValueForProperty("EndTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)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 ProtectedItemModelPropertiesLastFailedPlannedFailoverJob(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.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).ScenarioName = (string) content.GetValueForProperty("ScenarioName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).ScenarioName, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("DisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).DisplayName, global::System.Convert.ToString); + } + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).State, global::System.Convert.ToString); + } + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).StartTime = (global::System.DateTime?) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)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.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).EndTime = (global::System.DateTime?) content.GetValueForProperty("EndTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).EndTime, (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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + [System.ComponentModel.TypeConverter(typeof(ProtectedItemModelPropertiesLastFailedPlannedFailoverJobTypeConverter))] + public partial interface IProtectedItemModelPropertiesLastFailedPlannedFailoverJob + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesLastFailedPlannedFailoverJob.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesLastFailedPlannedFailoverJob.TypeConverter.cs new file mode 100644 index 000000000000..40fb3f807ae2 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesLastFailedPlannedFailoverJob.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ProtectedItemModelPropertiesLastFailedPlannedFailoverJobTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no + /// suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no + /// suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesLastFailedPlannedFailoverJob ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesLastFailedPlannedFailoverJob).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ProtectedItemModelPropertiesLastFailedPlannedFailoverJob.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ProtectedItemModelPropertiesLastFailedPlannedFailoverJob.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ProtectedItemModelPropertiesLastFailedPlannedFailoverJob.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesLastFailedPlannedFailoverJob.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesLastFailedPlannedFailoverJob.cs new file mode 100644 index 000000000000..4dc3af33fccd --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesLastFailedPlannedFailoverJob.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + public partial class ProtectedItemModelPropertiesLastFailedPlannedFailoverJob : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesLastFailedPlannedFailoverJob, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesLastFailedPlannedFailoverJobInternal, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties __protectedItemJobProperties = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemJobProperties(); + + /// Gets or sets the workflow friendly display name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string DisplayName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).DisplayName; } + + /// Gets or sets end time of the workflow. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public global::System.DateTime? EndTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).EndTime; } + + /// Gets or sets workflow Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).Id; } + + /// Internal Acessors for DisplayName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal.DisplayName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).DisplayName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).DisplayName = value; } + + /// Internal Acessors for EndTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal.EndTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).EndTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).EndTime = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).Name = value; } + + /// Internal Acessors for ScenarioName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal.ScenarioName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).ScenarioName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).ScenarioName = value; } + + /// Internal Acessors for StartTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal.StartTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).StartTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).StartTime = value; } + + /// Internal Acessors for State + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal.State { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).State; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).State = value; } + + /// Gets or sets workflow name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).Name; } + + /// Gets or sets protection scenario name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string ScenarioName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).ScenarioName; } + + /// Gets or sets start time of the workflow. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public global::System.DateTime? StartTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).StartTime; } + + /// Gets or sets workflow state. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string State { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).State; } + + /// + /// Creates an new instance. + /// + public ProtectedItemModelPropertiesLastFailedPlannedFailoverJob() + { + + } + + /// 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.Migrate.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__protectedItemJobProperties), __protectedItemJobProperties); + await eventListener.AssertObjectIsValid(nameof(__protectedItemJobProperties), __protectedItemJobProperties); + } + } + public partial interface IProtectedItemModelPropertiesLastFailedPlannedFailoverJob : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties + { + + } + internal partial interface IProtectedItemModelPropertiesLastFailedPlannedFailoverJobInternal : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesLastFailedPlannedFailoverJob.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesLastFailedPlannedFailoverJob.json.cs new file mode 100644 index 000000000000..e49d48afea53 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesLastFailedPlannedFailoverJob.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + public partial class ProtectedItemModelPropertiesLastFailedPlannedFailoverJob + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesLastFailedPlannedFailoverJob. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesLastFailedPlannedFailoverJob. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesLastFailedPlannedFailoverJob FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new ProtectedItemModelPropertiesLastFailedPlannedFailoverJob(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal ProtectedItemModelPropertiesLastFailedPlannedFailoverJob(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __protectedItemJobProperties = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemJobProperties(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __protectedItemJobProperties?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesLastTestFailoverJob.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesLastTestFailoverJob.PowerShell.cs new file mode 100644 index 000000000000..0a06d589ab40 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesLastTestFailoverJob.PowerShell.cs @@ -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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(ProtectedItemModelPropertiesLastTestFailoverJobTypeConverter))] + public partial class ProtectedItemModelPropertiesLastTestFailoverJob + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesLastTestFailoverJob DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ProtectedItemModelPropertiesLastTestFailoverJob(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesLastTestFailoverJob DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ProtectedItemModelPropertiesLastTestFailoverJob(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesLastTestFailoverJob FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ProtectedItemModelPropertiesLastTestFailoverJob(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.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).ScenarioName = (string) content.GetValueForProperty("ScenarioName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).ScenarioName, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("DisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).DisplayName, global::System.Convert.ToString); + } + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).State, global::System.Convert.ToString); + } + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).StartTime = (global::System.DateTime?) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)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.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).EndTime = (global::System.DateTime?) content.GetValueForProperty("EndTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)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 ProtectedItemModelPropertiesLastTestFailoverJob(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.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).ScenarioName = (string) content.GetValueForProperty("ScenarioName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).ScenarioName, global::System.Convert.ToString); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("DisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).DisplayName, global::System.Convert.ToString); + } + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).State, global::System.Convert.ToString); + } + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).StartTime = (global::System.DateTime?) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)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.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).EndTime = (global::System.DateTime?) content.GetValueForProperty("EndTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)this).EndTime, (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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + [System.ComponentModel.TypeConverter(typeof(ProtectedItemModelPropertiesLastTestFailoverJobTypeConverter))] + public partial interface IProtectedItemModelPropertiesLastTestFailoverJob + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesLastTestFailoverJob.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesLastTestFailoverJob.TypeConverter.cs new file mode 100644 index 000000000000..f5161a4890d8 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesLastTestFailoverJob.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ProtectedItemModelPropertiesLastTestFailoverJobTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesLastTestFailoverJob ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesLastTestFailoverJob).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ProtectedItemModelPropertiesLastTestFailoverJob.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ProtectedItemModelPropertiesLastTestFailoverJob.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ProtectedItemModelPropertiesLastTestFailoverJob.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesLastTestFailoverJob.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesLastTestFailoverJob.cs new file mode 100644 index 000000000000..777be839b73c --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesLastTestFailoverJob.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + public partial class ProtectedItemModelPropertiesLastTestFailoverJob : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesLastTestFailoverJob, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesLastTestFailoverJobInternal, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties __protectedItemJobProperties = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemJobProperties(); + + /// Gets or sets the workflow friendly display name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string DisplayName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).DisplayName; } + + /// Gets or sets end time of the workflow. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public global::System.DateTime? EndTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).EndTime; } + + /// Gets or sets workflow Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).Id; } + + /// Internal Acessors for DisplayName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal.DisplayName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).DisplayName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).DisplayName = value; } + + /// Internal Acessors for EndTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal.EndTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).EndTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).EndTime = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).Name = value; } + + /// Internal Acessors for ScenarioName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal.ScenarioName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).ScenarioName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).ScenarioName = value; } + + /// Internal Acessors for StartTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal.StartTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).StartTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).StartTime = value; } + + /// Internal Acessors for State + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal.State { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).State; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).State = value; } + + /// Gets or sets workflow name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).Name; } + + /// Gets or sets protection scenario name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string ScenarioName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).ScenarioName; } + + /// Gets or sets start time of the workflow. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public global::System.DateTime? StartTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).StartTime; } + + /// Gets or sets workflow state. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string State { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal)__protectedItemJobProperties).State; } + + /// + /// Creates an new instance. + /// + public ProtectedItemModelPropertiesLastTestFailoverJob() + { + + } + + /// 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.Migrate.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__protectedItemJobProperties), __protectedItemJobProperties); + await eventListener.AssertObjectIsValid(nameof(__protectedItemJobProperties), __protectedItemJobProperties); + } + } + public partial interface IProtectedItemModelPropertiesLastTestFailoverJob : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobProperties + { + + } + internal partial interface IProtectedItemModelPropertiesLastTestFailoverJobInternal : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemJobPropertiesInternal + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesLastTestFailoverJob.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesLastTestFailoverJob.json.cs new file mode 100644 index 000000000000..307abe9959d8 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelPropertiesLastTestFailoverJob.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + public partial class ProtectedItemModelPropertiesLastTestFailoverJob + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesLastTestFailoverJob. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesLastTestFailoverJob. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelPropertiesLastTestFailoverJob FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new ProtectedItemModelPropertiesLastTestFailoverJob(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal ProtectedItemModelPropertiesLastTestFailoverJob(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __protectedItemJobProperties = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemJobProperties(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __protectedItemJobProperties?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelSystemData.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelSystemData.PowerShell.cs new file mode 100644 index 000000000000..bcdb68d83569 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelSystemData.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(ProtectedItemModelSystemDataTypeConverter))] + public partial class ProtectedItemModelSystemData + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelSystemData DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ProtectedItemModelSystemData(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelSystemData DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ProtectedItemModelSystemData(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelSystemData FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ProtectedItemModelSystemData(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy, global::System.Convert.ToString); + } + if (content.Contains("CreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType = (string) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType, global::System.Convert.ToString); + } + if (content.Contains("CreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType = (string) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt, (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 ProtectedItemModelSystemData(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy, global::System.Convert.ToString); + } + if (content.Contains("CreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType = (string) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType, global::System.Convert.ToString); + } + if (content.Contains("CreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType = (string) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt, (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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + [System.ComponentModel.TypeConverter(typeof(ProtectedItemModelSystemDataTypeConverter))] + public partial interface IProtectedItemModelSystemData + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelSystemData.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelSystemData.TypeConverter.cs new file mode 100644 index 000000000000..ea714e4fbdfa --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelSystemData.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ProtectedItemModelSystemDataTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelSystemData ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelSystemData).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ProtectedItemModelSystemData.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ProtectedItemModelSystemData.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ProtectedItemModelSystemData.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelSystemData.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelSystemData.cs new file mode 100644 index 000000000000..fcdd726457a4 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelSystemData.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + public partial class ProtectedItemModelSystemData : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelSystemData, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelSystemDataInternal, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel __systemDataModel = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel(); + + /// Gets or sets the timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public global::System.DateTime? CreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string CreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string CreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedByType = value ?? null; } + + /// Gets or sets the timestamp of resource last modification (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public global::System.DateTime? LastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets the identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string LastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string LastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedByType = value ?? null; } + + /// Creates an new instance. + public ProtectedItemModelSystemData() + { + + } + + /// 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.Migrate.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__systemDataModel), __systemDataModel); + await eventListener.AssertObjectIsValid(nameof(__systemDataModel), __systemDataModel); + } + } + public partial interface IProtectedItemModelSystemData : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel + { + + } + internal partial interface IProtectedItemModelSystemDataInternal : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelSystemData.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelSystemData.json.cs new file mode 100644 index 000000000000..b571a75f1270 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ProtectedItemModelSystemData.json.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + public partial class ProtectedItemModelSystemData + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelSystemData. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelSystemData. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelSystemData FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new ProtectedItemModelSystemData(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal ProtectedItemModelSystemData(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __systemDataModel = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __systemDataModel?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModel.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModel.PowerShell.cs new file mode 100644 index 000000000000..56688cb3324f --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModel.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Recovery point model. + [System.ComponentModel.TypeConverter(typeof(RecoveryPointModelTypeConverter))] + public partial class RecoveryPointModel + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModel DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryPointModel(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModel DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryPointModel(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModel FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryPointModel(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.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.RecoveryPointModelPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModelTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("CustomProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).CustomProperty = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCustomProperties) content.GetValueForProperty("CustomProperty",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).CustomProperty, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.RecoveryPointModelCustomPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryPointTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).RecoveryPointTime = (global::System.DateTime) content.GetValueForProperty("RecoveryPointTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)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.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).RecoveryPointType = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.RecoveryPointType) content.GetValueForProperty("RecoveryPointType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).RecoveryPointType, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.RecoveryPointType.CreateFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("CustomPropertyInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).CustomPropertyInstanceType = (string) content.GetValueForProperty("CustomPropertyInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).CustomPropertyInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RecoveryPointModel(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.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.RecoveryPointModelPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModelTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("CustomProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).CustomProperty = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCustomProperties) content.GetValueForProperty("CustomProperty",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).CustomProperty, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.RecoveryPointModelCustomPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryPointTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).RecoveryPointTime = (global::System.DateTime) content.GetValueForProperty("RecoveryPointTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)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.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).RecoveryPointType = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.RecoveryPointType) content.GetValueForProperty("RecoveryPointType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).RecoveryPointType, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.RecoveryPointType.CreateFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("CustomPropertyInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).CustomPropertyInstanceType = (string) content.GetValueForProperty("CustomPropertyInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal)this).CustomPropertyInstanceType, 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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery point model. + [System.ComponentModel.TypeConverter(typeof(RecoveryPointModelTypeConverter))] + public partial interface IRecoveryPointModel + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModel.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModel.TypeConverter.cs new file mode 100644 index 000000000000..b97717d06111 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModel.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryPointModelTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModel ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModel).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryPointModel.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryPointModel.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryPointModel.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModel.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModel.cs new file mode 100644 index 000000000000..c54dc186f7f1 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModel.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Recovery point model. + public partial class RecoveryPointModel : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModel, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal + { + + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string CustomPropertyInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelPropertiesInternal)Property).CustomPropertyInstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelPropertiesInternal)Property).CustomPropertyInstanceType = value ; } + + /// Backing field for property. + private string _id; + + /// Gets or sets the Id of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Id { get => this._id; } + + /// Internal Acessors for CustomProperty + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCustomProperties Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal.CustomProperty { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelPropertiesInternal)Property).CustomProperty; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelPropertiesInternal)Property).CustomProperty = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal.Id { get => this._id; set { {_id = value;} } } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal.Name { get => this._name; set { {_name = value;} } } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelProperties Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.RecoveryPointModelProperties()); set { {_property = value;} } } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal.SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel()); set { {_systemData = value;} } } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelInternal.Type { get => this._type; set { {_type = value;} } } + + /// Backing field for property. + private string _name; + + /// Gets or sets the name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Name { get => this._name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelProperties _property; + + /// Recovery point model properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.RecoveryPointModelProperties()); set => this._property = value; } + + /// Gets or sets the recovery point time. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public global::System.DateTime RecoveryPointTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelPropertiesInternal)Property).RecoveryPointTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelPropertiesInternal)Property).RecoveryPointTime = value ; } + + /// Gets or sets the recovery point type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.RecoveryPointType RecoveryPointType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelPropertiesInternal)Property).RecoveryPointType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelPropertiesInternal)Property).RecoveryPointType = value ; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel _systemData; + + /// System data required to be defined for Azure resources. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel()); } + + /// Gets or sets the timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedByType = value ?? null; } + + /// Gets or sets the timestamp of resource last modification (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets the identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedByType = value ?? null; } + + /// Backing field for property. + private string _type; + + /// Gets or sets the type of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Type { get => this._type; } + + /// Creates an new instance. + public RecoveryPointModel() + { + + } + } + /// Recovery point model. + public partial interface IRecoveryPointModel : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string CustomPropertyInstanceType { get; set; } + /// Gets or sets the Id of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the Id of the resource.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; } + /// Gets or sets the name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the name of the resource.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; } + /// Gets or sets the recovery point time. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the recovery point time.", + SerializedName = @"recoveryPointTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime RecoveryPointTime { get; set; } + /// Gets or sets the recovery point type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the recovery point type.", + SerializedName = @"recoveryPointType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.RecoveryPointType) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.RecoveryPointType RecoveryPointType { get; set; } + /// Gets or sets the timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the timestamp of resource creation (UTC).", + SerializedName = @"createdAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataCreatedAt { get; set; } + /// Gets or sets identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets identity that created the resource.", + SerializedName = @"createdBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataCreatedBy { get; set; } + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the type of identity that created the resource: user, application, + managedIdentity.", + SerializedName = @"createdByType", + PossibleTypes = new [] { typeof(string) })] + string SystemDataCreatedByType { get; set; } + /// Gets or sets the timestamp of resource last modification (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the timestamp of resource last modification (UTC).", + SerializedName = @"lastModifiedAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataLastModifiedAt { get; set; } + /// Gets or sets the identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the identity that last modified the resource.", + SerializedName = @"lastModifiedBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataLastModifiedBy { get; set; } + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the type of identity that last modified the resource: user, application, + managedIdentity.", + SerializedName = @"lastModifiedByType", + PossibleTypes = new [] { typeof(string) })] + string SystemDataLastModifiedByType { get; set; } + /// Gets or sets the type of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the type of the resource.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; } + + } + /// Recovery point model. + internal partial interface IRecoveryPointModelInternal + + { + /// Recovery point model custom properties. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCustomProperties CustomProperty { get; set; } + /// Gets or sets the instance type. + string CustomPropertyInstanceType { get; set; } + /// Gets or sets the Id of the resource. + string Id { get; set; } + /// Gets or sets the name of the resource. + string Name { get; set; } + /// Recovery point model properties. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelProperties Property { get; set; } + /// Gets or sets the recovery point time. + global::System.DateTime RecoveryPointTime { get; set; } + /// Gets or sets the recovery point type. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.RecoveryPointType RecoveryPointType { get; set; } + /// System data required to be defined for Azure resources. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel SystemData { get; set; } + /// Gets or sets the timestamp of resource creation (UTC). + global::System.DateTime? SystemDataCreatedAt { get; set; } + /// Gets or sets identity that created the resource. + string SystemDataCreatedBy { get; set; } + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + string SystemDataCreatedByType { get; set; } + /// Gets or sets the timestamp of resource last modification (UTC). + global::System.DateTime? SystemDataLastModifiedAt { get; set; } + /// Gets or sets the identity that last modified the resource. + string SystemDataLastModifiedBy { get; set; } + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + string SystemDataLastModifiedByType { get; set; } + /// Gets or sets the type of the resource. + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModel.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModel.json.cs new file mode 100644 index 000000000000..fe44ee48f965 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModel.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Recovery point model. + public partial class RecoveryPointModel + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModel. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModel. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModel FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new RecoveryPointModel(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryPointModel(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api20210216Preview.RecoveryPointModelProperties.FromJson(__jsonProperties) : Property;} + {_systemData = If( json?.PropertyT("systemData"), out var __jsonSystemData) ? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel.FromJson(__jsonSystemData) : SystemData;} + {_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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._systemData ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._systemData.ToJson(null,serializationMode) : null, "systemData" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelCollection.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelCollection.PowerShell.cs new file mode 100644 index 000000000000..aa02dd16be2c --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelCollection.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Recovery point model collection. + [System.ComponentModel.TypeConverter(typeof(RecoveryPointModelCollectionTypeConverter))] + public partial class RecoveryPointModelCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryPointModelCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryPointModelCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryPointModelCollection(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.Migrate.Models.Api20210216Preview.IRecoveryPointModelCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModel[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.RecoveryPointModelTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCollectionInternal)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 RecoveryPointModelCollection(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.Migrate.Models.Api20210216Preview.IRecoveryPointModelCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModel[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.RecoveryPointModelTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCollectionInternal)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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery point model collection. + [System.ComponentModel.TypeConverter(typeof(RecoveryPointModelCollectionTypeConverter))] + public partial interface IRecoveryPointModelCollection + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelCollection.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelCollection.TypeConverter.cs new file mode 100644 index 000000000000..8df9bb5ecf73 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelCollection.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryPointModelCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryPointModelCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryPointModelCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryPointModelCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelCollection.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelCollection.cs new file mode 100644 index 000000000000..2a8b868b929c --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelCollection.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Recovery point model collection. + public partial class RecoveryPointModelCollection : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCollection, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// Gets or sets the value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModel[] _value; + + /// Gets or sets the list of recovery points. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModel[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public RecoveryPointModelCollection() + { + + } + } + /// Recovery point model collection. + public partial interface IRecoveryPointModelCollection : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the value of next link.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// Gets or sets the list of recovery points. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the list of recovery points.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModel) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModel[] Value { get; set; } + + } + /// Recovery point model collection. + internal partial interface IRecoveryPointModelCollectionInternal + + { + /// Gets or sets the value of next link. + string NextLink { get; set; } + /// Gets or sets the list of recovery points. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModel[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelCollection.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelCollection.json.cs new file mode 100644 index 000000000000..d1efa738eb21 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelCollection.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Recovery point model collection. + public partial class RecoveryPointModelCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new RecoveryPointModelCollection(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryPointModelCollection(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Models.Api20210216Preview.IRecoveryPointModel) (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.RecoveryPointModel.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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelCustomProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelCustomProperties.PowerShell.cs new file mode 100644 index 000000000000..19449891c0f0 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Recovery point model custom properties. + [System.ComponentModel.TypeConverter(typeof(RecoveryPointModelCustomPropertiesTypeConverter))] + public partial class RecoveryPointModelCustomProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCustomProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryPointModelCustomProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCustomProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryPointModelCustomProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCustomProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryPointModelCustomProperties(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.Migrate.Models.Api20210216Preview.IRecoveryPointModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCustomPropertiesInternal)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 RecoveryPointModelCustomProperties(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.Migrate.Models.Api20210216Preview.IRecoveryPointModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCustomPropertiesInternal)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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery point model custom properties. + [System.ComponentModel.TypeConverter(typeof(RecoveryPointModelCustomPropertiesTypeConverter))] + public partial interface IRecoveryPointModelCustomProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelCustomProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelCustomProperties.TypeConverter.cs new file mode 100644 index 000000000000..00227e2812c0 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryPointModelCustomPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCustomProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCustomProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryPointModelCustomProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryPointModelCustomProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryPointModelCustomProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelCustomProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelCustomProperties.cs new file mode 100644 index 000000000000..56d66fc36fb5 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Recovery point model custom properties. + public partial class RecoveryPointModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCustomProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCustomPropertiesInternal + { + + /// Backing field for property. + private string _instanceType; + + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Creates an new instance. + public RecoveryPointModelCustomProperties() + { + + } + } + /// Recovery point model custom properties. + public partial interface IRecoveryPointModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Recovery point model custom properties. + internal partial interface IRecoveryPointModelCustomPropertiesInternal + + { + /// Gets or sets the instance type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelCustomProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelCustomProperties.json.cs new file mode 100644 index 000000000000..6300d1748a75 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Recovery point model custom properties. + public partial class RecoveryPointModelCustomProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCustomProperties. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCustomProperties 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.Migrate.Models.Api20210216Preview.IRecoveryPointModelCustomProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCustomProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "HyperVToAzStackHCI": + { + return new HyperVToAzStackHcirecoveryPointModelCustomProperties(json); + } + } + return new RecoveryPointModelCustomProperties(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryPointModelCustomProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelProperties.PowerShell.cs new file mode 100644 index 000000000000..dce7186c3154 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Recovery point model properties. + [System.ComponentModel.TypeConverter(typeof(RecoveryPointModelPropertiesTypeConverter))] + public partial class RecoveryPointModelProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryPointModelProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryPointModelProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryPointModelProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CustomProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelPropertiesInternal)this).CustomProperty = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCustomProperties) content.GetValueForProperty("CustomProperty",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelPropertiesInternal)this).CustomProperty, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.RecoveryPointModelCustomPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryPointTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelPropertiesInternal)this).RecoveryPointTime = (global::System.DateTime) content.GetValueForProperty("RecoveryPointTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelPropertiesInternal)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.Migrate.Models.Api20210216Preview.IRecoveryPointModelPropertiesInternal)this).RecoveryPointType = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.RecoveryPointType) content.GetValueForProperty("RecoveryPointType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelPropertiesInternal)this).RecoveryPointType, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.RecoveryPointType.CreateFrom); + } + if (content.Contains("CustomPropertyInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelPropertiesInternal)this).CustomPropertyInstanceType = (string) content.GetValueForProperty("CustomPropertyInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelPropertiesInternal)this).CustomPropertyInstanceType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RecoveryPointModelProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CustomProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelPropertiesInternal)this).CustomProperty = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCustomProperties) content.GetValueForProperty("CustomProperty",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelPropertiesInternal)this).CustomProperty, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.RecoveryPointModelCustomPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("RecoveryPointTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelPropertiesInternal)this).RecoveryPointTime = (global::System.DateTime) content.GetValueForProperty("RecoveryPointTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelPropertiesInternal)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.Migrate.Models.Api20210216Preview.IRecoveryPointModelPropertiesInternal)this).RecoveryPointType = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.RecoveryPointType) content.GetValueForProperty("RecoveryPointType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelPropertiesInternal)this).RecoveryPointType, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.RecoveryPointType.CreateFrom); + } + if (content.Contains("CustomPropertyInstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelPropertiesInternal)this).CustomPropertyInstanceType = (string) content.GetValueForProperty("CustomPropertyInstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelPropertiesInternal)this).CustomPropertyInstanceType, 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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Recovery point model properties. + [System.ComponentModel.TypeConverter(typeof(RecoveryPointModelPropertiesTypeConverter))] + public partial interface IRecoveryPointModelProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelProperties.TypeConverter.cs new file mode 100644 index 000000000000..46fa650762c2 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryPointModelPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryPointModelProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryPointModelProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryPointModelProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelProperties.cs new file mode 100644 index 000000000000..d7058c38e5e5 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Recovery point model properties. + public partial class RecoveryPointModelProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelPropertiesInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCustomProperties _customProperty; + + /// Recovery point model custom properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCustomProperties CustomProperty { get => (this._customProperty = this._customProperty ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.RecoveryPointModelCustomProperties()); set => this._customProperty = value; } + + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string CustomPropertyInstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCustomPropertiesInternal)CustomProperty).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCustomPropertiesInternal)CustomProperty).InstanceType = value ; } + + /// Internal Acessors for CustomProperty + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCustomProperties Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelPropertiesInternal.CustomProperty { get => (this._customProperty = this._customProperty ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.RecoveryPointModelCustomProperties()); set { {_customProperty = value;} } } + + /// Backing field for property. + private global::System.DateTime _recoveryPointTime; + + /// Gets or sets the recovery point time. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public global::System.DateTime RecoveryPointTime { get => this._recoveryPointTime; set => this._recoveryPointTime = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.RecoveryPointType _recoveryPointType; + + /// Gets or sets the recovery point type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.RecoveryPointType RecoveryPointType { get => this._recoveryPointType; set => this._recoveryPointType = value; } + + /// Creates an new instance. + public RecoveryPointModelProperties() + { + + } + } + /// Recovery point model properties. + public partial interface IRecoveryPointModelProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string CustomPropertyInstanceType { get; set; } + /// Gets or sets the recovery point time. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the recovery point time.", + SerializedName = @"recoveryPointTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime RecoveryPointTime { get; set; } + /// Gets or sets the recovery point type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the recovery point type.", + SerializedName = @"recoveryPointType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.RecoveryPointType) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.RecoveryPointType RecoveryPointType { get; set; } + + } + /// Recovery point model properties. + internal partial interface IRecoveryPointModelPropertiesInternal + + { + /// Recovery point model custom properties. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelCustomProperties CustomProperty { get; set; } + /// Gets or sets the instance type. + string CustomPropertyInstanceType { get; set; } + /// Gets or sets the recovery point time. + global::System.DateTime RecoveryPointTime { get; set; } + /// Gets or sets the recovery point type. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.RecoveryPointType RecoveryPointType { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelProperties.json.cs new file mode 100644 index 000000000000..ffdd79a3673d --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Recovery point model properties. + public partial class RecoveryPointModelProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new RecoveryPointModelProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryPointModelProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_customProperty = If( json?.PropertyT("customProperties"), out var __jsonCustomProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.RecoveryPointModelCustomProperties.FromJson(__jsonCustomProperties) : CustomProperty;} + {_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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._customProperty ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._customProperty.ToJson(null,serializationMode) : null, "customProperties" ,container.Add ); + AddIf( (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._recoveryPointTime.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)), "recoveryPointTime" ,container.Add ); + AddIf( null != (((object)this._recoveryPointType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._recoveryPointType.ToString()) : null, "recoveryPointType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelSystemData.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelSystemData.PowerShell.cs new file mode 100644 index 000000000000..3d18421d9470 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelSystemData.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(RecoveryPointModelSystemDataTypeConverter))] + public partial class RecoveryPointModelSystemData + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelSystemData DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RecoveryPointModelSystemData(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelSystemData DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RecoveryPointModelSystemData(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelSystemData FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RecoveryPointModelSystemData(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy, global::System.Convert.ToString); + } + if (content.Contains("CreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType = (string) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType, global::System.Convert.ToString); + } + if (content.Contains("CreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType = (string) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt, (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 RecoveryPointModelSystemData(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy, global::System.Convert.ToString); + } + if (content.Contains("CreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType = (string) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType, global::System.Convert.ToString); + } + if (content.Contains("CreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType = (string) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt, (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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + [System.ComponentModel.TypeConverter(typeof(RecoveryPointModelSystemDataTypeConverter))] + public partial interface IRecoveryPointModelSystemData + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelSystemData.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelSystemData.TypeConverter.cs new file mode 100644 index 000000000000..898e179aba2c --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelSystemData.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RecoveryPointModelSystemDataTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelSystemData ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelSystemData).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RecoveryPointModelSystemData.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RecoveryPointModelSystemData.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RecoveryPointModelSystemData.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelSystemData.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelSystemData.cs new file mode 100644 index 000000000000..92ec72112a7f --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelSystemData.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + public partial class RecoveryPointModelSystemData : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelSystemData, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelSystemDataInternal, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel __systemDataModel = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel(); + + /// Gets or sets the timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public global::System.DateTime? CreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string CreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string CreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedByType = value ?? null; } + + /// Gets or sets the timestamp of resource last modification (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public global::System.DateTime? LastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets the identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string LastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string LastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedByType = value ?? null; } + + /// Creates an new instance. + public RecoveryPointModelSystemData() + { + + } + + /// 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.Migrate.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__systemDataModel), __systemDataModel); + await eventListener.AssertObjectIsValid(nameof(__systemDataModel), __systemDataModel); + } + } + public partial interface IRecoveryPointModelSystemData : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel + { + + } + internal partial interface IRecoveryPointModelSystemDataInternal : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelSystemData.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelSystemData.json.cs new file mode 100644 index 000000000000..8b76e2aeed8f --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/RecoveryPointModelSystemData.json.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + public partial class RecoveryPointModelSystemData + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelSystemData. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelSystemData. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IRecoveryPointModelSystemData FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new RecoveryPointModelSystemData(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal RecoveryPointModelSystemData(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __systemDataModel = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __systemDataModel?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModel.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModel.PowerShell.cs new file mode 100644 index 000000000000..17d91ff16727 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModel.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Replication extension model. + [System.ComponentModel.TypeConverter(typeof(ReplicationExtensionModelTypeConverter))] + public partial class ReplicationExtensionModel + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ReplicationExtensionModel(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ReplicationExtensionModel(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ReplicationExtensionModel(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModelTypeConverter.ConvertFrom); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ReplicationExtensionModelPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal)this).SystemDataLastModifiedAt, (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 ReplicationExtensionModel(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModelTypeConverter.ConvertFrom); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ReplicationExtensionModelPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal)this).SystemDataLastModifiedAt, (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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Replication extension model. + [System.ComponentModel.TypeConverter(typeof(ReplicationExtensionModelTypeConverter))] + public partial interface IReplicationExtensionModel + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModel.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModel.TypeConverter.cs new file mode 100644 index 000000000000..6ed0c1d590c9 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModel.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ReplicationExtensionModelTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ReplicationExtensionModel.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ReplicationExtensionModel.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ReplicationExtensionModel.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModel.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModel.cs new file mode 100644 index 000000000000..8543e7bc7de6 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModel.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Replication extension model. + public partial class ReplicationExtensionModel : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal + { + + /// Backing field for property. + private string _id; + + /// Gets or sets the Id of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Id { get => this._id; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal.Id { get => this._id; set { {_id = value;} } } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal.Name { get => this._name; set { {_name = value;} } } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal.SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel()); set { {_systemData = value;} } } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelInternal.Type { get => this._type; set { {_type = value;} } } + + /// Backing field for property. + private string _name; + + /// Gets or sets the name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Name { get => this._name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelProperties _property; + + /// Replication extension model properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ReplicationExtensionModelProperties()); set => this._property = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel _systemData; + + /// System data required to be defined for Azure resources. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel()); } + + /// Gets or sets the timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedByType = value ?? null; } + + /// Gets or sets the timestamp of resource last modification (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets the identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedByType = value ?? null; } + + /// Backing field for property. + private string _type; + + /// Gets or sets the type of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Type { get => this._type; } + + /// Creates an new instance. + public ReplicationExtensionModel() + { + + } + } + /// Replication extension model. + public partial interface IReplicationExtensionModel : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the Id of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the Id of the resource.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; } + /// Gets or sets the name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the name of the resource.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; } + /// Replication extension model properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Replication extension model properties.", + SerializedName = @"properties", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelProperties) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelProperties Property { get; set; } + /// Gets or sets the timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the timestamp of resource creation (UTC).", + SerializedName = @"createdAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataCreatedAt { get; set; } + /// Gets or sets identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets identity that created the resource.", + SerializedName = @"createdBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataCreatedBy { get; set; } + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the type of identity that created the resource: user, application, + managedIdentity.", + SerializedName = @"createdByType", + PossibleTypes = new [] { typeof(string) })] + string SystemDataCreatedByType { get; set; } + /// Gets or sets the timestamp of resource last modification (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the timestamp of resource last modification (UTC).", + SerializedName = @"lastModifiedAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataLastModifiedAt { get; set; } + /// Gets or sets the identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the identity that last modified the resource.", + SerializedName = @"lastModifiedBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataLastModifiedBy { get; set; } + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the type of identity that last modified the resource: user, application, + managedIdentity.", + SerializedName = @"lastModifiedByType", + PossibleTypes = new [] { typeof(string) })] + string SystemDataLastModifiedByType { get; set; } + /// Gets or sets the type of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the type of the resource.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; } + + } + /// Replication extension model. + internal partial interface IReplicationExtensionModelInternal + + { + /// Gets or sets the Id of the resource. + string Id { get; set; } + /// Gets or sets the name of the resource. + string Name { get; set; } + /// Replication extension model properties. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelProperties Property { get; set; } + /// System data required to be defined for Azure resources. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel SystemData { get; set; } + /// Gets or sets the timestamp of resource creation (UTC). + global::System.DateTime? SystemDataCreatedAt { get; set; } + /// Gets or sets identity that created the resource. + string SystemDataCreatedBy { get; set; } + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + string SystemDataCreatedByType { get; set; } + /// Gets or sets the timestamp of resource last modification (UTC). + global::System.DateTime? SystemDataLastModifiedAt { get; set; } + /// Gets or sets the identity that last modified the resource. + string SystemDataLastModifiedBy { get; set; } + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + string SystemDataLastModifiedByType { get; set; } + /// Gets or sets the type of the resource. + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModel.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModel.json.cs new file mode 100644 index 000000000000..c4999133c9ae --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModel.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Replication extension model. + public partial class ReplicationExtensionModel + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new ReplicationExtensionModel(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal ReplicationExtensionModel(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_systemData = If( json?.PropertyT("systemData"), out var __jsonSystemData) ? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel.FromJson(__jsonSystemData) : SystemData;} + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ReplicationExtensionModelProperties.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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._systemData ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._systemData.ToJson(null,serializationMode) : null, "systemData" ,container.Add ); + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelCollection.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelCollection.PowerShell.cs new file mode 100644 index 000000000000..2f03306336c3 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelCollection.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Replication extension model collection. + [System.ComponentModel.TypeConverter(typeof(ReplicationExtensionModelCollectionTypeConverter))] + public partial class ReplicationExtensionModelCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ReplicationExtensionModelCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ReplicationExtensionModelCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ReplicationExtensionModelCollection(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.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ReplicationExtensionModelTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCollectionInternal)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 ReplicationExtensionModelCollection(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.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ReplicationExtensionModelTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCollectionInternal)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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Replication extension model collection. + [System.ComponentModel.TypeConverter(typeof(ReplicationExtensionModelCollectionTypeConverter))] + public partial interface IReplicationExtensionModelCollection + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelCollection.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelCollection.TypeConverter.cs new file mode 100644 index 000000000000..15c8aa0a07da --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelCollection.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ReplicationExtensionModelCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ReplicationExtensionModelCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ReplicationExtensionModelCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ReplicationExtensionModelCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelCollection.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelCollection.cs new file mode 100644 index 000000000000..e8fc8aeba03c --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelCollection.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Replication extension model collection. + public partial class ReplicationExtensionModelCollection : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCollection, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// Gets or sets the value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel[] _value; + + /// Gets or sets the list of replication extensions. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public ReplicationExtensionModelCollection() + { + + } + } + /// Replication extension model collection. + public partial interface IReplicationExtensionModelCollection : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the value of next link.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// Gets or sets the list of replication extensions. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the list of replication extensions.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel[] Value { get; set; } + + } + /// Replication extension model collection. + internal partial interface IReplicationExtensionModelCollectionInternal + + { + /// Gets or sets the value of next link. + string NextLink { get; set; } + /// Gets or sets the list of replication extensions. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelCollection.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelCollection.json.cs new file mode 100644 index 000000000000..c27b420c4582 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelCollection.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Replication extension model collection. + public partial class ReplicationExtensionModelCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new ReplicationExtensionModelCollection(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal ReplicationExtensionModelCollection(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Models.Api20210216Preview.IReplicationExtensionModel) (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ReplicationExtensionModel.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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelCustomProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelCustomProperties.PowerShell.cs new file mode 100644 index 000000000000..748b71626e78 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Replication extension model custom properties. + [System.ComponentModel.TypeConverter(typeof(ReplicationExtensionModelCustomPropertiesTypeConverter))] + public partial class ReplicationExtensionModelCustomProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCustomProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ReplicationExtensionModelCustomProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCustomProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ReplicationExtensionModelCustomProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCustomProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ReplicationExtensionModelCustomProperties(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.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCustomPropertiesInternal)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 ReplicationExtensionModelCustomProperties(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.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCustomPropertiesInternal)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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Replication extension model custom properties. + [System.ComponentModel.TypeConverter(typeof(ReplicationExtensionModelCustomPropertiesTypeConverter))] + public partial interface IReplicationExtensionModelCustomProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelCustomProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelCustomProperties.TypeConverter.cs new file mode 100644 index 000000000000..609853acf1c3 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ReplicationExtensionModelCustomPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCustomProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCustomProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ReplicationExtensionModelCustomProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ReplicationExtensionModelCustomProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ReplicationExtensionModelCustomProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelCustomProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelCustomProperties.cs new file mode 100644 index 000000000000..e5731b98e9d2 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Replication extension model custom properties. + public partial class ReplicationExtensionModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCustomProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCustomPropertiesInternal + { + + /// Backing field for property. + private string _instanceType; + + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// + /// Creates an new instance. + /// + public ReplicationExtensionModelCustomProperties() + { + + } + } + /// Replication extension model custom properties. + public partial interface IReplicationExtensionModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Replication extension model custom properties. + internal partial interface IReplicationExtensionModelCustomPropertiesInternal + + { + /// Gets or sets the instance type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelCustomProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelCustomProperties.json.cs new file mode 100644 index 000000000000..1a091e9b11d6 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Replication extension model custom properties. + public partial class ReplicationExtensionModelCustomProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCustomProperties. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCustomProperties + /// 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.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCustomProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCustomProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "HyperVToAzStackHCI": + { + return new HyperVToAzStackHcireplicationExtensionModelCustomProperties(json); + } + case "VMwareToAzStackHCI": + { + return new VMwareToAzStackHcireplicationExtensionModelCustomProperties(json); + } + } + return new ReplicationExtensionModelCustomProperties(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal ReplicationExtensionModelCustomProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelProperties.PowerShell.cs new file mode 100644 index 000000000000..4c2c93375d25 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Replication extension model properties. + [System.ComponentModel.TypeConverter(typeof(ReplicationExtensionModelPropertiesTypeConverter))] + public partial class ReplicationExtensionModelProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ReplicationExtensionModelProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ReplicationExtensionModelProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ReplicationExtensionModelProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelPropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelPropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState.CreateFrom); + } + if (content.Contains("CustomProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelPropertiesInternal)this).CustomProperty = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCustomProperties) content.GetValueForProperty("CustomProperty",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelPropertiesInternal)this).CustomProperty, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ReplicationExtensionModelCustomPropertiesTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ReplicationExtensionModelProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelPropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelPropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState.CreateFrom); + } + if (content.Contains("CustomProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelPropertiesInternal)this).CustomProperty = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCustomProperties) content.GetValueForProperty("CustomProperty",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelPropertiesInternal)this).CustomProperty, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ReplicationExtensionModelCustomPropertiesTypeConverter.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Replication extension model properties. + [System.ComponentModel.TypeConverter(typeof(ReplicationExtensionModelPropertiesTypeConverter))] + public partial interface IReplicationExtensionModelProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelProperties.TypeConverter.cs new file mode 100644 index 000000000000..f839b19a5173 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ReplicationExtensionModelPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ReplicationExtensionModelProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ReplicationExtensionModelProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ReplicationExtensionModelProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelProperties.cs new file mode 100644 index 000000000000..e79848be7490 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Replication extension model properties. + public partial class ReplicationExtensionModelProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelPropertiesInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCustomProperties _customProperty; + + /// Replication extension model custom properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCustomProperties CustomProperty { get => (this._customProperty = this._customProperty ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ReplicationExtensionModelCustomProperties()); set => this._customProperty = value; } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelPropertiesInternal.ProvisioningState { get => this._provisioningState; set { {_provisioningState = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState? _provisioningState; + + /// Gets or sets the provisioning state of the replication extension. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState? ProvisioningState { get => this._provisioningState; } + + /// Creates an new instance. + public ReplicationExtensionModelProperties() + { + + } + } + /// Replication extension model properties. + public partial interface IReplicationExtensionModelProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Replication extension model custom properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Replication extension model custom properties.", + SerializedName = @"customProperties", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCustomProperties) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCustomProperties CustomProperty { get; set; } + /// Gets or sets the provisioning state of the replication extension. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the provisioning state of the replication extension.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState? ProvisioningState { get; } + + } + /// Replication extension model properties. + internal partial interface IReplicationExtensionModelPropertiesInternal + + { + /// Replication extension model custom properties. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCustomProperties CustomProperty { get; set; } + /// Gets or sets the provisioning state of the replication extension. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState? ProvisioningState { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelProperties.json.cs new file mode 100644 index 000000000000..d690bdaf9ee5 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Replication extension model properties. + public partial class ReplicationExtensionModelProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new ReplicationExtensionModelProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal ReplicationExtensionModelProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)ProvisioningState;} + {_customProperty = If( json?.PropertyT("customProperties"), out var __jsonCustomProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ReplicationExtensionModelCustomProperties.FromJson(__jsonCustomProperties) : CustomProperty;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); + } + AddIf( null != this._customProperty ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._customProperty.ToJson(null,serializationMode) : null, "customProperties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelSystemData.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelSystemData.PowerShell.cs new file mode 100644 index 000000000000..85ec2b5e1367 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelSystemData.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(ReplicationExtensionModelSystemDataTypeConverter))] + public partial class ReplicationExtensionModelSystemData + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelSystemData DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ReplicationExtensionModelSystemData(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelSystemData DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ReplicationExtensionModelSystemData(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelSystemData FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ReplicationExtensionModelSystemData(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy, global::System.Convert.ToString); + } + if (content.Contains("CreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType = (string) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType, global::System.Convert.ToString); + } + if (content.Contains("CreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType = (string) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt, (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 ReplicationExtensionModelSystemData(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy, global::System.Convert.ToString); + } + if (content.Contains("CreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType = (string) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType, global::System.Convert.ToString); + } + if (content.Contains("CreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType = (string) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt, (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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + [System.ComponentModel.TypeConverter(typeof(ReplicationExtensionModelSystemDataTypeConverter))] + public partial interface IReplicationExtensionModelSystemData + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelSystemData.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelSystemData.TypeConverter.cs new file mode 100644 index 000000000000..9db8788acae0 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelSystemData.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ReplicationExtensionModelSystemDataTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelSystemData ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelSystemData).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ReplicationExtensionModelSystemData.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ReplicationExtensionModelSystemData.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ReplicationExtensionModelSystemData.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelSystemData.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelSystemData.cs new file mode 100644 index 000000000000..65dc57005e28 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelSystemData.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + public partial class ReplicationExtensionModelSystemData : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelSystemData, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelSystemDataInternal, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel __systemDataModel = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel(); + + /// Gets or sets the timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public global::System.DateTime? CreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string CreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string CreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedByType = value ?? null; } + + /// Gets or sets the timestamp of resource last modification (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public global::System.DateTime? LastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets the identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string LastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string LastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedByType = value ?? null; } + + /// Creates an new instance. + public ReplicationExtensionModelSystemData() + { + + } + + /// 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.Migrate.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__systemDataModel), __systemDataModel); + await eventListener.AssertObjectIsValid(nameof(__systemDataModel), __systemDataModel); + } + } + public partial interface IReplicationExtensionModelSystemData : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel + { + + } + internal partial interface IReplicationExtensionModelSystemDataInternal : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelSystemData.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelSystemData.json.cs new file mode 100644 index 000000000000..e4d212fd049c --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/ReplicationExtensionModelSystemData.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + public partial class ReplicationExtensionModelSystemData + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelSystemData. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelSystemData. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelSystemData FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new ReplicationExtensionModelSystemData(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal ReplicationExtensionModelSystemData(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __systemDataModel = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __systemDataModel?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/StorageContainerProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/StorageContainerProperties.PowerShell.cs new file mode 100644 index 000000000000..7dfc42398cf6 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/StorageContainerProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Storage container properties. + [System.ComponentModel.TypeConverter(typeof(StorageContainerPropertiesTypeConverter))] + public partial class StorageContainerProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IStorageContainerProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new StorageContainerProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IStorageContainerProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new StorageContainerProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IStorageContainerProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal StorageContainerProperties(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.Migrate.Models.Api20210216Preview.IStorageContainerPropertiesInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IStorageContainerPropertiesInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("ClusterSharedVolumePath")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IStorageContainerPropertiesInternal)this).ClusterSharedVolumePath = (string) content.GetValueForProperty("ClusterSharedVolumePath",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IStorageContainerPropertiesInternal)this).ClusterSharedVolumePath, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal StorageContainerProperties(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.Migrate.Models.Api20210216Preview.IStorageContainerPropertiesInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IStorageContainerPropertiesInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("ClusterSharedVolumePath")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IStorageContainerPropertiesInternal)this).ClusterSharedVolumePath = (string) content.GetValueForProperty("ClusterSharedVolumePath",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IStorageContainerPropertiesInternal)this).ClusterSharedVolumePath, 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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Storage container properties. + [System.ComponentModel.TypeConverter(typeof(StorageContainerPropertiesTypeConverter))] + public partial interface IStorageContainerProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/StorageContainerProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/StorageContainerProperties.TypeConverter.cs new file mode 100644 index 000000000000..e3d7c9863b5c --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/StorageContainerProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class StorageContainerPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IStorageContainerProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IStorageContainerProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return StorageContainerProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return StorageContainerProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return StorageContainerProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/StorageContainerProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/StorageContainerProperties.cs new file mode 100644 index 000000000000..cc8adbb370fe --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/StorageContainerProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Storage container properties. + public partial class StorageContainerProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IStorageContainerProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IStorageContainerPropertiesInternal + { + + /// Backing field for property. + private string _clusterSharedVolumePath; + + /// Gets or sets the ClusterSharedVolumePath. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string ClusterSharedVolumePath { get => this._clusterSharedVolumePath; set => this._clusterSharedVolumePath = value; } + + /// Backing field for property. + private string _name; + + /// Gets or sets the Name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Creates an new instance. + public StorageContainerProperties() + { + + } + } + /// Storage container properties. + public partial interface IStorageContainerProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the ClusterSharedVolumePath. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the ClusterSharedVolumePath.", + SerializedName = @"clusterSharedVolumePath", + PossibleTypes = new [] { typeof(string) })] + string ClusterSharedVolumePath { get; set; } + /// Gets or sets the Name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the Name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + + } + /// Storage container properties. + internal partial interface IStorageContainerPropertiesInternal + + { + /// Gets or sets the ClusterSharedVolumePath. + string ClusterSharedVolumePath { get; set; } + /// Gets or sets the Name. + string Name { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/StorageContainerProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/StorageContainerProperties.json.cs new file mode 100644 index 000000000000..1662be385f33 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/StorageContainerProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Storage container properties. + public partial class StorageContainerProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IStorageContainerProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IStorageContainerProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IStorageContainerProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new StorageContainerProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal StorageContainerProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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;} + {_clusterSharedVolumePath = If( json?.PropertyT("clusterSharedVolumePath"), out var __jsonClusterSharedVolumePath) ? (string)__jsonClusterSharedVolumePath : (string)ClusterSharedVolumePath;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AddIf( null != (((object)this._clusterSharedVolumePath)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._clusterSharedVolumePath.ToString()) : null, "clusterSharedVolumePath" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/SystemDataModel.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/SystemDataModel.PowerShell.cs new file mode 100644 index 000000000000..07400ee0065a --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/SystemDataModel.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// System data required to be defined for Azure resources. + [System.ComponentModel.TypeConverter(typeof(SystemDataModelTypeConverter))] + public partial class SystemDataModel + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new SystemDataModel(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new SystemDataModel(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal SystemDataModel(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy, global::System.Convert.ToString); + } + if (content.Contains("CreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType = (string) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType, global::System.Convert.ToString); + } + if (content.Contains("CreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType = (string) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt, (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 SystemDataModel(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy, global::System.Convert.ToString); + } + if (content.Contains("CreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType = (string) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType, global::System.Convert.ToString); + } + if (content.Contains("CreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType = (string) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt, (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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// System data required to be defined for Azure resources. + [System.ComponentModel.TypeConverter(typeof(SystemDataModelTypeConverter))] + public partial interface ISystemDataModel + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/SystemDataModel.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/SystemDataModel.TypeConverter.cs new file mode 100644 index 000000000000..bedca9f0591c --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/SystemDataModel.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SystemDataModelTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return SystemDataModel.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return SystemDataModel.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return SystemDataModel.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/SystemDataModel.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/SystemDataModel.cs new file mode 100644 index 000000000000..b7494d2284d9 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/SystemDataModel.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// System data required to be defined for Azure resources. + public partial class SystemDataModel : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal + { + + /// Backing field for property. + private global::System.DateTime? _createdAt; + + /// Gets or sets the timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public global::System.DateTime? CreatedAt { get => this._createdAt; set => this._createdAt = value; } + + /// Backing field for property. + private string _createdBy; + + /// Gets or sets identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string CreatedBy { get => this._createdBy; set => this._createdBy = value; } + + /// Backing field for property. + private string _createdByType; + + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string CreatedByType { get => this._createdByType; set => this._createdByType = value; } + + /// Backing field for property. + private global::System.DateTime? _lastModifiedAt; + + /// Gets or sets the timestamp of resource last modification (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public global::System.DateTime? LastModifiedAt { get => this._lastModifiedAt; set => this._lastModifiedAt = value; } + + /// Backing field for property. + private string _lastModifiedBy; + + /// Gets or sets the identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string LastModifiedBy { get => this._lastModifiedBy; set => this._lastModifiedBy = value; } + + /// Backing field for property. + private string _lastModifiedByType; + + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string LastModifiedByType { get => this._lastModifiedByType; set => this._lastModifiedByType = value; } + + /// Creates an new instance. + public SystemDataModel() + { + + } + } + /// System data required to be defined for Azure resources. + public partial interface ISystemDataModel : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the timestamp of resource creation (UTC).", + SerializedName = @"createdAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? CreatedAt { get; set; } + /// Gets or sets identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets identity that created the resource.", + SerializedName = @"createdBy", + PossibleTypes = new [] { typeof(string) })] + string CreatedBy { get; set; } + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the type of identity that created the resource: user, application, + managedIdentity.", + SerializedName = @"createdByType", + PossibleTypes = new [] { typeof(string) })] + string CreatedByType { get; set; } + /// Gets or sets the timestamp of resource last modification (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the timestamp of resource last modification (UTC).", + SerializedName = @"lastModifiedAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastModifiedAt { get; set; } + /// Gets or sets the identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the identity that last modified the resource.", + SerializedName = @"lastModifiedBy", + PossibleTypes = new [] { typeof(string) })] + string LastModifiedBy { get; set; } + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the type of identity that last modified the resource: user, application, + managedIdentity.", + SerializedName = @"lastModifiedByType", + PossibleTypes = new [] { typeof(string) })] + string LastModifiedByType { get; set; } + + } + /// System data required to be defined for Azure resources. + internal partial interface ISystemDataModelInternal + + { + /// Gets or sets the timestamp of resource creation (UTC). + global::System.DateTime? CreatedAt { get; set; } + /// Gets or sets identity that created the resource. + string CreatedBy { get; set; } + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + string CreatedByType { get; set; } + /// Gets or sets the timestamp of resource last modification (UTC). + global::System.DateTime? LastModifiedAt { get; set; } + /// Gets or sets the identity that last modified the resource. + string LastModifiedBy { get; set; } + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + string LastModifiedByType { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/SystemDataModel.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/SystemDataModel.json.cs new file mode 100644 index 000000000000..2626ef378176 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/SystemDataModel.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// System data required to be defined for Azure resources. + public partial class SystemDataModel + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new SystemDataModel(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal SystemDataModel(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_createdBy = If( json?.PropertyT("createdBy"), out var __jsonCreatedBy) ? (string)__jsonCreatedBy : (string)CreatedBy;} + {_createdByType = If( json?.PropertyT("createdByType"), out var __jsonCreatedByType) ? (string)__jsonCreatedByType : (string)CreatedByType;} + {_createdAt = If( json?.PropertyT("createdAt"), out var __jsonCreatedAt) ? global::System.DateTime.TryParse((string)__jsonCreatedAt, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonCreatedAtValue) ? __jsonCreatedAtValue : CreatedAt : CreatedAt;} + {_lastModifiedBy = If( json?.PropertyT("lastModifiedBy"), out var __jsonLastModifiedBy) ? (string)__jsonLastModifiedBy : (string)LastModifiedBy;} + {_lastModifiedByType = If( json?.PropertyT("lastModifiedByType"), out var __jsonLastModifiedByType) ? (string)__jsonLastModifiedByType : (string)LastModifiedByType;} + {_lastModifiedAt = If( json?.PropertyT("lastModifiedAt"), out var __jsonLastModifiedAt) ? global::System.DateTime.TryParse((string)__jsonLastModifiedAt, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastModifiedAtValue) ? __jsonLastModifiedAtValue : LastModifiedAt : LastModifiedAt;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._createdBy)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._createdBy.ToString()) : null, "createdBy" ,container.Add ); + AddIf( null != (((object)this._createdByType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._createdByType.ToString()) : null, "createdByType" ,container.Add ); + AddIf( null != this._createdAt ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._createdAt?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "createdAt" ,container.Add ); + AddIf( null != (((object)this._lastModifiedBy)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._lastModifiedBy.ToString()) : null, "lastModifiedBy" ,container.Add ); + AddIf( null != (((object)this._lastModifiedByType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._lastModifiedByType.ToString()) : null, "lastModifiedByType" ,container.Add ); + AddIf( null != this._lastModifiedAt ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._lastModifiedAt?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastModifiedAt" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TaskModel.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TaskModel.PowerShell.cs new file mode 100644 index 000000000000..5adb837a4a6f --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TaskModel.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Task model. + [System.ComponentModel.TypeConverter(typeof(TaskModelTypeConverter))] + public partial class TaskModel + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModel DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TaskModel(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModel DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TaskModel(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModel FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TaskModel(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("TaskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelInternal)this).TaskName = (string) content.GetValueForProperty("TaskName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelInternal)this).TaskName, global::System.Convert.ToString); + } + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelInternal)this).State = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.TaskState?) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelInternal)this).State, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.TaskState.CreateFrom); + } + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelInternal)this).StartTime = (global::System.DateTime?) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelInternal)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.Migrate.Models.Api20210216Preview.ITaskModelInternal)this).EndTime = (global::System.DateTime?) content.GetValueForProperty("EndTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelInternal)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("CustomProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelInternal)this).CustomProperty = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelCustomProperties) content.GetValueForProperty("CustomProperty",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelInternal)this).CustomProperty, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.TaskModelCustomPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ChildrenWorkflow")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelInternal)this).ChildrenWorkflow = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel[]) content.GetValueForProperty("ChildrenWorkflow",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelInternal)this).ChildrenWorkflow, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal TaskModel(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("TaskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelInternal)this).TaskName = (string) content.GetValueForProperty("TaskName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelInternal)this).TaskName, global::System.Convert.ToString); + } + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelInternal)this).State = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.TaskState?) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelInternal)this).State, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.TaskState.CreateFrom); + } + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelInternal)this).StartTime = (global::System.DateTime?) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelInternal)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.Migrate.Models.Api20210216Preview.ITaskModelInternal)this).EndTime = (global::System.DateTime?) content.GetValueForProperty("EndTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelInternal)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("CustomProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelInternal)this).CustomProperty = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelCustomProperties) content.GetValueForProperty("CustomProperty",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelInternal)this).CustomProperty, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.TaskModelCustomPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("ChildrenWorkflow")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelInternal)this).ChildrenWorkflow = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel[]) content.GetValueForProperty("ChildrenWorkflow",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelInternal)this).ChildrenWorkflow, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelTypeConverter.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Task model. + [System.ComponentModel.TypeConverter(typeof(TaskModelTypeConverter))] + public partial interface ITaskModel + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TaskModel.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TaskModel.TypeConverter.cs new file mode 100644 index 000000000000..e927a2943ac2 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TaskModel.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TaskModelTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModel ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModel).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TaskModel.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TaskModel.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TaskModel.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TaskModel.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TaskModel.cs new file mode 100644 index 000000000000..cab05a305abf --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TaskModel.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Task model. + public partial class TaskModel : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModel, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel[] _childrenWorkflow; + + /// Gets or sets the list of children workflow models. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel[] ChildrenWorkflow { get => this._childrenWorkflow; set => this._childrenWorkflow = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelCustomProperties _customProperty; + + /// Task model custom properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelCustomProperties CustomProperty { get => (this._customProperty = this._customProperty ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.TaskModelCustomProperties()); set => this._customProperty = value; } + + /// Backing field for property. + private global::System.DateTime? _endTime; + + /// Gets or sets the end time. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public global::System.DateTime? EndTime { get => this._endTime; } + + /// Internal Acessors for EndTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelInternal.EndTime { get => this._endTime; set { {_endTime = value;} } } + + /// Internal Acessors for StartTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelInternal.StartTime { get => this._startTime; set { {_startTime = value;} } } + + /// Internal Acessors for State + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.TaskState? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelInternal.State { get => this._state; set { {_state = value;} } } + + /// Internal Acessors for TaskName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelInternal.TaskName { get => this._taskName; set { {_taskName = value;} } } + + /// Backing field for property. + private global::System.DateTime? _startTime; + + /// Gets or sets the start time. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public global::System.DateTime? StartTime { get => this._startTime; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.TaskState? _state; + + /// Gets or sets the task state. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.TaskState? State { get => this._state; } + + /// Backing field for property. + private string _taskName; + + /// Gets or sets the task name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TaskName { get => this._taskName; } + + /// Creates an new instance. + public TaskModel() + { + + } + } + /// Task model. + public partial interface ITaskModel : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the list of children workflow models. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the list of children workflow models.", + SerializedName = @"childrenWorkflows", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel[] ChildrenWorkflow { get; set; } + /// Task model custom properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Task model custom properties.", + SerializedName = @"customProperties", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelCustomProperties) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelCustomProperties CustomProperty { get; set; } + /// Gets or sets the end time. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the end time.", + SerializedName = @"endTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? EndTime { get; } + /// Gets or sets the start time. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the start time.", + SerializedName = @"startTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? StartTime { get; } + /// Gets or sets the task state. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the task state.", + SerializedName = @"state", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.TaskState) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.TaskState? State { get; } + /// Gets or sets the task name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the task name.", + SerializedName = @"taskName", + PossibleTypes = new [] { typeof(string) })] + string TaskName { get; } + + } + /// Task model. + internal partial interface ITaskModelInternal + + { + /// Gets or sets the list of children workflow models. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel[] ChildrenWorkflow { get; set; } + /// Task model custom properties. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelCustomProperties CustomProperty { get; set; } + /// Gets or sets the end time. + global::System.DateTime? EndTime { get; set; } + /// Gets or sets the start time. + global::System.DateTime? StartTime { get; set; } + /// Gets or sets the task state. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.TaskState? State { get; set; } + /// Gets or sets the task name. + string TaskName { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TaskModel.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TaskModel.json.cs new file mode 100644 index 000000000000..693386e69b35 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TaskModel.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Task model. + public partial class TaskModel + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModel. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModel. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModel FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new TaskModel(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal TaskModel(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_taskName = If( json?.PropertyT("taskName"), out var __jsonTaskName) ? (string)__jsonTaskName : (string)TaskName;} + {_state = If( json?.PropertyT("state"), out var __jsonState) ? (string)__jsonState : (string)State;} + {_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;} + {_customProperty = If( json?.PropertyT("customProperties"), out var __jsonCustomProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.TaskModelCustomProperties.FromJson(__jsonCustomProperties) : CustomProperty;} + {_childrenWorkflow = If( json?.PropertyT("childrenWorkflows"), out var __jsonChildrenWorkflows) ? If( __jsonChildrenWorkflows as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api20210216Preview.IWorkflowModel) (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModel.FromJson(__u) )) ))() : null : ChildrenWorkflow;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._taskName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._taskName.ToString()) : null, "taskName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._state)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._state.ToString()) : null, "state" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._startTime ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._endTime ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._endTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "endTime" ,container.Add ); + } + AddIf( null != this._customProperty ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._customProperty.ToJson(null,serializationMode) : null, "customProperties" ,container.Add ); + if (null != this._childrenWorkflow) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.XNodeArray(); + foreach( var __x in this._childrenWorkflow ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("childrenWorkflows",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TaskModelCustomProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TaskModelCustomProperties.PowerShell.cs new file mode 100644 index 000000000000..9b4c58955e64 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TaskModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Task model custom properties. + [System.ComponentModel.TypeConverter(typeof(TaskModelCustomPropertiesTypeConverter))] + public partial class TaskModelCustomProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelCustomProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TaskModelCustomProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelCustomProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TaskModelCustomProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelCustomProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TaskModelCustomProperties(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.Migrate.Models.Api20210216Preview.ITaskModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelCustomPropertiesInternal)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 TaskModelCustomProperties(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.Migrate.Models.Api20210216Preview.ITaskModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelCustomPropertiesInternal)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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Task model custom properties. + [System.ComponentModel.TypeConverter(typeof(TaskModelCustomPropertiesTypeConverter))] + public partial interface ITaskModelCustomProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TaskModelCustomProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TaskModelCustomProperties.TypeConverter.cs new file mode 100644 index 000000000000..3e1cfedafc4d --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TaskModelCustomProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TaskModelCustomPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelCustomProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelCustomProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TaskModelCustomProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TaskModelCustomProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TaskModelCustomProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TaskModelCustomProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TaskModelCustomProperties.cs new file mode 100644 index 000000000000..7e9ef1a8801d --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TaskModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Task model custom properties. + public partial class TaskModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelCustomProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelCustomPropertiesInternal + { + + /// Backing field for property. + private string _instanceType; + + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Creates an new instance. + public TaskModelCustomProperties() + { + + } + } + /// Task model custom properties. + public partial interface ITaskModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Task model custom properties. + internal partial interface ITaskModelCustomPropertiesInternal + + { + /// Gets or sets the instance type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TaskModelCustomProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TaskModelCustomProperties.json.cs new file mode 100644 index 000000000000..f386e7e7d139 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TaskModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Task model custom properties. + public partial class TaskModelCustomProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelCustomProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelCustomProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModelCustomProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new TaskModelCustomProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal TaskModelCustomProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TestFailoverCleanupWorkflowModelCustomProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TestFailoverCleanupWorkflowModelCustomProperties.PowerShell.cs new file mode 100644 index 000000000000..2d2b7976e4e2 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TestFailoverCleanupWorkflowModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Test failover cleanup workflow model custom properties. + [System.ComponentModel.TypeConverter(typeof(TestFailoverCleanupWorkflowModelCustomPropertiesTypeConverter))] + public partial class TestFailoverCleanupWorkflowModelCustomProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITestFailoverCleanupWorkflowModelCustomProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TestFailoverCleanupWorkflowModelCustomProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITestFailoverCleanupWorkflowModelCustomProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TestFailoverCleanupWorkflowModelCustomProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITestFailoverCleanupWorkflowModelCustomProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TestFailoverCleanupWorkflowModelCustomProperties(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.Migrate.Models.Api20210216Preview.ITestFailoverCleanupWorkflowModelCustomPropertiesInternal)this).Comment = (string) content.GetValueForProperty("Comment",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITestFailoverCleanupWorkflowModelCustomPropertiesInternal)this).Comment, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("AffectedObjectDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)this).AffectedObjectDetail = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesAffectedObjectDetails) content.GetValueForProperty("AffectedObjectDetail",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)this).AffectedObjectDetail, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetailsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal TestFailoverCleanupWorkflowModelCustomProperties(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.Migrate.Models.Api20210216Preview.ITestFailoverCleanupWorkflowModelCustomPropertiesInternal)this).Comment = (string) content.GetValueForProperty("Comment",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITestFailoverCleanupWorkflowModelCustomPropertiesInternal)this).Comment, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("AffectedObjectDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)this).AffectedObjectDetail = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesAffectedObjectDetails) content.GetValueForProperty("AffectedObjectDetail",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)this).AffectedObjectDetail, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetailsTypeConverter.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Test failover cleanup workflow model custom properties. + [System.ComponentModel.TypeConverter(typeof(TestFailoverCleanupWorkflowModelCustomPropertiesTypeConverter))] + public partial interface ITestFailoverCleanupWorkflowModelCustomProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TestFailoverCleanupWorkflowModelCustomProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TestFailoverCleanupWorkflowModelCustomProperties.TypeConverter.cs new file mode 100644 index 000000000000..a5c6b5312568 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TestFailoverCleanupWorkflowModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TestFailoverCleanupWorkflowModelCustomPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITestFailoverCleanupWorkflowModelCustomProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITestFailoverCleanupWorkflowModelCustomProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TestFailoverCleanupWorkflowModelCustomProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TestFailoverCleanupWorkflowModelCustomProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TestFailoverCleanupWorkflowModelCustomProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TestFailoverCleanupWorkflowModelCustomProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TestFailoverCleanupWorkflowModelCustomProperties.cs new file mode 100644 index 000000000000..8227a8f6da13 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TestFailoverCleanupWorkflowModelCustomProperties.cs @@ -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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Test failover cleanup workflow model custom properties. + public partial class TestFailoverCleanupWorkflowModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITestFailoverCleanupWorkflowModelCustomProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITestFailoverCleanupWorkflowModelCustomPropertiesInternal, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomProperties __workflowModelCustomProperties = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomProperties(); + + /// Gets or sets any custom properties of the affected object. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesAffectedObjectDetails AffectedObjectDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)__workflowModelCustomProperties).AffectedObjectDetail; } + + /// Backing field for property. + private string _comment; + + /// Gets or sets the test failover cleanup comments. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Comment { get => this._comment; } + + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)__workflowModelCustomProperties).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)__workflowModelCustomProperties).InstanceType = value ; } + + /// Internal Acessors for Comment + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITestFailoverCleanupWorkflowModelCustomPropertiesInternal.Comment { get => this._comment; set { {_comment = value;} } } + + /// Internal Acessors for AffectedObjectDetail + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesAffectedObjectDetails Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal.AffectedObjectDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)__workflowModelCustomProperties).AffectedObjectDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)__workflowModelCustomProperties).AffectedObjectDetail = value; } + + /// + /// Creates an new instance. + /// + public TestFailoverCleanupWorkflowModelCustomProperties() + { + + } + + /// 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.Migrate.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__workflowModelCustomProperties), __workflowModelCustomProperties); + await eventListener.AssertObjectIsValid(nameof(__workflowModelCustomProperties), __workflowModelCustomProperties); + } + } + /// Test failover cleanup workflow model custom properties. + public partial interface ITestFailoverCleanupWorkflowModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomProperties + { + /// Gets or sets the test failover cleanup comments. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the test failover cleanup comments.", + SerializedName = @"comments", + PossibleTypes = new [] { typeof(string) })] + string Comment { get; } + + } + /// Test failover cleanup workflow model custom properties. + internal partial interface ITestFailoverCleanupWorkflowModelCustomPropertiesInternal : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal + { + /// Gets or sets the test failover cleanup comments. + string Comment { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TestFailoverCleanupWorkflowModelCustomProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TestFailoverCleanupWorkflowModelCustomProperties.json.cs new file mode 100644 index 000000000000..0a8ead021142 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TestFailoverCleanupWorkflowModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Test failover cleanup workflow model custom properties. + public partial class TestFailoverCleanupWorkflowModelCustomProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITestFailoverCleanupWorkflowModelCustomProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITestFailoverCleanupWorkflowModelCustomProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITestFailoverCleanupWorkflowModelCustomProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new TestFailoverCleanupWorkflowModelCustomProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal TestFailoverCleanupWorkflowModelCustomProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __workflowModelCustomProperties = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomProperties(json); + {_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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __workflowModelCustomProperties?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._comment)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._comment.ToString()) : null, "comments" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TestFailoverWorkflowModelCustomProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TestFailoverWorkflowModelCustomProperties.PowerShell.cs new file mode 100644 index 000000000000..63d6b321d05f --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TestFailoverWorkflowModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Test failover workflow model custom properties. + [System.ComponentModel.TypeConverter(typeof(TestFailoverWorkflowModelCustomPropertiesTypeConverter))] + public partial class TestFailoverWorkflowModelCustomProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITestFailoverWorkflowModelCustomProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TestFailoverWorkflowModelCustomProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITestFailoverWorkflowModelCustomProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TestFailoverWorkflowModelCustomProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITestFailoverWorkflowModelCustomProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TestFailoverWorkflowModelCustomProperties(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.Migrate.Models.Api20210216Preview.ITestFailoverWorkflowModelCustomPropertiesInternal)this).ProtectedItemDetail = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemProperties[]) content.GetValueForProperty("ProtectedItemDetail",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITestFailoverWorkflowModelCustomPropertiesInternal)this).ProtectedItemDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FailoverProtectedItemPropertiesTypeConverter.ConvertFrom)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("AffectedObjectDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)this).AffectedObjectDetail = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesAffectedObjectDetails) content.GetValueForProperty("AffectedObjectDetail",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)this).AffectedObjectDetail, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetailsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal TestFailoverWorkflowModelCustomProperties(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.Migrate.Models.Api20210216Preview.ITestFailoverWorkflowModelCustomPropertiesInternal)this).ProtectedItemDetail = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemProperties[]) content.GetValueForProperty("ProtectedItemDetail",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITestFailoverWorkflowModelCustomPropertiesInternal)this).ProtectedItemDetail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FailoverProtectedItemPropertiesTypeConverter.ConvertFrom)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("AffectedObjectDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)this).AffectedObjectDetail = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesAffectedObjectDetails) content.GetValueForProperty("AffectedObjectDetail",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)this).AffectedObjectDetail, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetailsTypeConverter.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Test failover workflow model custom properties. + [System.ComponentModel.TypeConverter(typeof(TestFailoverWorkflowModelCustomPropertiesTypeConverter))] + public partial interface ITestFailoverWorkflowModelCustomProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TestFailoverWorkflowModelCustomProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TestFailoverWorkflowModelCustomProperties.TypeConverter.cs new file mode 100644 index 000000000000..fe0a55bec991 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TestFailoverWorkflowModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TestFailoverWorkflowModelCustomPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITestFailoverWorkflowModelCustomProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITestFailoverWorkflowModelCustomProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TestFailoverWorkflowModelCustomProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TestFailoverWorkflowModelCustomProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TestFailoverWorkflowModelCustomProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TestFailoverWorkflowModelCustomProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TestFailoverWorkflowModelCustomProperties.cs new file mode 100644 index 000000000000..a3db3dac2fcb --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TestFailoverWorkflowModelCustomProperties.cs @@ -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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Test failover workflow model custom properties. + public partial class TestFailoverWorkflowModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITestFailoverWorkflowModelCustomProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITestFailoverWorkflowModelCustomPropertiesInternal, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomProperties __workflowModelCustomProperties = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomProperties(); + + /// Gets or sets any custom properties of the affected object. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesAffectedObjectDetails AffectedObjectDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)__workflowModelCustomProperties).AffectedObjectDetail; } + + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)__workflowModelCustomProperties).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)__workflowModelCustomProperties).InstanceType = value ; } + + /// Internal Acessors for ProtectedItemDetail + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemProperties[] Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITestFailoverWorkflowModelCustomPropertiesInternal.ProtectedItemDetail { get => this._protectedItemDetail; set { {_protectedItemDetail = value;} } } + + /// Internal Acessors for AffectedObjectDetail + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesAffectedObjectDetails Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal.AffectedObjectDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)__workflowModelCustomProperties).AffectedObjectDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)__workflowModelCustomProperties).AffectedObjectDetail = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemProperties[] _protectedItemDetail; + + /// Gets or sets the test VM details. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemProperties[] ProtectedItemDetail { get => this._protectedItemDetail; } + + /// + /// Creates an new instance. + /// + public TestFailoverWorkflowModelCustomProperties() + { + + } + + /// 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.Migrate.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__workflowModelCustomProperties), __workflowModelCustomProperties); + await eventListener.AssertObjectIsValid(nameof(__workflowModelCustomProperties), __workflowModelCustomProperties); + } + } + /// Test failover workflow model custom properties. + public partial interface ITestFailoverWorkflowModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomProperties + { + /// Gets or sets the test VM details. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the test VM details.", + SerializedName = @"protectedItemDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemProperties) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemProperties[] ProtectedItemDetail { get; } + + } + /// Test failover workflow model custom properties. + internal partial interface ITestFailoverWorkflowModelCustomPropertiesInternal : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal + { + /// Gets or sets the test VM details. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFailoverProtectedItemProperties[] ProtectedItemDetail { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TestFailoverWorkflowModelCustomProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TestFailoverWorkflowModelCustomProperties.json.cs new file mode 100644 index 000000000000..f8f04719e8c8 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/TestFailoverWorkflowModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Test failover workflow model custom properties. + public partial class TestFailoverWorkflowModelCustomProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITestFailoverWorkflowModelCustomProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITestFailoverWorkflowModelCustomProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITestFailoverWorkflowModelCustomProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new TestFailoverWorkflowModelCustomProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal TestFailoverWorkflowModelCustomProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __workflowModelCustomProperties = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomProperties(json); + {_protectedItemDetail = If( json?.PropertyT("protectedItemDetails"), out var __jsonProtectedItemDetails) ? If( __jsonProtectedItemDetails as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api20210216Preview.IFailoverProtectedItemProperties) (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FailoverProtectedItemProperties.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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __workflowModelCustomProperties?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._protectedItemDetail) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareDraModelCustomProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareDraModelCustomProperties.PowerShell.cs new file mode 100644 index 000000000000..3b815b3278db --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareDraModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// VMware DRA model custom properties. + [System.ComponentModel.TypeConverter(typeof(VMwareDraModelCustomPropertiesTypeConverter))] + public partial class VMwareDraModelCustomProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareDraModelCustomProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMwareDraModelCustomProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareDraModelCustomProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMwareDraModelCustomProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareDraModelCustomProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMwareDraModelCustomProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("MarsAuthenticationIdentity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareDraModelCustomPropertiesInternal)this).MarsAuthenticationIdentity = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModel) content.GetValueForProperty("MarsAuthenticationIdentity",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareDraModelCustomPropertiesInternal)this).MarsAuthenticationIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IdentityModelTypeConverter.ConvertFrom); + } + if (content.Contains("BiosId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareDraModelCustomPropertiesInternal)this).BiosId = (string) content.GetValueForProperty("BiosId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareDraModelCustomPropertiesInternal)this).BiosId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCustomPropertiesInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("MarAuthenticationIdentityTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareDraModelCustomPropertiesInternal)this).MarAuthenticationIdentityTenantId = (string) content.GetValueForProperty("MarAuthenticationIdentityTenantId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareDraModelCustomPropertiesInternal)this).MarAuthenticationIdentityTenantId, global::System.Convert.ToString); + } + if (content.Contains("MarAuthenticationIdentityApplicationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareDraModelCustomPropertiesInternal)this).MarAuthenticationIdentityApplicationId = (string) content.GetValueForProperty("MarAuthenticationIdentityApplicationId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareDraModelCustomPropertiesInternal)this).MarAuthenticationIdentityApplicationId, global::System.Convert.ToString); + } + if (content.Contains("MarAuthenticationIdentityObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareDraModelCustomPropertiesInternal)this).MarAuthenticationIdentityObjectId = (string) content.GetValueForProperty("MarAuthenticationIdentityObjectId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareDraModelCustomPropertiesInternal)this).MarAuthenticationIdentityObjectId, global::System.Convert.ToString); + } + if (content.Contains("MarAuthenticationIdentityAudience")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareDraModelCustomPropertiesInternal)this).MarAuthenticationIdentityAudience = (string) content.GetValueForProperty("MarAuthenticationIdentityAudience",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareDraModelCustomPropertiesInternal)this).MarAuthenticationIdentityAudience, global::System.Convert.ToString); + } + if (content.Contains("MarAuthenticationIdentityAadAuthority")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareDraModelCustomPropertiesInternal)this).MarAuthenticationIdentityAadAuthority = (string) content.GetValueForProperty("MarAuthenticationIdentityAadAuthority",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareDraModelCustomPropertiesInternal)this).MarAuthenticationIdentityAadAuthority, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VMwareDraModelCustomProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("MarsAuthenticationIdentity")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareDraModelCustomPropertiesInternal)this).MarsAuthenticationIdentity = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModel) content.GetValueForProperty("MarsAuthenticationIdentity",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareDraModelCustomPropertiesInternal)this).MarsAuthenticationIdentity, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IdentityModelTypeConverter.ConvertFrom); + } + if (content.Contains("BiosId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareDraModelCustomPropertiesInternal)this).BiosId = (string) content.GetValueForProperty("BiosId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareDraModelCustomPropertiesInternal)this).BiosId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCustomPropertiesInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("MarAuthenticationIdentityTenantId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareDraModelCustomPropertiesInternal)this).MarAuthenticationIdentityTenantId = (string) content.GetValueForProperty("MarAuthenticationIdentityTenantId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareDraModelCustomPropertiesInternal)this).MarAuthenticationIdentityTenantId, global::System.Convert.ToString); + } + if (content.Contains("MarAuthenticationIdentityApplicationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareDraModelCustomPropertiesInternal)this).MarAuthenticationIdentityApplicationId = (string) content.GetValueForProperty("MarAuthenticationIdentityApplicationId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareDraModelCustomPropertiesInternal)this).MarAuthenticationIdentityApplicationId, global::System.Convert.ToString); + } + if (content.Contains("MarAuthenticationIdentityObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareDraModelCustomPropertiesInternal)this).MarAuthenticationIdentityObjectId = (string) content.GetValueForProperty("MarAuthenticationIdentityObjectId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareDraModelCustomPropertiesInternal)this).MarAuthenticationIdentityObjectId, global::System.Convert.ToString); + } + if (content.Contains("MarAuthenticationIdentityAudience")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareDraModelCustomPropertiesInternal)this).MarAuthenticationIdentityAudience = (string) content.GetValueForProperty("MarAuthenticationIdentityAudience",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareDraModelCustomPropertiesInternal)this).MarAuthenticationIdentityAudience, global::System.Convert.ToString); + } + if (content.Contains("MarAuthenticationIdentityAadAuthority")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareDraModelCustomPropertiesInternal)this).MarAuthenticationIdentityAadAuthority = (string) content.GetValueForProperty("MarAuthenticationIdentityAadAuthority",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareDraModelCustomPropertiesInternal)this).MarAuthenticationIdentityAadAuthority, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// VMware DRA model custom properties. + [System.ComponentModel.TypeConverter(typeof(VMwareDraModelCustomPropertiesTypeConverter))] + public partial interface IVMwareDraModelCustomProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareDraModelCustomProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareDraModelCustomProperties.TypeConverter.cs new file mode 100644 index 000000000000..8636026c163b --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareDraModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMwareDraModelCustomPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareDraModelCustomProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareDraModelCustomProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMwareDraModelCustomProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMwareDraModelCustomProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMwareDraModelCustomProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareDraModelCustomProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareDraModelCustomProperties.cs new file mode 100644 index 000000000000..e6a38c2d2f00 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareDraModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// VMware DRA model custom properties. + public partial class VMwareDraModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareDraModelCustomProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareDraModelCustomPropertiesInternal, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCustomProperties __draModelCustomProperties = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.DraModelCustomProperties(); + + /// Backing field for property. + private string _biosId; + + /// Gets or sets the BIOS Id of the DRA machine. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string BiosId { get => this._biosId; set => this._biosId = value; } + + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCustomPropertiesInternal)__draModelCustomProperties).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCustomPropertiesInternal)__draModelCustomProperties).InstanceType = value ; } + + /// Gets or sets the authority of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string MarAuthenticationIdentityAadAuthority { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)MarsAuthenticationIdentity).AadAuthority; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)MarsAuthenticationIdentity).AadAuthority = value ; } + + /// + /// Gets or sets the client/application Id of the SPN with which Dra communicates to + /// service. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string MarAuthenticationIdentityApplicationId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)MarsAuthenticationIdentity).ApplicationId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)MarsAuthenticationIdentity).ApplicationId = value ; } + + /// Gets or sets the audience of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string MarAuthenticationIdentityAudience { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)MarsAuthenticationIdentity).Audience; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)MarsAuthenticationIdentity).Audience = value ; } + + /// Gets or sets the object Id of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string MarAuthenticationIdentityObjectId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)MarsAuthenticationIdentity).ObjectId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)MarsAuthenticationIdentity).ObjectId = value ; } + + /// Gets or sets the tenant Id of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string MarAuthenticationIdentityTenantId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)MarsAuthenticationIdentity).TenantId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModelInternal)MarsAuthenticationIdentity).TenantId = value ; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModel _marsAuthenticationIdentity; + + /// Identity model. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModel MarsAuthenticationIdentity { get => (this._marsAuthenticationIdentity = this._marsAuthenticationIdentity ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IdentityModel()); set => this._marsAuthenticationIdentity = value; } + + /// Internal Acessors for MarsAuthenticationIdentity + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModel Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareDraModelCustomPropertiesInternal.MarsAuthenticationIdentity { get => (this._marsAuthenticationIdentity = this._marsAuthenticationIdentity ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IdentityModel()); set { {_marsAuthenticationIdentity = value;} } } + + /// Creates an new instance. + public VMwareDraModelCustomProperties() + { + + } + + /// 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.Migrate.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__draModelCustomProperties), __draModelCustomProperties); + await eventListener.AssertObjectIsValid(nameof(__draModelCustomProperties), __draModelCustomProperties); + } + } + /// VMware DRA model custom properties. + public partial interface IVMwareDraModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCustomProperties + { + /// Gets or sets the BIOS Id of the DRA machine. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the BIOS Id of the DRA machine.", + SerializedName = @"biosId", + PossibleTypes = new [] { typeof(string) })] + string BiosId { get; set; } + /// Gets or sets the authority of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the authority of the SPN with which Dra communicates to service.", + SerializedName = @"aadAuthority", + PossibleTypes = new [] { typeof(string) })] + string MarAuthenticationIdentityAadAuthority { get; set; } + /// + /// Gets or sets the client/application Id of the SPN with which Dra communicates to + /// service. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the client/application Id of the SPN with which Dra communicates to + service.", + SerializedName = @"applicationId", + PossibleTypes = new [] { typeof(string) })] + string MarAuthenticationIdentityApplicationId { get; set; } + /// Gets or sets the audience of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the audience of the SPN with which Dra communicates to service.", + SerializedName = @"audience", + PossibleTypes = new [] { typeof(string) })] + string MarAuthenticationIdentityAudience { get; set; } + /// Gets or sets the object Id of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the object Id of the SPN with which Dra communicates to service.", + SerializedName = @"objectId", + PossibleTypes = new [] { typeof(string) })] + string MarAuthenticationIdentityObjectId { get; set; } + /// Gets or sets the tenant Id of the SPN with which Dra communicates to service. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the tenant Id of the SPN with which Dra communicates to service.", + SerializedName = @"tenantId", + PossibleTypes = new [] { typeof(string) })] + string MarAuthenticationIdentityTenantId { get; set; } + + } + /// VMware DRA model custom properties. + internal partial interface IVMwareDraModelCustomPropertiesInternal : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModelCustomPropertiesInternal + { + /// Gets or sets the BIOS Id of the DRA machine. + string BiosId { get; set; } + /// Gets or sets the authority of the SPN with which Dra communicates to service. + string MarAuthenticationIdentityAadAuthority { get; set; } + /// + /// Gets or sets the client/application Id of the SPN with which Dra communicates to + /// service. + /// + string MarAuthenticationIdentityApplicationId { get; set; } + /// Gets or sets the audience of the SPN with which Dra communicates to service. + string MarAuthenticationIdentityAudience { get; set; } + /// Gets or sets the object Id of the SPN with which Dra communicates to service. + string MarAuthenticationIdentityObjectId { get; set; } + /// Gets or sets the tenant Id of the SPN with which Dra communicates to service. + string MarAuthenticationIdentityTenantId { get; set; } + /// Identity model. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IIdentityModel MarsAuthenticationIdentity { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareDraModelCustomProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareDraModelCustomProperties.json.cs new file mode 100644 index 000000000000..1eed9d1b6422 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareDraModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// VMware DRA model custom properties. + public partial class VMwareDraModelCustomProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareDraModelCustomProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareDraModelCustomProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareDraModelCustomProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new VMwareDraModelCustomProperties(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __draModelCustomProperties?.ToJson(container, serializationMode); + AddIf( null != this._marsAuthenticationIdentity ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._marsAuthenticationIdentity.ToJson(null,serializationMode) : null, "marsAuthenticationIdentity" ,container.Add ); + AddIf( null != (((object)this._biosId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._biosId.ToString()) : null, "biosId" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal VMwareDraModelCustomProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __draModelCustomProperties = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.DraModelCustomProperties(json); + {_marsAuthenticationIdentity = If( json?.PropertyT("marsAuthenticationIdentity"), out var __jsonMarsAuthenticationIdentity) ? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IdentityModel.FromJson(__jsonMarsAuthenticationIdentity) : MarsAuthenticationIdentity;} + {_biosId = If( json?.PropertyT("biosId"), out var __jsonBiosId) ? (string)__jsonBiosId : (string)BiosId;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareMigrateFabricModelCustomProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareMigrateFabricModelCustomProperties.PowerShell.cs new file mode 100644 index 000000000000..f59cf29ccfed --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareMigrateFabricModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// VMware migrate fabric model custom properties. + [System.ComponentModel.TypeConverter(typeof(VMwareMigrateFabricModelCustomPropertiesTypeConverter))] + public partial class VMwareMigrateFabricModelCustomProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareMigrateFabricModelCustomProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMwareMigrateFabricModelCustomProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareMigrateFabricModelCustomProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMwareMigrateFabricModelCustomProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareMigrateFabricModelCustomProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMwareMigrateFabricModelCustomProperties(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.Migrate.Models.Api20210216Preview.IVMwareMigrateFabricModelCustomPropertiesInternal)this).VmwareSiteId = (string) content.GetValueForProperty("VmwareSiteId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareMigrateFabricModelCustomPropertiesInternal)this).VmwareSiteId, global::System.Convert.ToString); + } + if (content.Contains("MigrationSolutionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareMigrateFabricModelCustomPropertiesInternal)this).MigrationSolutionId = (string) content.GetValueForProperty("MigrationSolutionId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareMigrateFabricModelCustomPropertiesInternal)this).MigrationSolutionId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCustomPropertiesInternal)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 VMwareMigrateFabricModelCustomProperties(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.Migrate.Models.Api20210216Preview.IVMwareMigrateFabricModelCustomPropertiesInternal)this).VmwareSiteId = (string) content.GetValueForProperty("VmwareSiteId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareMigrateFabricModelCustomPropertiesInternal)this).VmwareSiteId, global::System.Convert.ToString); + } + if (content.Contains("MigrationSolutionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareMigrateFabricModelCustomPropertiesInternal)this).MigrationSolutionId = (string) content.GetValueForProperty("MigrationSolutionId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareMigrateFabricModelCustomPropertiesInternal)this).MigrationSolutionId, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCustomPropertiesInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// VMware migrate fabric model custom properties. + [System.ComponentModel.TypeConverter(typeof(VMwareMigrateFabricModelCustomPropertiesTypeConverter))] + public partial interface IVMwareMigrateFabricModelCustomProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareMigrateFabricModelCustomProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareMigrateFabricModelCustomProperties.TypeConverter.cs new file mode 100644 index 000000000000..741497d7ba4d --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareMigrateFabricModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMwareMigrateFabricModelCustomPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareMigrateFabricModelCustomProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareMigrateFabricModelCustomProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMwareMigrateFabricModelCustomProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMwareMigrateFabricModelCustomProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMwareMigrateFabricModelCustomProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareMigrateFabricModelCustomProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareMigrateFabricModelCustomProperties.cs new file mode 100644 index 000000000000..9b4de64ab485 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareMigrateFabricModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// VMware migrate fabric model custom properties. + public partial class VMwareMigrateFabricModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareMigrateFabricModelCustomProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareMigrateFabricModelCustomPropertiesInternal, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCustomProperties __fabricModelCustomProperties = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelCustomProperties(); + + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCustomPropertiesInternal)__fabricModelCustomProperties).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCustomPropertiesInternal)__fabricModelCustomProperties).InstanceType = value ; } + + /// Backing field for property. + private string _migrationSolutionId; + + /// Gets or sets the ARM Id of the migration solution. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string MigrationSolutionId { get => this._migrationSolutionId; set => this._migrationSolutionId = value; } + + /// Backing field for property. + private string _vmwareSiteId; + + /// Gets or sets the ARM Id of the VMware site. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string VmwareSiteId { get => this._vmwareSiteId; set => this._vmwareSiteId = value; } + + /// + /// Creates an new instance. + /// + public VMwareMigrateFabricModelCustomProperties() + { + + } + + /// 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.Migrate.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__fabricModelCustomProperties), __fabricModelCustomProperties); + await eventListener.AssertObjectIsValid(nameof(__fabricModelCustomProperties), __fabricModelCustomProperties); + } + } + /// VMware migrate fabric model custom properties. + public partial interface IVMwareMigrateFabricModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCustomProperties + { + /// Gets or sets the ARM Id of the migration solution. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the ARM Id of the migration solution.", + SerializedName = @"migrationSolutionId", + PossibleTypes = new [] { typeof(string) })] + string MigrationSolutionId { get; set; } + /// Gets or sets the ARM Id of the VMware site. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the ARM Id of the VMware site.", + SerializedName = @"vmwareSiteId", + PossibleTypes = new [] { typeof(string) })] + string VmwareSiteId { get; set; } + + } + /// VMware migrate fabric model custom properties. + internal partial interface IVMwareMigrateFabricModelCustomPropertiesInternal : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModelCustomPropertiesInternal + { + /// Gets or sets the ARM Id of the migration solution. + string MigrationSolutionId { get; set; } + /// Gets or sets the ARM Id of the VMware site. + string VmwareSiteId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareMigrateFabricModelCustomProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareMigrateFabricModelCustomProperties.json.cs new file mode 100644 index 000000000000..2e1f97777c69 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareMigrateFabricModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// VMware migrate fabric model custom properties. + public partial class VMwareMigrateFabricModelCustomProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareMigrateFabricModelCustomProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareMigrateFabricModelCustomProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareMigrateFabricModelCustomProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new VMwareMigrateFabricModelCustomProperties(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __fabricModelCustomProperties?.ToJson(container, serializationMode); + AddIf( null != (((object)this._vmwareSiteId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._vmwareSiteId.ToString()) : null, "vmwareSiteId" ,container.Add ); + AddIf( null != (((object)this._migrationSolutionId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._migrationSolutionId.ToString()) : null, "migrationSolutionId" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal VMwareMigrateFabricModelCustomProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __fabricModelCustomProperties = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelCustomProperties(json); + {_vmwareSiteId = If( json?.PropertyT("vmwareSiteId"), out var __jsonVmwareSiteId) ? (string)__jsonVmwareSiteId : (string)VmwareSiteId;} + {_migrationSolutionId = If( json?.PropertyT("migrationSolutionId"), out var __jsonMigrationSolutionId) ? (string)__jsonMigrationSolutionId : (string)MigrationSolutionId;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcidiskInput.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcidiskInput.PowerShell.cs new file mode 100644 index 000000000000..9123e321db96 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcidiskInput.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// VMwareToAzStack disk input. + [System.ComponentModel.TypeConverter(typeof(VMwareToAzStackHcidiskInputTypeConverter))] + public partial class VMwareToAzStackHcidiskInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcidiskInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMwareToAzStackHcidiskInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcidiskInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMwareToAzStackHcidiskInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcidiskInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMwareToAzStackHcidiskInput(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.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcidiskInputInternal)this).DiskId = (string) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcidiskInputInternal)this).DiskId, global::System.Convert.ToString); + } + if (content.Contains("StorageContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcidiskInputInternal)this).StorageContainerId = (string) content.GetValueForProperty("StorageContainerId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcidiskInputInternal)this).StorageContainerId, global::System.Convert.ToString); + } + if (content.Contains("IsDynamic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcidiskInputInternal)this).IsDynamic = (bool?) content.GetValueForProperty("IsDynamic",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcidiskInputInternal)this).IsDynamic, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("DiskSizeGb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcidiskInputInternal)this).DiskSizeGb = (long) content.GetValueForProperty("DiskSizeGb",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcidiskInputInternal)this).DiskSizeGb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("DiskFileFormat")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcidiskInputInternal)this).DiskFileFormat = (string) content.GetValueForProperty("DiskFileFormat",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcidiskInputInternal)this).DiskFileFormat, global::System.Convert.ToString); + } + if (content.Contains("IsOSDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcidiskInputInternal)this).IsOSDisk = (bool) content.GetValueForProperty("IsOSDisk",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcidiskInputInternal)this).IsOSDisk, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VMwareToAzStackHcidiskInput(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.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcidiskInputInternal)this).DiskId = (string) content.GetValueForProperty("DiskId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcidiskInputInternal)this).DiskId, global::System.Convert.ToString); + } + if (content.Contains("StorageContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcidiskInputInternal)this).StorageContainerId = (string) content.GetValueForProperty("StorageContainerId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcidiskInputInternal)this).StorageContainerId, global::System.Convert.ToString); + } + if (content.Contains("IsDynamic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcidiskInputInternal)this).IsDynamic = (bool?) content.GetValueForProperty("IsDynamic",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcidiskInputInternal)this).IsDynamic, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("DiskSizeGb")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcidiskInputInternal)this).DiskSizeGb = (long) content.GetValueForProperty("DiskSizeGb",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcidiskInputInternal)this).DiskSizeGb, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("DiskFileFormat")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcidiskInputInternal)this).DiskFileFormat = (string) content.GetValueForProperty("DiskFileFormat",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcidiskInputInternal)this).DiskFileFormat, global::System.Convert.ToString); + } + if (content.Contains("IsOSDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcidiskInputInternal)this).IsOSDisk = (bool) content.GetValueForProperty("IsOSDisk",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcidiskInputInternal)this).IsOSDisk, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + AfterDeserializePSObject(content); + } + } + /// VMwareToAzStack disk input. + [System.ComponentModel.TypeConverter(typeof(VMwareToAzStackHcidiskInputTypeConverter))] + public partial interface IVMwareToAzStackHcidiskInput + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcidiskInput.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcidiskInput.TypeConverter.cs new file mode 100644 index 000000000000..6bd8ad983ecc --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcidiskInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMwareToAzStackHcidiskInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcidiskInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcidiskInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMwareToAzStackHcidiskInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMwareToAzStackHcidiskInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMwareToAzStackHcidiskInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcidiskInput.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcidiskInput.cs new file mode 100644 index 000000000000..f5f24844e5ec --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcidiskInput.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// VMwareToAzStack disk input. + public partial class VMwareToAzStackHcidiskInput : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcidiskInput, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcidiskInputInternal + { + + /// Backing field for property. + private string _diskFileFormat; + + /// Gets or sets the type of the virtual hard disk, vhd or vhdx. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string DiskFileFormat { get => this._diskFileFormat; set => this._diskFileFormat = value; } + + /// Backing field for property. + private string _diskId; + + /// Gets or sets the disk Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string DiskId { get => this._diskId; set => this._diskId = value; } + + /// Backing field for property. + private long _diskSizeGb; + + /// Gets or sets the disk size in GB. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public long DiskSizeGb { get => this._diskSizeGb; set => this._diskSizeGb = value; } + + /// Backing field for property. + private bool? _isDynamic; + + /// + /// Gets or sets a value indicating whether dynamic sizing is enabled on the virtual hard + /// disk. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public bool? IsDynamic { get => this._isDynamic; set => this._isDynamic = value; } + + /// Backing field for property. + private bool _isOSDisk; + + /// Gets or sets a value indicating whether disk is os disk. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public bool IsOSDisk { get => this._isOSDisk; set => this._isOSDisk = value; } + + /// Backing field for property. + private string _storageContainerId; + + /// Gets or sets the target storage account ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string StorageContainerId { get => this._storageContainerId; set => this._storageContainerId = value; } + + /// Creates an new instance. + public VMwareToAzStackHcidiskInput() + { + + } + } + /// VMwareToAzStack disk input. + public partial interface IVMwareToAzStackHcidiskInput : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the type of the virtual hard disk, vhd or vhdx. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the type of the virtual hard disk, vhd or vhdx.", + SerializedName = @"diskFileFormat", + PossibleTypes = new [] { typeof(string) })] + string DiskFileFormat { get; set; } + /// Gets or sets the disk Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the disk Id.", + SerializedName = @"diskId", + PossibleTypes = new [] { typeof(string) })] + string DiskId { get; set; } + /// Gets or sets the disk size in GB. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the disk size in GB.", + SerializedName = @"diskSizeGB", + PossibleTypes = new [] { typeof(long) })] + long DiskSizeGb { get; set; } + /// + /// Gets or sets a value indicating whether dynamic sizing is enabled on the virtual hard + /// disk. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets a value indicating whether dynamic sizing is enabled on the virtual hard + disk.", + SerializedName = @"isDynamic", + PossibleTypes = new [] { typeof(bool) })] + bool? IsDynamic { get; set; } + /// Gets or sets a value indicating whether disk is os disk. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets a value indicating whether disk is os disk.", + SerializedName = @"isOsDisk", + PossibleTypes = new [] { typeof(bool) })] + bool IsOSDisk { get; set; } + /// Gets or sets the target storage account ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the target storage account ARM Id.", + SerializedName = @"storageContainerId", + PossibleTypes = new [] { typeof(string) })] + string StorageContainerId { get; set; } + + } + /// VMwareToAzStack disk input. + internal partial interface IVMwareToAzStackHcidiskInputInternal + + { + /// Gets or sets the type of the virtual hard disk, vhd or vhdx. + string DiskFileFormat { get; set; } + /// Gets or sets the disk Id. + string DiskId { get; set; } + /// Gets or sets the disk size in GB. + long DiskSizeGb { get; set; } + /// + /// Gets or sets a value indicating whether dynamic sizing is enabled on the virtual hard + /// disk. + /// + bool? IsDynamic { get; set; } + /// Gets or sets a value indicating whether disk is os disk. + bool IsOSDisk { get; set; } + /// Gets or sets the target storage account ARM Id. + string StorageContainerId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcidiskInput.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcidiskInput.json.cs new file mode 100644 index 000000000000..9769125c4532 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcidiskInput.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// VMwareToAzStack disk input. + public partial class VMwareToAzStackHcidiskInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcidiskInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcidiskInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcidiskInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new VMwareToAzStackHcidiskInput(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._diskId.ToString()) : null, "diskId" ,container.Add ); + AddIf( null != (((object)this._storageContainerId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._storageContainerId.ToString()) : null, "storageContainerId" ,container.Add ); + AddIf( null != this._isDynamic ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonBoolean((bool)this._isDynamic) : null, "isDynamic" ,container.Add ); + AddIf( (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNumber(this._diskSizeGb), "diskSizeGB" ,container.Add ); + AddIf( null != (((object)this._diskFileFormat)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._diskFileFormat.ToString()) : null, "diskFileFormat" ,container.Add ); + AddIf( (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonBoolean(this._isOSDisk), "isOsDisk" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal VMwareToAzStackHcidiskInput(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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;} + {_storageContainerId = If( json?.PropertyT("storageContainerId"), out var __jsonStorageContainerId) ? (string)__jsonStorageContainerId : (string)StorageContainerId;} + {_isDynamic = If( json?.PropertyT("isDynamic"), out var __jsonIsDynamic) ? (bool?)__jsonIsDynamic : IsDynamic;} + {_diskSizeGb = If( json?.PropertyT("diskSizeGB"), out var __jsonDiskSizeGb) ? (long)__jsonDiskSizeGb : DiskSizeGb;} + {_diskFileFormat = If( json?.PropertyT("diskFileFormat"), out var __jsonDiskFileFormat) ? (string)__jsonDiskFileFormat : (string)DiskFileFormat;} + {_isOSDisk = If( json?.PropertyT("isOsDisk"), out var __jsonIsOSDisk) ? (bool)__jsonIsOSDisk : IsOSDisk;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcinicInput.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcinicInput.PowerShell.cs new file mode 100644 index 000000000000..146c955fb50d --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcinicInput.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// VMwareToAzStackHCI NIC properties. + [System.ComponentModel.TypeConverter(typeof(VMwareToAzStackHcinicInputTypeConverter))] + public partial class VMwareToAzStackHcinicInput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcinicInput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMwareToAzStackHcinicInput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcinicInput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMwareToAzStackHcinicInput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcinicInput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMwareToAzStackHcinicInput(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.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcinicInputInternal)this).NicId = (string) content.GetValueForProperty("NicId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcinicInputInternal)this).NicId, global::System.Convert.ToString); + } + if (content.Contains("Label")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcinicInputInternal)this).Label = (string) content.GetValueForProperty("Label",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcinicInputInternal)this).Label, global::System.Convert.ToString); + } + if (content.Contains("NetworkName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcinicInputInternal)this).NetworkName = (string) content.GetValueForProperty("NetworkName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcinicInputInternal)this).NetworkName, global::System.Convert.ToString); + } + if (content.Contains("TargetNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcinicInputInternal)this).TargetNetworkId = (string) content.GetValueForProperty("TargetNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcinicInputInternal)this).TargetNetworkId, global::System.Convert.ToString); + } + if (content.Contains("TestNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcinicInputInternal)this).TestNetworkId = (string) content.GetValueForProperty("TestNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcinicInputInternal)this).TestNetworkId, global::System.Convert.ToString); + } + if (content.Contains("SelectionTypeForFailover")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcinicInputInternal)this).SelectionTypeForFailover = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection) content.GetValueForProperty("SelectionTypeForFailover",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcinicInputInternal)this).SelectionTypeForFailover, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VMwareToAzStackHcinicInput(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.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcinicInputInternal)this).NicId = (string) content.GetValueForProperty("NicId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcinicInputInternal)this).NicId, global::System.Convert.ToString); + } + if (content.Contains("Label")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcinicInputInternal)this).Label = (string) content.GetValueForProperty("Label",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcinicInputInternal)this).Label, global::System.Convert.ToString); + } + if (content.Contains("NetworkName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcinicInputInternal)this).NetworkName = (string) content.GetValueForProperty("NetworkName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcinicInputInternal)this).NetworkName, global::System.Convert.ToString); + } + if (content.Contains("TargetNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcinicInputInternal)this).TargetNetworkId = (string) content.GetValueForProperty("TargetNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcinicInputInternal)this).TargetNetworkId, global::System.Convert.ToString); + } + if (content.Contains("TestNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcinicInputInternal)this).TestNetworkId = (string) content.GetValueForProperty("TestNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcinicInputInternal)this).TestNetworkId, global::System.Convert.ToString); + } + if (content.Contains("SelectionTypeForFailover")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcinicInputInternal)this).SelectionTypeForFailover = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection) content.GetValueForProperty("SelectionTypeForFailover",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcinicInputInternal)this).SelectionTypeForFailover, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection.CreateFrom); + } + AfterDeserializePSObject(content); + } + } + /// VMwareToAzStackHCI NIC properties. + [System.ComponentModel.TypeConverter(typeof(VMwareToAzStackHcinicInputTypeConverter))] + public partial interface IVMwareToAzStackHcinicInput + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcinicInput.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcinicInput.TypeConverter.cs new file mode 100644 index 000000000000..bd82d04fa9ad --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcinicInput.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMwareToAzStackHcinicInputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcinicInput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcinicInput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMwareToAzStackHcinicInput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMwareToAzStackHcinicInput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMwareToAzStackHcinicInput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcinicInput.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcinicInput.cs new file mode 100644 index 000000000000..93d61beb0aa5 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcinicInput.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// VMwareToAzStackHCI NIC properties. + public partial class VMwareToAzStackHcinicInput : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcinicInput, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcinicInputInternal + { + + /// Backing field for property. + private string _label; + + /// Gets or sets the NIC label. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Label { get => this._label; set => this._label = value; } + + /// Internal Acessors for NetworkName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcinicInputInternal.NetworkName { get => this._networkName; set { {_networkName = value;} } } + + /// Backing field for property. + private string _networkName; + + /// Gets or sets the network name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string NetworkName { get => this._networkName; } + + /// Backing field for property. + private string _nicId; + + /// Gets or sets the NIC Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string NicId { get => this._nicId; set => this._nicId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection _selectionTypeForFailover; + + /// Gets or sets the selection type of the NIC. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection SelectionTypeForFailover { get => this._selectionTypeForFailover; set => this._selectionTypeForFailover = value; } + + /// Backing field for property. + private string _targetNetworkId; + + /// Gets or sets the target network Id within AzStackHCI Cluster. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TargetNetworkId { get => this._targetNetworkId; set => this._targetNetworkId = value; } + + /// Backing field for property. + private string _testNetworkId; + + /// Gets or sets the target test network Id within AzStackHCI Cluster. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TestNetworkId { get => this._testNetworkId; set => this._testNetworkId = value; } + + /// Creates an new instance. + public VMwareToAzStackHcinicInput() + { + + } + } + /// VMwareToAzStackHCI NIC properties. + public partial interface IVMwareToAzStackHcinicInput : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the NIC label. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the NIC label.", + SerializedName = @"label", + PossibleTypes = new [] { typeof(string) })] + string Label { get; set; } + /// Gets or sets the network name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the network name.", + SerializedName = @"networkName", + PossibleTypes = new [] { typeof(string) })] + string NetworkName { get; } + /// Gets or sets the NIC Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the NIC Id.", + SerializedName = @"nicId", + PossibleTypes = new [] { typeof(string) })] + string NicId { get; set; } + /// Gets or sets the selection type of the NIC. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the selection type of the NIC.", + SerializedName = @"selectionTypeForFailover", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection SelectionTypeForFailover { get; set; } + /// Gets or sets the target network Id within AzStackHCI Cluster. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the target network Id within AzStackHCI Cluster.", + SerializedName = @"targetNetworkId", + PossibleTypes = new [] { typeof(string) })] + string TargetNetworkId { get; set; } + /// Gets or sets the target test network Id within AzStackHCI Cluster. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the target test network Id within AzStackHCI Cluster.", + SerializedName = @"testNetworkId", + PossibleTypes = new [] { typeof(string) })] + string TestNetworkId { get; set; } + + } + /// VMwareToAzStackHCI NIC properties. + internal partial interface IVMwareToAzStackHcinicInputInternal + + { + /// Gets or sets the NIC label. + string Label { get; set; } + /// Gets or sets the network name. + string NetworkName { get; set; } + /// Gets or sets the NIC Id. + string NicId { get; set; } + /// Gets or sets the selection type of the NIC. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection SelectionTypeForFailover { get; set; } + /// Gets or sets the target network Id within AzStackHCI Cluster. + string TargetNetworkId { get; set; } + /// Gets or sets the target test network Id within AzStackHCI Cluster. + string TestNetworkId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcinicInput.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcinicInput.json.cs new file mode 100644 index 000000000000..8d562ec0bf0a --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcinicInput.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// VMwareToAzStackHCI NIC properties. + public partial class VMwareToAzStackHcinicInput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcinicInput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcinicInput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcinicInput FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new VMwareToAzStackHcinicInput(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._nicId.ToString()) : null, "nicId" ,container.Add ); + AddIf( null != (((object)this._label)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._label.ToString()) : null, "label" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._networkName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._networkName.ToString()) : null, "networkName" ,container.Add ); + } + AddIf( null != (((object)this._targetNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._targetNetworkId.ToString()) : null, "targetNetworkId" ,container.Add ); + AddIf( null != (((object)this._testNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._testNetworkId.ToString()) : null, "testNetworkId" ,container.Add ); + AddIf( null != (((object)this._selectionTypeForFailover)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._selectionTypeForFailover.ToString()) : null, "selectionTypeForFailover" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal VMwareToAzStackHcinicInput(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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;} + {_label = If( json?.PropertyT("label"), out var __jsonLabel) ? (string)__jsonLabel : (string)Label;} + {_networkName = If( json?.PropertyT("networkName"), out var __jsonNetworkName) ? (string)__jsonNetworkName : (string)NetworkName;} + {_targetNetworkId = If( json?.PropertyT("targetNetworkId"), out var __jsonTargetNetworkId) ? (string)__jsonTargetNetworkId : (string)TargetNetworkId;} + {_testNetworkId = If( json?.PropertyT("testNetworkId"), out var __jsonTestNetworkId) ? (string)__jsonTestNetworkId : (string)TestNetworkId;} + {_selectionTypeForFailover = If( json?.PropertyT("selectionTypeForFailover"), out var __jsonSelectionTypeForFailover) ? (string)__jsonSelectionTypeForFailover : (string)SelectionTypeForFailover;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciplannedFailoverModelCustomProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciplannedFailoverModelCustomProperties.PowerShell.cs new file mode 100644 index 000000000000..fcb017a12ecc --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciplannedFailoverModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// VMware to AzStackHCI planned failover model custom properties. + [System.ComponentModel.TypeConverter(typeof(VMwareToAzStackHciplannedFailoverModelCustomPropertiesTypeConverter))] + public partial class VMwareToAzStackHciplannedFailoverModelCustomProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciplannedFailoverModelCustomProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMwareToAzStackHciplannedFailoverModelCustomProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciplannedFailoverModelCustomProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMwareToAzStackHciplannedFailoverModelCustomProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content + /// from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciplannedFailoverModelCustomProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMwareToAzStackHciplannedFailoverModelCustomProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ShutdownSourceVM")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciplannedFailoverModelCustomPropertiesInternal)this).ShutdownSourceVM = (bool) content.GetValueForProperty("ShutdownSourceVM",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciplannedFailoverModelCustomPropertiesInternal)this).ShutdownSourceVM, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelCustomPropertiesInternal)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 VMwareToAzStackHciplannedFailoverModelCustomProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ShutdownSourceVM")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciplannedFailoverModelCustomPropertiesInternal)this).ShutdownSourceVM = (bool) content.GetValueForProperty("ShutdownSourceVM",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciplannedFailoverModelCustomPropertiesInternal)this).ShutdownSourceVM, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelCustomPropertiesInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// VMware to AzStackHCI planned failover model custom properties. + [System.ComponentModel.TypeConverter(typeof(VMwareToAzStackHciplannedFailoverModelCustomPropertiesTypeConverter))] + public partial interface IVMwareToAzStackHciplannedFailoverModelCustomProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciplannedFailoverModelCustomProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciplannedFailoverModelCustomProperties.TypeConverter.cs new file mode 100644 index 000000000000..a5808ffb5c20 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciplannedFailoverModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMwareToAzStackHciplannedFailoverModelCustomPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciplannedFailoverModelCustomProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciplannedFailoverModelCustomProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMwareToAzStackHciplannedFailoverModelCustomProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMwareToAzStackHciplannedFailoverModelCustomProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMwareToAzStackHciplannedFailoverModelCustomProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciplannedFailoverModelCustomProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciplannedFailoverModelCustomProperties.cs new file mode 100644 index 000000000000..4ac8496ff0f3 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciplannedFailoverModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// VMware to AzStackHCI planned failover model custom properties. + public partial class VMwareToAzStackHciplannedFailoverModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciplannedFailoverModelCustomProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciplannedFailoverModelCustomPropertiesInternal, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelCustomProperties __plannedFailoverModelCustomProperties = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PlannedFailoverModelCustomProperties(); + + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelCustomPropertiesInternal)__plannedFailoverModelCustomProperties).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelCustomPropertiesInternal)__plannedFailoverModelCustomProperties).InstanceType = value ; } + + /// Backing field for property. + private bool _shutdownSourceVM; + + /// Gets or sets a value indicating whether VM needs to be shut down. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public bool ShutdownSourceVM { get => this._shutdownSourceVM; set => this._shutdownSourceVM = value; } + + /// + /// Creates an new instance. + /// + public VMwareToAzStackHciplannedFailoverModelCustomProperties() + { + + } + + /// 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.Migrate.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__plannedFailoverModelCustomProperties), __plannedFailoverModelCustomProperties); + await eventListener.AssertObjectIsValid(nameof(__plannedFailoverModelCustomProperties), __plannedFailoverModelCustomProperties); + } + } + /// VMware to AzStackHCI planned failover model custom properties. + public partial interface IVMwareToAzStackHciplannedFailoverModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelCustomProperties + { + /// Gets or sets a value indicating whether VM needs to be shut down. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets a value indicating whether VM needs to be shut down.", + SerializedName = @"shutdownSourceVM", + PossibleTypes = new [] { typeof(bool) })] + bool ShutdownSourceVM { get; set; } + + } + /// VMware to AzStackHCI planned failover model custom properties. + internal partial interface IVMwareToAzStackHciplannedFailoverModelCustomPropertiesInternal : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelCustomPropertiesInternal + { + /// Gets or sets a value indicating whether VM needs to be shut down. + bool ShutdownSourceVM { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciplannedFailoverModelCustomProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciplannedFailoverModelCustomProperties.json.cs new file mode 100644 index 000000000000..dc388ba651ef --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciplannedFailoverModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// VMware to AzStackHCI planned failover model custom properties. + public partial class VMwareToAzStackHciplannedFailoverModelCustomProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciplannedFailoverModelCustomProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciplannedFailoverModelCustomProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciplannedFailoverModelCustomProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new VMwareToAzStackHciplannedFailoverModelCustomProperties(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __plannedFailoverModelCustomProperties?.ToJson(container, serializationMode); + AddIf( (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonBoolean(this._shutdownSourceVM), "shutdownSourceVM" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal VMwareToAzStackHciplannedFailoverModelCustomProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __plannedFailoverModelCustomProperties = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PlannedFailoverModelCustomProperties(json); + {_shutdownSourceVM = If( json?.PropertyT("shutdownSourceVM"), out var __jsonShutdownSourceVM) ? (bool)__jsonShutdownSourceVM : ShutdownSourceVM;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcipolicyModelCustomProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcipolicyModelCustomProperties.PowerShell.cs new file mode 100644 index 000000000000..67ef53a2dd48 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcipolicyModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// VMware To AzStackHCI Policy model custom properties. + [System.ComponentModel.TypeConverter(typeof(VMwareToAzStackHcipolicyModelCustomPropertiesTypeConverter))] + public partial class VMwareToAzStackHcipolicyModelCustomProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcipolicyModelCustomProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMwareToAzStackHcipolicyModelCustomProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcipolicyModelCustomProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMwareToAzStackHcipolicyModelCustomProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from + /// a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcipolicyModelCustomProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMwareToAzStackHcipolicyModelCustomProperties(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.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcipolicyModelCustomPropertiesInternal)this).RecoveryPointHistoryInMinute = (int) content.GetValueForProperty("RecoveryPointHistoryInMinute",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcipolicyModelCustomPropertiesInternal)this).RecoveryPointHistoryInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("CrashConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcipolicyModelCustomPropertiesInternal)this).CrashConsistentFrequencyInMinute = (int) content.GetValueForProperty("CrashConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcipolicyModelCustomPropertiesInternal)this).CrashConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AppConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcipolicyModelCustomPropertiesInternal)this).AppConsistentFrequencyInMinute = (int) content.GetValueForProperty("AppConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcipolicyModelCustomPropertiesInternal)this).AppConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCustomPropertiesInternal)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 VMwareToAzStackHcipolicyModelCustomProperties(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.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcipolicyModelCustomPropertiesInternal)this).RecoveryPointHistoryInMinute = (int) content.GetValueForProperty("RecoveryPointHistoryInMinute",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcipolicyModelCustomPropertiesInternal)this).RecoveryPointHistoryInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("CrashConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcipolicyModelCustomPropertiesInternal)this).CrashConsistentFrequencyInMinute = (int) content.GetValueForProperty("CrashConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcipolicyModelCustomPropertiesInternal)this).CrashConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("AppConsistentFrequencyInMinute")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcipolicyModelCustomPropertiesInternal)this).AppConsistentFrequencyInMinute = (int) content.GetValueForProperty("AppConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcipolicyModelCustomPropertiesInternal)this).AppConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCustomPropertiesInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// VMware To AzStackHCI Policy model custom properties. + [System.ComponentModel.TypeConverter(typeof(VMwareToAzStackHcipolicyModelCustomPropertiesTypeConverter))] + public partial interface IVMwareToAzStackHcipolicyModelCustomProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcipolicyModelCustomProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcipolicyModelCustomProperties.TypeConverter.cs new file mode 100644 index 000000000000..e4e8e988bebe --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcipolicyModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMwareToAzStackHcipolicyModelCustomPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, + /// otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcipolicyModelCustomProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcipolicyModelCustomProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMwareToAzStackHcipolicyModelCustomProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMwareToAzStackHcipolicyModelCustomProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMwareToAzStackHcipolicyModelCustomProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcipolicyModelCustomProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcipolicyModelCustomProperties.cs new file mode 100644 index 000000000000..ab1dfb9a3631 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcipolicyModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// VMware To AzStackHCI Policy model custom properties. + public partial class VMwareToAzStackHcipolicyModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcipolicyModelCustomProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcipolicyModelCustomPropertiesInternal, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCustomProperties __policyModelCustomProperties = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PolicyModelCustomProperties(); + + /// Backing field for property. + private int _appConsistentFrequencyInMinute; + + /// Gets or sets the app consistent snapshot frequency (in minutes). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public int AppConsistentFrequencyInMinute { get => this._appConsistentFrequencyInMinute; set => this._appConsistentFrequencyInMinute = value; } + + /// Backing field for property. + private int _crashConsistentFrequencyInMinute; + + /// Gets or sets the crash consistent snapshot frequency (in minutes). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public int CrashConsistentFrequencyInMinute { get => this._crashConsistentFrequencyInMinute; set => this._crashConsistentFrequencyInMinute = value; } + + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCustomPropertiesInternal)__policyModelCustomProperties).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCustomPropertiesInternal)__policyModelCustomProperties).InstanceType = value ; } + + /// Backing field for property. + private int _recoveryPointHistoryInMinute; + + /// + /// Gets or sets the duration in minutes until which the recovery points need to be + /// stored. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public int RecoveryPointHistoryInMinute { get => this._recoveryPointHistoryInMinute; set => this._recoveryPointHistoryInMinute = value; } + + /// + /// Creates an new instance. + /// + public VMwareToAzStackHcipolicyModelCustomProperties() + { + + } + + /// 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.Migrate.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__policyModelCustomProperties), __policyModelCustomProperties); + await eventListener.AssertObjectIsValid(nameof(__policyModelCustomProperties), __policyModelCustomProperties); + } + } + /// VMware To AzStackHCI Policy model custom properties. + public partial interface IVMwareToAzStackHcipolicyModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCustomProperties + { + /// Gets or sets the app consistent snapshot frequency (in minutes). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the app consistent snapshot frequency (in minutes).", + SerializedName = @"appConsistentFrequencyInMinutes", + PossibleTypes = new [] { typeof(int) })] + int AppConsistentFrequencyInMinute { get; set; } + /// Gets or sets the crash consistent snapshot frequency (in minutes). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the crash consistent snapshot frequency (in minutes).", + SerializedName = @"crashConsistentFrequencyInMinutes", + PossibleTypes = new [] { typeof(int) })] + int CrashConsistentFrequencyInMinute { get; set; } + /// + /// Gets or sets the duration in minutes until which the recovery points need to be + /// stored. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the duration in minutes until which the recovery points need to be + stored.", + SerializedName = @"recoveryPointHistoryInMinutes", + PossibleTypes = new [] { typeof(int) })] + int RecoveryPointHistoryInMinute { get; set; } + + } + /// VMware To AzStackHCI Policy model custom properties. + internal partial interface IVMwareToAzStackHcipolicyModelCustomPropertiesInternal : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelCustomPropertiesInternal + { + /// Gets or sets the app consistent snapshot frequency (in minutes). + int AppConsistentFrequencyInMinute { get; set; } + /// Gets or sets the crash consistent snapshot frequency (in minutes). + int CrashConsistentFrequencyInMinute { get; set; } + /// + /// Gets or sets 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/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcipolicyModelCustomProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcipolicyModelCustomProperties.json.cs new file mode 100644 index 000000000000..cc9f0aa830bc --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcipolicyModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// VMware To AzStackHCI Policy model custom properties. + public partial class VMwareToAzStackHcipolicyModelCustomProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcipolicyModelCustomProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcipolicyModelCustomProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcipolicyModelCustomProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new VMwareToAzStackHcipolicyModelCustomProperties(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __policyModelCustomProperties?.ToJson(container, serializationMode); + AddIf( (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNumber(this._recoveryPointHistoryInMinute), "recoveryPointHistoryInMinutes" ,container.Add ); + AddIf( (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNumber(this._crashConsistentFrequencyInMinute), "crashConsistentFrequencyInMinutes" ,container.Add ); + AddIf( (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNumber(this._appConsistentFrequencyInMinute), "appConsistentFrequencyInMinutes" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal VMwareToAzStackHcipolicyModelCustomProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __policyModelCustomProperties = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PolicyModelCustomProperties(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/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciprotectedDiskProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciprotectedDiskProperties.PowerShell.cs new file mode 100644 index 000000000000..5a40bd47f76e --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciprotectedDiskProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// VMwareToAzStackHCI protected disk properties. + [System.ComponentModel.TypeConverter(typeof(VMwareToAzStackHciprotectedDiskPropertiesTypeConverter))] + public partial class VMwareToAzStackHciprotectedDiskProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMwareToAzStackHciprotectedDiskProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMwareToAzStackHciprotectedDiskProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMwareToAzStackHciprotectedDiskProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("StorageContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal)this).StorageContainerId = (string) content.GetValueForProperty("StorageContainerId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal)this).StorageContainerId, global::System.Convert.ToString); + } + if (content.Contains("StorageContainerLocalPath")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal)this).StorageContainerLocalPath = (string) content.GetValueForProperty("StorageContainerLocalPath",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal)this).StorageContainerLocalPath, global::System.Convert.ToString); + } + if (content.Contains("SourceDiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal)this).SourceDiskId = (string) content.GetValueForProperty("SourceDiskId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal)this).SourceDiskId, global::System.Convert.ToString); + } + if (content.Contains("SourceDiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal)this).SourceDiskName = (string) content.GetValueForProperty("SourceDiskName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal)this).SourceDiskName, global::System.Convert.ToString); + } + if (content.Contains("SeedDiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal)this).SeedDiskName = (string) content.GetValueForProperty("SeedDiskName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal)this).SeedDiskName, global::System.Convert.ToString); + } + if (content.Contains("TestMigrateDiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal)this).TestMigrateDiskName = (string) content.GetValueForProperty("TestMigrateDiskName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal)this).TestMigrateDiskName, global::System.Convert.ToString); + } + if (content.Contains("MigrateDiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal)this).MigrateDiskName = (string) content.GetValueForProperty("MigrateDiskName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal)this).MigrateDiskName, global::System.Convert.ToString); + } + if (content.Contains("IsOSDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal)this).IsOSDisk = (bool?) content.GetValueForProperty("IsOSDisk",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal)this).IsOSDisk, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("CapacityInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal)this).CapacityInByte = (long?) content.GetValueForProperty("CapacityInByte",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal)this).CapacityInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("IsDynamic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal)this).IsDynamic = (bool?) content.GetValueForProperty("IsDynamic",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal)this).IsDynamic, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("DiskType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal)this).DiskType = (string) content.GetValueForProperty("DiskType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal)this).DiskType, global::System.Convert.ToString); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VMwareToAzStackHciprotectedDiskProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("StorageContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal)this).StorageContainerId = (string) content.GetValueForProperty("StorageContainerId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal)this).StorageContainerId, global::System.Convert.ToString); + } + if (content.Contains("StorageContainerLocalPath")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal)this).StorageContainerLocalPath = (string) content.GetValueForProperty("StorageContainerLocalPath",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal)this).StorageContainerLocalPath, global::System.Convert.ToString); + } + if (content.Contains("SourceDiskId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal)this).SourceDiskId = (string) content.GetValueForProperty("SourceDiskId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal)this).SourceDiskId, global::System.Convert.ToString); + } + if (content.Contains("SourceDiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal)this).SourceDiskName = (string) content.GetValueForProperty("SourceDiskName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal)this).SourceDiskName, global::System.Convert.ToString); + } + if (content.Contains("SeedDiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal)this).SeedDiskName = (string) content.GetValueForProperty("SeedDiskName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal)this).SeedDiskName, global::System.Convert.ToString); + } + if (content.Contains("TestMigrateDiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal)this).TestMigrateDiskName = (string) content.GetValueForProperty("TestMigrateDiskName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal)this).TestMigrateDiskName, global::System.Convert.ToString); + } + if (content.Contains("MigrateDiskName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal)this).MigrateDiskName = (string) content.GetValueForProperty("MigrateDiskName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal)this).MigrateDiskName, global::System.Convert.ToString); + } + if (content.Contains("IsOSDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal)this).IsOSDisk = (bool?) content.GetValueForProperty("IsOSDisk",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal)this).IsOSDisk, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("CapacityInByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal)this).CapacityInByte = (long?) content.GetValueForProperty("CapacityInByte",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal)this).CapacityInByte, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("IsDynamic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal)this).IsDynamic = (bool?) content.GetValueForProperty("IsDynamic",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal)this).IsDynamic, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("DiskType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal)this).DiskType = (string) content.GetValueForProperty("DiskType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal)this).DiskType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// VMwareToAzStackHCI protected disk properties. + [System.ComponentModel.TypeConverter(typeof(VMwareToAzStackHciprotectedDiskPropertiesTypeConverter))] + public partial interface IVMwareToAzStackHciprotectedDiskProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciprotectedDiskProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciprotectedDiskProperties.TypeConverter.cs new file mode 100644 index 000000000000..77cae7737934 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciprotectedDiskProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMwareToAzStackHciprotectedDiskPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMwareToAzStackHciprotectedDiskProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMwareToAzStackHciprotectedDiskProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMwareToAzStackHciprotectedDiskProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciprotectedDiskProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciprotectedDiskProperties.cs new file mode 100644 index 000000000000..239d27eff2bc --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciprotectedDiskProperties.cs @@ -0,0 +1,266 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// VMwareToAzStackHCI protected disk properties. + public partial class VMwareToAzStackHciprotectedDiskProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal + { + + /// Backing field for property. + private long? _capacityInByte; + + /// Gets or sets the disk capacity in bytes. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public long? CapacityInByte { get => this._capacityInByte; } + + /// Backing field for property. + private string _diskType; + + /// Gets or sets the disk type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string DiskType { get => this._diskType; } + + /// Backing field for property. + private bool? _isDynamic; + + /// + /// Gets or sets a value indicating whether dynamic sizing is enabled on the virtual hard + /// disk. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public bool? IsDynamic { get => this._isDynamic; } + + /// Backing field for property. + private bool? _isOSDisk; + + /// Gets or sets a value indicating whether the disk is the OS disk. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public bool? IsOSDisk { get => this._isOSDisk; } + + /// Internal Acessors for CapacityInByte + long? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal.CapacityInByte { get => this._capacityInByte; set { {_capacityInByte = value;} } } + + /// Internal Acessors for DiskType + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal.DiskType { get => this._diskType; set { {_diskType = value;} } } + + /// Internal Acessors for IsDynamic + bool? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal.IsDynamic { get => this._isDynamic; set { {_isDynamic = value;} } } + + /// Internal Acessors for IsOSDisk + bool? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal.IsOSDisk { get => this._isOSDisk; set { {_isOSDisk = value;} } } + + /// Internal Acessors for MigrateDiskName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal.MigrateDiskName { get => this._migrateDiskName; set { {_migrateDiskName = value;} } } + + /// Internal Acessors for SeedDiskName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal.SeedDiskName { get => this._seedDiskName; set { {_seedDiskName = value;} } } + + /// Internal Acessors for SourceDiskId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal.SourceDiskId { get => this._sourceDiskId; set { {_sourceDiskId = value;} } } + + /// Internal Acessors for SourceDiskName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal.SourceDiskName { get => this._sourceDiskName; set { {_sourceDiskName = value;} } } + + /// Internal Acessors for StorageContainerId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal.StorageContainerId { get => this._storageContainerId; set { {_storageContainerId = value;} } } + + /// Internal Acessors for StorageContainerLocalPath + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal.StorageContainerLocalPath { get => this._storageContainerLocalPath; set { {_storageContainerLocalPath = value;} } } + + /// Internal Acessors for TestMigrateDiskName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskPropertiesInternal.TestMigrateDiskName { get => this._testMigrateDiskName; set { {_testMigrateDiskName = value;} } } + + /// Backing field for property. + private string _migrateDiskName; + + /// Gets or sets the failover clone disk. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string MigrateDiskName { get => this._migrateDiskName; } + + /// Backing field for property. + private string _seedDiskName; + + /// Gets or sets the seed disk name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string SeedDiskName { get => this._seedDiskName; } + + /// Backing field for property. + private string _sourceDiskId; + + /// Gets or sets the source disk Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string SourceDiskId { get => this._sourceDiskId; } + + /// Backing field for property. + private string _sourceDiskName; + + /// Gets or sets the source disk Name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string SourceDiskName { get => this._sourceDiskName; } + + /// Backing field for property. + private string _storageContainerId; + + /// Gets or sets the ARM Id of the storage container. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string StorageContainerId { get => this._storageContainerId; } + + /// Backing field for property. + private string _storageContainerLocalPath; + + /// Gets or sets the local path of the storage container. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string StorageContainerLocalPath { get => this._storageContainerLocalPath; } + + /// Backing field for property. + private string _testMigrateDiskName; + + /// Gets or sets the test failover clone disk. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TestMigrateDiskName { get => this._testMigrateDiskName; } + + /// + /// Creates an new instance. + /// + public VMwareToAzStackHciprotectedDiskProperties() + { + + } + } + /// VMwareToAzStackHCI protected disk properties. + public partial interface IVMwareToAzStackHciprotectedDiskProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the disk capacity in bytes. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the disk capacity in bytes.", + SerializedName = @"capacityInBytes", + PossibleTypes = new [] { typeof(long) })] + long? CapacityInByte { get; } + /// Gets or sets the disk type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the disk type.", + SerializedName = @"diskType", + PossibleTypes = new [] { typeof(string) })] + string DiskType { get; } + /// + /// Gets or sets a value indicating whether dynamic sizing is enabled on the virtual hard + /// disk. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets a value indicating whether dynamic sizing is enabled on the virtual hard + disk.", + SerializedName = @"isDynamic", + PossibleTypes = new [] { typeof(bool) })] + bool? IsDynamic { get; } + /// Gets or sets a value indicating whether the disk is the OS disk. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets a value indicating whether the disk is the OS disk.", + SerializedName = @"isOsDisk", + PossibleTypes = new [] { typeof(bool) })] + bool? IsOSDisk { get; } + /// Gets or sets the failover clone disk. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the failover clone disk.", + SerializedName = @"migrateDiskName", + PossibleTypes = new [] { typeof(string) })] + string MigrateDiskName { get; } + /// Gets or sets the seed disk name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the seed disk name.", + SerializedName = @"seedDiskName", + PossibleTypes = new [] { typeof(string) })] + string SeedDiskName { get; } + /// Gets or sets the source disk Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the source disk Id.", + SerializedName = @"sourceDiskId", + PossibleTypes = new [] { typeof(string) })] + string SourceDiskId { get; } + /// Gets or sets the source disk Name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the source disk Name.", + SerializedName = @"sourceDiskName", + PossibleTypes = new [] { typeof(string) })] + string SourceDiskName { get; } + /// Gets or sets the ARM Id of the storage container. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the ARM Id of the storage container.", + SerializedName = @"storageContainerId", + PossibleTypes = new [] { typeof(string) })] + string StorageContainerId { get; } + /// Gets or sets the local path of the storage container. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the local path of the storage container.", + SerializedName = @"storageContainerLocalPath", + PossibleTypes = new [] { typeof(string) })] + string StorageContainerLocalPath { get; } + /// Gets or sets the test failover clone disk. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the test failover clone disk.", + SerializedName = @"testMigrateDiskName", + PossibleTypes = new [] { typeof(string) })] + string TestMigrateDiskName { get; } + + } + /// VMwareToAzStackHCI protected disk properties. + internal partial interface IVMwareToAzStackHciprotectedDiskPropertiesInternal + + { + /// Gets or sets the disk capacity in bytes. + long? CapacityInByte { get; set; } + /// Gets or sets the disk type. + string DiskType { get; set; } + /// + /// Gets or sets a value indicating whether dynamic sizing is enabled on the virtual hard + /// disk. + /// + bool? IsDynamic { get; set; } + /// Gets or sets a value indicating whether the disk is the OS disk. + bool? IsOSDisk { get; set; } + /// Gets or sets the failover clone disk. + string MigrateDiskName { get; set; } + /// Gets or sets the seed disk name. + string SeedDiskName { get; set; } + /// Gets or sets the source disk Id. + string SourceDiskId { get; set; } + /// Gets or sets the source disk Name. + string SourceDiskName { get; set; } + /// Gets or sets the ARM Id of the storage container. + string StorageContainerId { get; set; } + /// Gets or sets the local path of the storage container. + string StorageContainerLocalPath { get; set; } + /// Gets or sets the test failover clone disk. + string TestMigrateDiskName { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciprotectedDiskProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciprotectedDiskProperties.json.cs new file mode 100644 index 000000000000..54218b2c93fa --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciprotectedDiskProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// VMwareToAzStackHCI protected disk properties. + public partial class VMwareToAzStackHciprotectedDiskProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new VMwareToAzStackHciprotectedDiskProperties(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._storageContainerId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._storageContainerId.ToString()) : null, "storageContainerId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._storageContainerLocalPath)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._storageContainerLocalPath.ToString()) : null, "storageContainerLocalPath" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._sourceDiskId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._sourceDiskId.ToString()) : null, "sourceDiskId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._sourceDiskName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._sourceDiskName.ToString()) : null, "sourceDiskName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._seedDiskName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._seedDiskName.ToString()) : null, "seedDiskName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._testMigrateDiskName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._testMigrateDiskName.ToString()) : null, "testMigrateDiskName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._migrateDiskName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._migrateDiskName.ToString()) : null, "migrateDiskName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._isOSDisk ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonBoolean((bool)this._isOSDisk) : null, "isOsDisk" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._capacityInByte ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNumber((long)this._capacityInByte) : null, "capacityInBytes" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._isDynamic ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonBoolean((bool)this._isDynamic) : null, "isDynamic" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._diskType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._diskType.ToString()) : null, "diskType" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal VMwareToAzStackHciprotectedDiskProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_storageContainerId = If( json?.PropertyT("storageContainerId"), out var __jsonStorageContainerId) ? (string)__jsonStorageContainerId : (string)StorageContainerId;} + {_storageContainerLocalPath = If( json?.PropertyT("storageContainerLocalPath"), out var __jsonStorageContainerLocalPath) ? (string)__jsonStorageContainerLocalPath : (string)StorageContainerLocalPath;} + {_sourceDiskId = If( json?.PropertyT("sourceDiskId"), out var __jsonSourceDiskId) ? (string)__jsonSourceDiskId : (string)SourceDiskId;} + {_sourceDiskName = If( json?.PropertyT("sourceDiskName"), out var __jsonSourceDiskName) ? (string)__jsonSourceDiskName : (string)SourceDiskName;} + {_seedDiskName = If( json?.PropertyT("seedDiskName"), out var __jsonSeedDiskName) ? (string)__jsonSeedDiskName : (string)SeedDiskName;} + {_testMigrateDiskName = If( json?.PropertyT("testMigrateDiskName"), out var __jsonTestMigrateDiskName) ? (string)__jsonTestMigrateDiskName : (string)TestMigrateDiskName;} + {_migrateDiskName = If( json?.PropertyT("migrateDiskName"), out var __jsonMigrateDiskName) ? (string)__jsonMigrateDiskName : (string)MigrateDiskName;} + {_isOSDisk = If( json?.PropertyT("isOsDisk"), out var __jsonIsOSDisk) ? (bool?)__jsonIsOSDisk : IsOSDisk;} + {_capacityInByte = If( json?.PropertyT("capacityInBytes"), out var __jsonCapacityInBytes) ? (long?)__jsonCapacityInBytes : CapacityInByte;} + {_isDynamic = If( json?.PropertyT("isDynamic"), out var __jsonIsDynamic) ? (bool?)__jsonIsDynamic : IsDynamic;} + {_diskType = If( json?.PropertyT("diskType"), out var __jsonDiskType) ? (string)__jsonDiskType : (string)DiskType;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciprotectedItemModelCustomProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciprotectedItemModelCustomProperties.PowerShell.cs new file mode 100644 index 000000000000..6cf9beb30c0b --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciprotectedItemModelCustomProperties.PowerShell.cs @@ -0,0 +1,517 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// VMware to AzStackHCI Protected item model custom properties. + [System.ComponentModel.TypeConverter(typeof(VMwareToAzStackHciprotectedItemModelCustomPropertiesTypeConverter))] + public partial class VMwareToAzStackHciprotectedItemModelCustomProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMwareToAzStackHciprotectedItemModelCustomProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMwareToAzStackHciprotectedItemModelCustomProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content + /// from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMwareToAzStackHciprotectedItemModelCustomProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ActiveLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ActiveLocation = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectedItemActiveLocation?) content.GetValueForProperty("ActiveLocation",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ActiveLocation, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectedItemActiveLocation.CreateFrom); + } + if (content.Contains("TargetHciClusterId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetHciClusterId = (string) content.GetValueForProperty("TargetHciClusterId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetHciClusterId, global::System.Convert.ToString); + } + if (content.Contains("TargetArcClusterCustomLocationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetArcClusterCustomLocationId = (string) content.GetValueForProperty("TargetArcClusterCustomLocationId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetArcClusterCustomLocationId, global::System.Convert.ToString); + } + if (content.Contains("TargetAzStackHciClusterName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetAzStackHciClusterName = (string) content.GetValueForProperty("TargetAzStackHciClusterName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetAzStackHciClusterName, global::System.Convert.ToString); + } + if (content.Contains("StorageContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).StorageContainerId = (string) content.GetValueForProperty("StorageContainerId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).StorageContainerId, global::System.Convert.ToString); + } + if (content.Contains("TargetResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetResourceGroupId = (string) content.GetValueForProperty("TargetResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("TargetLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetLocation = (string) content.GetValueForProperty("TargetLocation",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetLocation, global::System.Convert.ToString); + } + if (content.Contains("CustomLocationRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).CustomLocationRegion = (string) content.GetValueForProperty("CustomLocationRegion",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).CustomLocationRegion, global::System.Convert.ToString); + } + if (content.Contains("DisksToInclude")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).DisksToInclude = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcidiskInput[]) content.GetValueForProperty("DisksToInclude",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).DisksToInclude, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareToAzStackHcidiskInputTypeConverter.ConvertFrom)); + } + if (content.Contains("NicsToInclude")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).NicsToInclude = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcinicInput[]) content.GetValueForProperty("NicsToInclude",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).NicsToInclude, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareToAzStackHcinicInputTypeConverter.ConvertFrom)); + } + if (content.Contains("ProtectedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ProtectedDisk = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskProperties[]) content.GetValueForProperty("ProtectedDisk",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ProtectedDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareToAzStackHciprotectedDiskPropertiesTypeConverter.ConvertFrom)); + } + if (content.Contains("ProtectedNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ProtectedNic = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicProperties[]) content.GetValueForProperty("ProtectedNic",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ProtectedNic, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareToAzStackHciprotectedNicPropertiesTypeConverter.ConvertFrom)); + } + if (content.Contains("TargetVMBiosId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetVMBiosId = (string) content.GetValueForProperty("TargetVMBiosId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetVMBiosId, global::System.Convert.ToString); + } + if (content.Contains("TargetVMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetVMName = (string) content.GetValueForProperty("TargetVMName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetVMName, global::System.Convert.ToString); + } + if (content.Contains("HyperVGeneration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).HyperVGeneration = (string) content.GetValueForProperty("HyperVGeneration",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).HyperVGeneration, global::System.Convert.ToString); + } + if (content.Contains("TargetNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetNetworkId = (string) content.GetValueForProperty("TargetNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetNetworkId, global::System.Convert.ToString); + } + if (content.Contains("TestNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TestNetworkId = (string) content.GetValueForProperty("TestNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TestNetworkId, global::System.Convert.ToString); + } + if (content.Contains("TargetCpuCore")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetCpuCore = (int?) content.GetValueForProperty("TargetCpuCore",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetCpuCore, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("IsDynamicRam")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).IsDynamicRam = (bool?) content.GetValueForProperty("IsDynamicRam",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).IsDynamicRam, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("DynamicMemoryConfig")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).DynamicMemoryConfig = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemDynamicMemoryConfig) content.GetValueForProperty("DynamicMemoryConfig",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).DynamicMemoryConfig, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemDynamicMemoryConfigTypeConverter.ConvertFrom); + } + if (content.Contains("TargetMemoryInMegaByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetMemoryInMegaByte = (int?) content.GetValueForProperty("TargetMemoryInMegaByte",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetMemoryInMegaByte, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).OSType, global::System.Convert.ToString); + } + if (content.Contains("OSName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).OSName = (string) content.GetValueForProperty("OSName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).OSName, global::System.Convert.ToString); + } + if (content.Contains("FirmwareType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).FirmwareType = (string) content.GetValueForProperty("FirmwareType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).FirmwareType, global::System.Convert.ToString); + } + if (content.Contains("FabricDiscoveryMachineId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).FabricDiscoveryMachineId = (string) content.GetValueForProperty("FabricDiscoveryMachineId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).FabricDiscoveryMachineId, global::System.Convert.ToString); + } + if (content.Contains("SourceVMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).SourceVMName = (string) content.GetValueForProperty("SourceVMName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).SourceVMName, global::System.Convert.ToString); + } + if (content.Contains("SourceCpuCore")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).SourceCpuCore = (int?) content.GetValueForProperty("SourceCpuCore",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).SourceCpuCore, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("SourceMemoryInMegaByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).SourceMemoryInMegaByte = (double?) content.GetValueForProperty("SourceMemoryInMegaByte",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).SourceMemoryInMegaByte, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("RunAsAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).RunAsAccountId = (string) content.GetValueForProperty("RunAsAccountId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).RunAsAccountId, global::System.Convert.ToString); + } + if (content.Contains("SourceDraName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).SourceDraName = (string) content.GetValueForProperty("SourceDraName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).SourceDraName, global::System.Convert.ToString); + } + if (content.Contains("TargetDraName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetDraName = (string) content.GetValueForProperty("TargetDraName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetDraName, global::System.Convert.ToString); + } + if (content.Contains("SourceApplianceName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).SourceApplianceName = (string) content.GetValueForProperty("SourceApplianceName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).SourceApplianceName, global::System.Convert.ToString); + } + if (content.Contains("TargetApplianceName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetApplianceName = (string) content.GetValueForProperty("TargetApplianceName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetApplianceName, global::System.Convert.ToString); + } + if (content.Contains("FailoverRecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).FailoverRecoveryPointId = (string) content.GetValueForProperty("FailoverRecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).FailoverRecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("LastRecoveryPointReceived")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).LastRecoveryPointReceived = (global::System.DateTime?) content.GetValueForProperty("LastRecoveryPointReceived",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)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.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).LastRecoveryPointId = (string) content.GetValueForProperty("LastRecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).LastRecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("InitialReplicationProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).InitialReplicationProgressPercentage = (int?) content.GetValueForProperty("InitialReplicationProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).InitialReplicationProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("MigrationProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).MigrationProgressPercentage = (int?) content.GetValueForProperty("MigrationProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).MigrationProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ResumeProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ResumeProgressPercentage = (int?) content.GetValueForProperty("ResumeProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ResumeProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ResyncProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ResyncProgressPercentage = (int?) content.GetValueForProperty("ResyncProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ResyncProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ResyncRetryCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ResyncRetryCount = (long?) content.GetValueForProperty("ResyncRetryCount",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ResyncRetryCount, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ResyncRequired")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ResyncRequired = (bool?) content.GetValueForProperty("ResyncRequired",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ResyncRequired, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ResyncState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ResyncState = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMwareToAzureMigrateResyncState?) content.GetValueForProperty("ResyncState",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ResyncState, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMwareToAzureMigrateResyncState.CreateFrom); + } + if (content.Contains("PerformAutoResync")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).PerformAutoResync = (bool?) content.GetValueForProperty("PerformAutoResync",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).PerformAutoResync, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ResumeRetryCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ResumeRetryCount = (long?) content.GetValueForProperty("ResumeRetryCount",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ResumeRetryCount, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("LastReplicationUpdateTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).LastReplicationUpdateTime = (global::System.DateTime?) content.GetValueForProperty("LastReplicationUpdateTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).LastReplicationUpdateTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCustomPropertiesInternal)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 VMwareToAzStackHciprotectedItemModelCustomProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ActiveLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ActiveLocation = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectedItemActiveLocation?) content.GetValueForProperty("ActiveLocation",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ActiveLocation, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectedItemActiveLocation.CreateFrom); + } + if (content.Contains("TargetHciClusterId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetHciClusterId = (string) content.GetValueForProperty("TargetHciClusterId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetHciClusterId, global::System.Convert.ToString); + } + if (content.Contains("TargetArcClusterCustomLocationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetArcClusterCustomLocationId = (string) content.GetValueForProperty("TargetArcClusterCustomLocationId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetArcClusterCustomLocationId, global::System.Convert.ToString); + } + if (content.Contains("TargetAzStackHciClusterName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetAzStackHciClusterName = (string) content.GetValueForProperty("TargetAzStackHciClusterName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetAzStackHciClusterName, global::System.Convert.ToString); + } + if (content.Contains("StorageContainerId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).StorageContainerId = (string) content.GetValueForProperty("StorageContainerId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).StorageContainerId, global::System.Convert.ToString); + } + if (content.Contains("TargetResourceGroupId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetResourceGroupId = (string) content.GetValueForProperty("TargetResourceGroupId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetResourceGroupId, global::System.Convert.ToString); + } + if (content.Contains("TargetLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetLocation = (string) content.GetValueForProperty("TargetLocation",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetLocation, global::System.Convert.ToString); + } + if (content.Contains("CustomLocationRegion")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).CustomLocationRegion = (string) content.GetValueForProperty("CustomLocationRegion",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).CustomLocationRegion, global::System.Convert.ToString); + } + if (content.Contains("DisksToInclude")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).DisksToInclude = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcidiskInput[]) content.GetValueForProperty("DisksToInclude",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).DisksToInclude, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareToAzStackHcidiskInputTypeConverter.ConvertFrom)); + } + if (content.Contains("NicsToInclude")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).NicsToInclude = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcinicInput[]) content.GetValueForProperty("NicsToInclude",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).NicsToInclude, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareToAzStackHcinicInputTypeConverter.ConvertFrom)); + } + if (content.Contains("ProtectedDisk")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ProtectedDisk = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskProperties[]) content.GetValueForProperty("ProtectedDisk",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ProtectedDisk, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareToAzStackHciprotectedDiskPropertiesTypeConverter.ConvertFrom)); + } + if (content.Contains("ProtectedNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ProtectedNic = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicProperties[]) content.GetValueForProperty("ProtectedNic",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ProtectedNic, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareToAzStackHciprotectedNicPropertiesTypeConverter.ConvertFrom)); + } + if (content.Contains("TargetVMBiosId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetVMBiosId = (string) content.GetValueForProperty("TargetVMBiosId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetVMBiosId, global::System.Convert.ToString); + } + if (content.Contains("TargetVMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetVMName = (string) content.GetValueForProperty("TargetVMName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetVMName, global::System.Convert.ToString); + } + if (content.Contains("HyperVGeneration")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).HyperVGeneration = (string) content.GetValueForProperty("HyperVGeneration",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).HyperVGeneration, global::System.Convert.ToString); + } + if (content.Contains("TargetNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetNetworkId = (string) content.GetValueForProperty("TargetNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetNetworkId, global::System.Convert.ToString); + } + if (content.Contains("TestNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TestNetworkId = (string) content.GetValueForProperty("TestNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TestNetworkId, global::System.Convert.ToString); + } + if (content.Contains("TargetCpuCore")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetCpuCore = (int?) content.GetValueForProperty("TargetCpuCore",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetCpuCore, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("IsDynamicRam")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).IsDynamicRam = (bool?) content.GetValueForProperty("IsDynamicRam",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).IsDynamicRam, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("DynamicMemoryConfig")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).DynamicMemoryConfig = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemDynamicMemoryConfig) content.GetValueForProperty("DynamicMemoryConfig",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).DynamicMemoryConfig, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemDynamicMemoryConfigTypeConverter.ConvertFrom); + } + if (content.Contains("TargetMemoryInMegaByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetMemoryInMegaByte = (int?) content.GetValueForProperty("TargetMemoryInMegaByte",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetMemoryInMegaByte, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("OSType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).OSType = (string) content.GetValueForProperty("OSType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).OSType, global::System.Convert.ToString); + } + if (content.Contains("OSName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).OSName = (string) content.GetValueForProperty("OSName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).OSName, global::System.Convert.ToString); + } + if (content.Contains("FirmwareType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).FirmwareType = (string) content.GetValueForProperty("FirmwareType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).FirmwareType, global::System.Convert.ToString); + } + if (content.Contains("FabricDiscoveryMachineId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).FabricDiscoveryMachineId = (string) content.GetValueForProperty("FabricDiscoveryMachineId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).FabricDiscoveryMachineId, global::System.Convert.ToString); + } + if (content.Contains("SourceVMName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).SourceVMName = (string) content.GetValueForProperty("SourceVMName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).SourceVMName, global::System.Convert.ToString); + } + if (content.Contains("SourceCpuCore")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).SourceCpuCore = (int?) content.GetValueForProperty("SourceCpuCore",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).SourceCpuCore, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("SourceMemoryInMegaByte")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).SourceMemoryInMegaByte = (double?) content.GetValueForProperty("SourceMemoryInMegaByte",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).SourceMemoryInMegaByte, (__y)=> (double) global::System.Convert.ChangeType(__y, typeof(double))); + } + if (content.Contains("RunAsAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).RunAsAccountId = (string) content.GetValueForProperty("RunAsAccountId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).RunAsAccountId, global::System.Convert.ToString); + } + if (content.Contains("SourceDraName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).SourceDraName = (string) content.GetValueForProperty("SourceDraName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).SourceDraName, global::System.Convert.ToString); + } + if (content.Contains("TargetDraName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetDraName = (string) content.GetValueForProperty("TargetDraName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetDraName, global::System.Convert.ToString); + } + if (content.Contains("SourceApplianceName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).SourceApplianceName = (string) content.GetValueForProperty("SourceApplianceName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).SourceApplianceName, global::System.Convert.ToString); + } + if (content.Contains("TargetApplianceName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetApplianceName = (string) content.GetValueForProperty("TargetApplianceName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).TargetApplianceName, global::System.Convert.ToString); + } + if (content.Contains("FailoverRecoveryPointId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).FailoverRecoveryPointId = (string) content.GetValueForProperty("FailoverRecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).FailoverRecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("LastRecoveryPointReceived")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).LastRecoveryPointReceived = (global::System.DateTime?) content.GetValueForProperty("LastRecoveryPointReceived",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)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.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).LastRecoveryPointId = (string) content.GetValueForProperty("LastRecoveryPointId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).LastRecoveryPointId, global::System.Convert.ToString); + } + if (content.Contains("InitialReplicationProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).InitialReplicationProgressPercentage = (int?) content.GetValueForProperty("InitialReplicationProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).InitialReplicationProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("MigrationProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).MigrationProgressPercentage = (int?) content.GetValueForProperty("MigrationProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).MigrationProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ResumeProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ResumeProgressPercentage = (int?) content.GetValueForProperty("ResumeProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ResumeProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ResyncProgressPercentage")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ResyncProgressPercentage = (int?) content.GetValueForProperty("ResyncProgressPercentage",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ResyncProgressPercentage, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + } + if (content.Contains("ResyncRetryCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ResyncRetryCount = (long?) content.GetValueForProperty("ResyncRetryCount",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ResyncRetryCount, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("ResyncRequired")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ResyncRequired = (bool?) content.GetValueForProperty("ResyncRequired",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ResyncRequired, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ResyncState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ResyncState = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMwareToAzureMigrateResyncState?) content.GetValueForProperty("ResyncState",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ResyncState, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMwareToAzureMigrateResyncState.CreateFrom); + } + if (content.Contains("PerformAutoResync")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).PerformAutoResync = (bool?) content.GetValueForProperty("PerformAutoResync",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).PerformAutoResync, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("ResumeRetryCount")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ResumeRetryCount = (long?) content.GetValueForProperty("ResumeRetryCount",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).ResumeRetryCount, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + } + if (content.Contains("LastReplicationUpdateTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).LastReplicationUpdateTime = (global::System.DateTime?) content.GetValueForProperty("LastReplicationUpdateTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal)this).LastReplicationUpdateTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCustomPropertiesInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// VMware to AzStackHCI Protected item model custom properties. + [System.ComponentModel.TypeConverter(typeof(VMwareToAzStackHciprotectedItemModelCustomPropertiesTypeConverter))] + public partial interface IVMwareToAzStackHciprotectedItemModelCustomProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciprotectedItemModelCustomProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciprotectedItemModelCustomProperties.TypeConverter.cs new file mode 100644 index 000000000000..393ce3dcaf63 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciprotectedItemModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMwareToAzStackHciprotectedItemModelCustomPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a + /// type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMwareToAzStackHciprotectedItemModelCustomProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMwareToAzStackHciprotectedItemModelCustomProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMwareToAzStackHciprotectedItemModelCustomProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciprotectedItemModelCustomProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciprotectedItemModelCustomProperties.cs new file mode 100644 index 000000000000..9d800f537b94 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciprotectedItemModelCustomProperties.cs @@ -0,0 +1,945 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// VMware to AzStackHCI Protected item model custom properties. + public partial class VMwareToAzStackHciprotectedItemModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCustomProperties __protectedItemModelCustomProperties = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelCustomProperties(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectedItemActiveLocation? _activeLocation; + + /// Gets or sets the location of the protected item. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectedItemActiveLocation? ActiveLocation { get => this._activeLocation; } + + /// Backing field for property. + private string _customLocationRegion; + + /// Gets or sets the location of Azure Arc HCI custom location resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string CustomLocationRegion { get => this._customLocationRegion; set => this._customLocationRegion = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcidiskInput[] _disksToInclude; + + /// Gets or sets the list of disks to replicate. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcidiskInput[] DisksToInclude { get => this._disksToInclude; set => this._disksToInclude = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemDynamicMemoryConfig _dynamicMemoryConfig; + + /// Protected item dynamic memory config. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemDynamicMemoryConfig DynamicMemoryConfig { get => (this._dynamicMemoryConfig = this._dynamicMemoryConfig ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemDynamicMemoryConfig()); set => this._dynamicMemoryConfig = value; } + + /// Backing field for property. + private string _fabricDiscoveryMachineId; + + /// Gets or sets the ARM Id of the discovered machine. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string FabricDiscoveryMachineId { get => this._fabricDiscoveryMachineId; set => this._fabricDiscoveryMachineId = value; } + + /// Backing field for property. + private string _failoverRecoveryPointId; + + /// Gets or sets the recovery point Id to which the VM was failed over. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string FailoverRecoveryPointId { get => this._failoverRecoveryPointId; } + + /// Backing field for property. + private string _firmwareType; + + /// Gets or sets the firmware type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string FirmwareType { get => this._firmwareType; } + + /// Backing field for property. + private string _hyperVGeneration; + + /// + /// Gets or sets the hypervisor generation of the virtual machine possible values are 1,2. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string HyperVGeneration { get => this._hyperVGeneration; set => this._hyperVGeneration = value; } + + /// Backing field for property. + private int? _initialReplicationProgressPercentage; + + /// + /// Gets or sets the initial replication progress percentage. This is calculated based on + /// total bytes processed for all disks in the source VM. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public int? InitialReplicationProgressPercentage { get => this._initialReplicationProgressPercentage; } + + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCustomPropertiesInternal)__protectedItemModelCustomProperties).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCustomPropertiesInternal)__protectedItemModelCustomProperties).InstanceType = value ; } + + /// Backing field for property. + private bool? _isDynamicRam; + + /// Gets or sets a value indicating whether memory is dynamical. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public bool? IsDynamicRam { get => this._isDynamicRam; set => this._isDynamicRam = value; } + + /// Backing field for property. + private string _lastRecoveryPointId; + + /// Gets or sets the last recovery point Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string LastRecoveryPointId { get => this._lastRecoveryPointId; } + + /// Backing field for property. + private global::System.DateTime? _lastRecoveryPointReceived; + + /// Gets or sets the last recovery point received time. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public global::System.DateTime? LastRecoveryPointReceived { get => this._lastRecoveryPointReceived; } + + /// Backing field for property. + private global::System.DateTime? _lastReplicationUpdateTime; + + /// Gets or sets the latest timestamp that replication status is updated. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public global::System.DateTime? LastReplicationUpdateTime { get => this._lastReplicationUpdateTime; } + + /// Internal Acessors for ActiveLocation + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectedItemActiveLocation? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal.ActiveLocation { get => this._activeLocation; set { {_activeLocation = value;} } } + + /// Internal Acessors for FailoverRecoveryPointId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal.FailoverRecoveryPointId { get => this._failoverRecoveryPointId; set { {_failoverRecoveryPointId = value;} } } + + /// Internal Acessors for FirmwareType + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal.FirmwareType { get => this._firmwareType; set { {_firmwareType = value;} } } + + /// Internal Acessors for InitialReplicationProgressPercentage + int? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal.InitialReplicationProgressPercentage { get => this._initialReplicationProgressPercentage; set { {_initialReplicationProgressPercentage = value;} } } + + /// Internal Acessors for LastRecoveryPointId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal.LastRecoveryPointId { get => this._lastRecoveryPointId; set { {_lastRecoveryPointId = value;} } } + + /// Internal Acessors for LastRecoveryPointReceived + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal.LastRecoveryPointReceived { get => this._lastRecoveryPointReceived; set { {_lastRecoveryPointReceived = value;} } } + + /// Internal Acessors for LastReplicationUpdateTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal.LastReplicationUpdateTime { get => this._lastReplicationUpdateTime; set { {_lastReplicationUpdateTime = value;} } } + + /// Internal Acessors for MigrationProgressPercentage + int? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal.MigrationProgressPercentage { get => this._migrationProgressPercentage; set { {_migrationProgressPercentage = value;} } } + + /// Internal Acessors for OSName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal.OSName { get => this._oSName; set { {_oSName = value;} } } + + /// Internal Acessors for OSType + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal.OSType { get => this._oSType; set { {_oSType = value;} } } + + /// Internal Acessors for ProtectedDisk + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskProperties[] Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal.ProtectedDisk { get => this._protectedDisk; set { {_protectedDisk = value;} } } + + /// Internal Acessors for ProtectedNic + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicProperties[] Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal.ProtectedNic { get => this._protectedNic; set { {_protectedNic = value;} } } + + /// Internal Acessors for ResumeProgressPercentage + int? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal.ResumeProgressPercentage { get => this._resumeProgressPercentage; set { {_resumeProgressPercentage = value;} } } + + /// Internal Acessors for ResumeRetryCount + long? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal.ResumeRetryCount { get => this._resumeRetryCount; set { {_resumeRetryCount = value;} } } + + /// Internal Acessors for ResyncProgressPercentage + int? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal.ResyncProgressPercentage { get => this._resyncProgressPercentage; set { {_resyncProgressPercentage = value;} } } + + /// Internal Acessors for ResyncRequired + bool? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal.ResyncRequired { get => this._resyncRequired; set { {_resyncRequired = value;} } } + + /// Internal Acessors for ResyncRetryCount + long? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal.ResyncRetryCount { get => this._resyncRetryCount; set { {_resyncRetryCount = value;} } } + + /// Internal Acessors for ResyncState + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMwareToAzureMigrateResyncState? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal.ResyncState { get => this._resyncState; set { {_resyncState = value;} } } + + /// Internal Acessors for SourceApplianceName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal.SourceApplianceName { get => this._sourceApplianceName; set { {_sourceApplianceName = value;} } } + + /// Internal Acessors for SourceCpuCore + int? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal.SourceCpuCore { get => this._sourceCpuCore; set { {_sourceCpuCore = value;} } } + + /// Internal Acessors for SourceMemoryInMegaByte + double? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal.SourceMemoryInMegaByte { get => this._sourceMemoryInMegaByte; set { {_sourceMemoryInMegaByte = value;} } } + + /// Internal Acessors for SourceVMName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal.SourceVMName { get => this._sourceVMName; set { {_sourceVMName = value;} } } + + /// Internal Acessors for TargetApplianceName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal.TargetApplianceName { get => this._targetApplianceName; set { {_targetApplianceName = value;} } } + + /// Internal Acessors for TargetAzStackHciClusterName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal.TargetAzStackHciClusterName { get => this._targetAzStackHciClusterName; set { {_targetAzStackHciClusterName = value;} } } + + /// Internal Acessors for TargetLocation + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal.TargetLocation { get => this._targetLocation; set { {_targetLocation = value;} } } + + /// Internal Acessors for TargetVMBiosId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal.TargetVMBiosId { get => this._targetVMBiosId; set { {_targetVMBiosId = value;} } } + + /// Backing field for property. + private int? _migrationProgressPercentage; + + /// Gets or sets the migration progress percentage. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public int? MigrationProgressPercentage { get => this._migrationProgressPercentage; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcinicInput[] _nicsToInclude; + + /// Gets or sets the list of VM NIC to replicate. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcinicInput[] NicsToInclude { get => this._nicsToInclude; set => this._nicsToInclude = value; } + + /// Backing field for property. + private string _oSName; + + /// Gets or sets the name of the OS. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string OSName { get => this._oSName; } + + /// Backing field for property. + private string _oSType; + + /// Gets or sets the type of the OS. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string OSType { get => this._oSType; } + + /// Backing field for property. + private bool? _performAutoResync; + + /// Gets or sets a value indicating whether auto resync is to be done. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public bool? PerformAutoResync { get => this._performAutoResync; set => this._performAutoResync = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskProperties[] _protectedDisk; + + /// Gets or sets the list of protected disks. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskProperties[] ProtectedDisk { get => this._protectedDisk; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicProperties[] _protectedNic; + + /// Gets or sets the VM NIC details. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicProperties[] ProtectedNic { get => this._protectedNic; } + + /// Backing field for property. + private int? _resumeProgressPercentage; + + /// Gets or sets the resume progress percentage. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public int? ResumeProgressPercentage { get => this._resumeProgressPercentage; } + + /// Backing field for property. + private long? _resumeRetryCount; + + /// Gets or sets the resume retry count. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public long? ResumeRetryCount { get => this._resumeRetryCount; } + + /// Backing field for property. + private int? _resyncProgressPercentage; + + /// + /// Gets or sets the resync progress percentage. This is calculated based on total bytes + /// processed for all disks in the source VM. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public int? ResyncProgressPercentage { get => this._resyncProgressPercentage; } + + /// Backing field for property. + private bool? _resyncRequired; + + /// Gets or sets a value indicating whether resync is required. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public bool? ResyncRequired { get => this._resyncRequired; } + + /// Backing field for property. + private long? _resyncRetryCount; + + /// Gets or sets the resync retry count. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public long? ResyncRetryCount { get => this._resyncRetryCount; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMwareToAzureMigrateResyncState? _resyncState; + + /// Gets or sets the resync state. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMwareToAzureMigrateResyncState? ResyncState { get => this._resyncState; } + + /// Backing field for property. + private string _runAsAccountId; + + /// Gets or sets the run as account Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string RunAsAccountId { get => this._runAsAccountId; set => this._runAsAccountId = value; } + + /// Backing field for property. + private string _sourceApplianceName; + + /// Gets or sets the source appliance name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string SourceApplianceName { get => this._sourceApplianceName; } + + /// Backing field for property. + private int? _sourceCpuCore; + + /// Gets or sets the source VM CPU cores. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public int? SourceCpuCore { get => this._sourceCpuCore; } + + /// Backing field for property. + private string _sourceDraName; + + /// Gets or sets the source DRA name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string SourceDraName { get => this._sourceDraName; set => this._sourceDraName = value; } + + /// Backing field for property. + private double? _sourceMemoryInMegaByte; + + /// Gets or sets the source VM ram memory size in megabytes. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public double? SourceMemoryInMegaByte { get => this._sourceMemoryInMegaByte; } + + /// Backing field for property. + private string _sourceVMName; + + /// Gets or sets the source VM display name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string SourceVMName { get => this._sourceVMName; } + + /// Backing field for property. + private string _storageContainerId; + + /// Gets or sets the target storage container ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string StorageContainerId { get => this._storageContainerId; set => this._storageContainerId = value; } + + /// Backing field for property. + private string _targetApplianceName; + + /// Gets or sets the target appliance name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TargetApplianceName { get => this._targetApplianceName; } + + /// Backing field for property. + private string _targetArcClusterCustomLocationId; + + /// Gets or sets the Target Arc Cluster Custom Location ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TargetArcClusterCustomLocationId { get => this._targetArcClusterCustomLocationId; set => this._targetArcClusterCustomLocationId = value; } + + /// Backing field for property. + private string _targetAzStackHciClusterName; + + /// Gets or sets the Target AzStackHCI cluster name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TargetAzStackHciClusterName { get => this._targetAzStackHciClusterName; } + + /// Backing field for property. + private int? _targetCpuCore; + + /// Gets or sets the target CPU cores. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public int? TargetCpuCore { get => this._targetCpuCore; set => this._targetCpuCore = value; } + + /// Backing field for property. + private string _targetDraName; + + /// Gets or sets the target DRA name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TargetDraName { get => this._targetDraName; set => this._targetDraName = value; } + + /// Backing field for property. + private string _targetHciClusterId; + + /// Gets or sets the Target HCI Cluster ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TargetHciClusterId { get => this._targetHciClusterId; set => this._targetHciClusterId = value; } + + /// Backing field for property. + private string _targetLocation; + + /// Gets or sets the target location. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TargetLocation { get => this._targetLocation; } + + /// Backing field for property. + private int? _targetMemoryInMegaByte; + + /// Gets or sets the target memory in mega-bytes. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public int? TargetMemoryInMegaByte { get => this._targetMemoryInMegaByte; set => this._targetMemoryInMegaByte = value; } + + /// Backing field for property. + private string _targetNetworkId; + + /// Gets or sets the target network Id within AzStackHCI Cluster. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TargetNetworkId { get => this._targetNetworkId; set => this._targetNetworkId = value; } + + /// Backing field for property. + private string _targetResourceGroupId; + + /// Gets or sets the target resource group ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TargetResourceGroupId { get => this._targetResourceGroupId; set => this._targetResourceGroupId = value; } + + /// Backing field for property. + private string _targetVMBiosId; + + /// Gets or sets the BIOS Id of the target AzStackHCI VM. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TargetVMBiosId { get => this._targetVMBiosId; } + + /// Backing field for property. + private string _targetVMName; + + /// Gets or sets the target VM display name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TargetVMName { get => this._targetVMName; set => this._targetVMName = value; } + + /// Backing field for property. + private string _testNetworkId; + + /// Gets or sets the target test network Id within AzStackHCI Cluster. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TestNetworkId { get => this._testNetworkId; set => this._testNetworkId = value; } + + /// + /// Creates an new instance. + /// + public VMwareToAzStackHciprotectedItemModelCustomProperties() + { + + } + + /// 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.Migrate.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__protectedItemModelCustomProperties), __protectedItemModelCustomProperties); + await eventListener.AssertObjectIsValid(nameof(__protectedItemModelCustomProperties), __protectedItemModelCustomProperties); + } + } + /// VMware to AzStackHCI Protected item model custom properties. + public partial interface IVMwareToAzStackHciprotectedItemModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCustomProperties + { + /// Gets or sets the location of the protected item. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the location of the protected item.", + SerializedName = @"activeLocation", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectedItemActiveLocation) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectedItemActiveLocation? ActiveLocation { get; } + /// Gets or sets the location of Azure Arc HCI custom location resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the location of Azure Arc HCI custom location resource.", + SerializedName = @"customLocationRegion", + PossibleTypes = new [] { typeof(string) })] + string CustomLocationRegion { get; set; } + /// Gets or sets the list of disks to replicate. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the list of disks to replicate.", + SerializedName = @"disksToInclude", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcidiskInput) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcidiskInput[] DisksToInclude { get; set; } + /// Protected item dynamic memory config. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Protected item dynamic memory config.", + SerializedName = @"dynamicMemoryConfig", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemDynamicMemoryConfig) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemDynamicMemoryConfig DynamicMemoryConfig { get; set; } + /// Gets or sets the ARM Id of the discovered machine. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the ARM Id of the discovered machine.", + SerializedName = @"fabricDiscoveryMachineId", + PossibleTypes = new [] { typeof(string) })] + string FabricDiscoveryMachineId { get; set; } + /// Gets or sets the recovery point Id to which the VM was failed over. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the recovery point Id to which the VM was failed over.", + SerializedName = @"failoverRecoveryPointId", + PossibleTypes = new [] { typeof(string) })] + string FailoverRecoveryPointId { get; } + /// Gets or sets the firmware type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the firmware type.", + SerializedName = @"firmwareType", + PossibleTypes = new [] { typeof(string) })] + string FirmwareType { get; } + /// + /// Gets or sets the hypervisor generation of the virtual machine possible values are 1,2. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the hypervisor generation of the virtual machine possible values are 1,2.", + SerializedName = @"hyperVGeneration", + PossibleTypes = new [] { typeof(string) })] + string HyperVGeneration { get; set; } + /// + /// Gets or sets the initial replication progress percentage. This is calculated based on + /// total bytes processed for all disks in the source VM. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets 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; } + /// Gets or sets a value indicating whether memory is dynamical. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets a value indicating whether memory is dynamical.", + SerializedName = @"isDynamicRam", + PossibleTypes = new [] { typeof(bool) })] + bool? IsDynamicRam { get; set; } + /// Gets or sets the last recovery point Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the last recovery point Id.", + SerializedName = @"lastRecoveryPointId", + PossibleTypes = new [] { typeof(string) })] + string LastRecoveryPointId { get; } + /// Gets or sets the last recovery point received time. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the last recovery point received time.", + SerializedName = @"lastRecoveryPointReceived", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastRecoveryPointReceived { get; } + /// Gets or sets the latest timestamp that replication status is updated. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the latest timestamp that replication status is updated.", + SerializedName = @"lastReplicationUpdateTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastReplicationUpdateTime { get; } + /// Gets or sets the migration progress percentage. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the migration progress percentage.", + SerializedName = @"migrationProgressPercentage", + PossibleTypes = new [] { typeof(int) })] + int? MigrationProgressPercentage { get; } + /// Gets or sets the list of VM NIC to replicate. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the list of VM NIC to replicate.", + SerializedName = @"nicsToInclude", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcinicInput) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcinicInput[] NicsToInclude { get; set; } + /// Gets or sets the name of the OS. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the name of the OS.", + SerializedName = @"osName", + PossibleTypes = new [] { typeof(string) })] + string OSName { get; } + /// Gets or sets the type of the OS. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the type of the OS.", + SerializedName = @"osType", + PossibleTypes = new [] { typeof(string) })] + string OSType { get; } + /// Gets or sets a value indicating whether auto resync is to be done. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets a value indicating whether auto resync is to be done.", + SerializedName = @"performAutoResync", + PossibleTypes = new [] { typeof(bool) })] + bool? PerformAutoResync { get; set; } + /// Gets or sets the list of protected disks. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the list of protected disks.", + SerializedName = @"protectedDisks", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskProperties) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskProperties[] ProtectedDisk { get; } + /// Gets or sets the VM NIC details. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the VM NIC details.", + SerializedName = @"protectedNics", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicProperties) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicProperties[] ProtectedNic { get; } + /// Gets or sets the resume progress percentage. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the resume progress percentage.", + SerializedName = @"resumeProgressPercentage", + PossibleTypes = new [] { typeof(int) })] + int? ResumeProgressPercentage { get; } + /// Gets or sets the resume retry count. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the resume retry count.", + SerializedName = @"resumeRetryCount", + PossibleTypes = new [] { typeof(long) })] + long? ResumeRetryCount { get; } + /// + /// Gets or sets the resync progress percentage. This is calculated based on total bytes + /// processed for all disks in the source VM. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets 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; } + /// Gets or sets a value indicating whether resync is required. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets a value indicating whether resync is required.", + SerializedName = @"resyncRequired", + PossibleTypes = new [] { typeof(bool) })] + bool? ResyncRequired { get; } + /// Gets or sets the resync retry count. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the resync retry count.", + SerializedName = @"resyncRetryCount", + PossibleTypes = new [] { typeof(long) })] + long? ResyncRetryCount { get; } + /// Gets or sets the resync state. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the resync state.", + SerializedName = @"resyncState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMwareToAzureMigrateResyncState) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMwareToAzureMigrateResyncState? ResyncState { get; } + /// Gets or sets the run as account Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the run as account Id.", + SerializedName = @"runAsAccountId", + PossibleTypes = new [] { typeof(string) })] + string RunAsAccountId { get; set; } + /// Gets or sets the source appliance name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the source appliance name.", + SerializedName = @"sourceApplianceName", + PossibleTypes = new [] { typeof(string) })] + string SourceApplianceName { get; } + /// Gets or sets the source VM CPU cores. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the source VM CPU cores.", + SerializedName = @"sourceCpuCores", + PossibleTypes = new [] { typeof(int) })] + int? SourceCpuCore { get; } + /// Gets or sets the source DRA name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the source DRA name.", + SerializedName = @"sourceDraName", + PossibleTypes = new [] { typeof(string) })] + string SourceDraName { get; set; } + /// Gets or sets the source VM ram memory size in megabytes. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the source VM ram memory size in megabytes.", + SerializedName = @"sourceMemoryInMegaBytes", + PossibleTypes = new [] { typeof(double) })] + double? SourceMemoryInMegaByte { get; } + /// Gets or sets the source VM display name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the source VM display name.", + SerializedName = @"sourceVmName", + PossibleTypes = new [] { typeof(string) })] + string SourceVMName { get; } + /// Gets or sets the target storage container ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the target storage container ARM Id.", + SerializedName = @"storageContainerId", + PossibleTypes = new [] { typeof(string) })] + string StorageContainerId { get; set; } + /// Gets or sets the target appliance name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the target appliance name.", + SerializedName = @"targetApplianceName", + PossibleTypes = new [] { typeof(string) })] + string TargetApplianceName { get; } + /// Gets or sets the Target Arc Cluster Custom Location ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the Target Arc Cluster Custom Location ARM Id.", + SerializedName = @"targetArcClusterCustomLocationId", + PossibleTypes = new [] { typeof(string) })] + string TargetArcClusterCustomLocationId { get; set; } + /// Gets or sets the Target AzStackHCI cluster name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the Target AzStackHCI cluster name.", + SerializedName = @"targetAzStackHciClusterName", + PossibleTypes = new [] { typeof(string) })] + string TargetAzStackHciClusterName { get; } + /// Gets or sets the target CPU cores. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the target CPU cores.", + SerializedName = @"targetCpuCores", + PossibleTypes = new [] { typeof(int) })] + int? TargetCpuCore { get; set; } + /// Gets or sets the target DRA name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the target DRA name.", + SerializedName = @"targetDraName", + PossibleTypes = new [] { typeof(string) })] + string TargetDraName { get; set; } + /// Gets or sets the Target HCI Cluster ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the Target HCI Cluster ARM Id.", + SerializedName = @"targetHciClusterId", + PossibleTypes = new [] { typeof(string) })] + string TargetHciClusterId { get; set; } + /// Gets or sets the target location. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the target location.", + SerializedName = @"targetLocation", + PossibleTypes = new [] { typeof(string) })] + string TargetLocation { get; } + /// Gets or sets the target memory in mega-bytes. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the target memory in mega-bytes.", + SerializedName = @"targetMemoryInMegaBytes", + PossibleTypes = new [] { typeof(int) })] + int? TargetMemoryInMegaByte { get; set; } + /// Gets or sets the target network Id within AzStackHCI Cluster. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the target network Id within AzStackHCI Cluster.", + SerializedName = @"targetNetworkId", + PossibleTypes = new [] { typeof(string) })] + string TargetNetworkId { get; set; } + /// Gets or sets the target resource group ARM Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the target resource group ARM Id.", + SerializedName = @"targetResourceGroupId", + PossibleTypes = new [] { typeof(string) })] + string TargetResourceGroupId { get; set; } + /// Gets or sets the BIOS Id of the target AzStackHCI VM. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the BIOS Id of the target AzStackHCI VM.", + SerializedName = @"targetVmBiosId", + PossibleTypes = new [] { typeof(string) })] + string TargetVMBiosId { get; } + /// Gets or sets the target VM display name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the target VM display name.", + SerializedName = @"targetVmName", + PossibleTypes = new [] { typeof(string) })] + string TargetVMName { get; set; } + /// Gets or sets the target test network Id within AzStackHCI Cluster. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the target test network Id within AzStackHCI Cluster.", + SerializedName = @"testNetworkId", + PossibleTypes = new [] { typeof(string) })] + string TestNetworkId { get; set; } + + } + /// VMware to AzStackHCI Protected item model custom properties. + internal partial interface IVMwareToAzStackHciprotectedItemModelCustomPropertiesInternal : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelCustomPropertiesInternal + { + /// Gets or sets the location of the protected item. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectedItemActiveLocation? ActiveLocation { get; set; } + /// Gets or sets the location of Azure Arc HCI custom location resource. + string CustomLocationRegion { get; set; } + /// Gets or sets the list of disks to replicate. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcidiskInput[] DisksToInclude { get; set; } + /// Protected item dynamic memory config. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemDynamicMemoryConfig DynamicMemoryConfig { get; set; } + /// Gets or sets the ARM Id of the discovered machine. + string FabricDiscoveryMachineId { get; set; } + /// Gets or sets the recovery point Id to which the VM was failed over. + string FailoverRecoveryPointId { get; set; } + /// Gets or sets the firmware type. + string FirmwareType { get; set; } + /// + /// Gets or sets the hypervisor generation of the virtual machine possible values are 1,2. + /// + string HyperVGeneration { get; set; } + /// + /// Gets or sets the initial replication progress percentage. This is calculated based on + /// total bytes processed for all disks in the source VM. + /// + int? InitialReplicationProgressPercentage { get; set; } + /// Gets or sets a value indicating whether memory is dynamical. + bool? IsDynamicRam { get; set; } + /// Gets or sets the last recovery point Id. + string LastRecoveryPointId { get; set; } + /// Gets or sets the last recovery point received time. + global::System.DateTime? LastRecoveryPointReceived { get; set; } + /// Gets or sets the latest timestamp that replication status is updated. + global::System.DateTime? LastReplicationUpdateTime { get; set; } + /// Gets or sets the migration progress percentage. + int? MigrationProgressPercentage { get; set; } + /// Gets or sets the list of VM NIC to replicate. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcinicInput[] NicsToInclude { get; set; } + /// Gets or sets the name of the OS. + string OSName { get; set; } + /// Gets or sets the type of the OS. + string OSType { get; set; } + /// Gets or sets a value indicating whether auto resync is to be done. + bool? PerformAutoResync { get; set; } + /// Gets or sets the list of protected disks. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskProperties[] ProtectedDisk { get; set; } + /// Gets or sets the VM NIC details. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicProperties[] ProtectedNic { get; set; } + /// Gets or sets the resume progress percentage. + int? ResumeProgressPercentage { get; set; } + /// Gets or sets the resume retry count. + long? ResumeRetryCount { get; set; } + /// + /// Gets or sets the resync progress percentage. This is calculated based on total bytes + /// processed for all disks in the source VM. + /// + int? ResyncProgressPercentage { get; set; } + /// Gets or sets a value indicating whether resync is required. + bool? ResyncRequired { get; set; } + /// Gets or sets the resync retry count. + long? ResyncRetryCount { get; set; } + /// Gets or sets the resync state. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMwareToAzureMigrateResyncState? ResyncState { get; set; } + /// Gets or sets the run as account Id. + string RunAsAccountId { get; set; } + /// Gets or sets the source appliance name. + string SourceApplianceName { get; set; } + /// Gets or sets the source VM CPU cores. + int? SourceCpuCore { get; set; } + /// Gets or sets the source DRA name. + string SourceDraName { get; set; } + /// Gets or sets the source VM ram memory size in megabytes. + double? SourceMemoryInMegaByte { get; set; } + /// Gets or sets the source VM display name. + string SourceVMName { get; set; } + /// Gets or sets the target storage container ARM Id. + string StorageContainerId { get; set; } + /// Gets or sets the target appliance name. + string TargetApplianceName { get; set; } + /// Gets or sets the Target Arc Cluster Custom Location ARM Id. + string TargetArcClusterCustomLocationId { get; set; } + /// Gets or sets the Target AzStackHCI cluster name. + string TargetAzStackHciClusterName { get; set; } + /// Gets or sets the target CPU cores. + int? TargetCpuCore { get; set; } + /// Gets or sets the target DRA name. + string TargetDraName { get; set; } + /// Gets or sets the Target HCI Cluster ARM Id. + string TargetHciClusterId { get; set; } + /// Gets or sets the target location. + string TargetLocation { get; set; } + /// Gets or sets the target memory in mega-bytes. + int? TargetMemoryInMegaByte { get; set; } + /// Gets or sets the target network Id within AzStackHCI Cluster. + string TargetNetworkId { get; set; } + /// Gets or sets the target resource group ARM Id. + string TargetResourceGroupId { get; set; } + /// Gets or sets the BIOS Id of the target AzStackHCI VM. + string TargetVMBiosId { get; set; } + /// Gets or sets the target VM display name. + string TargetVMName { get; set; } + /// Gets or sets the target test network Id within AzStackHCI Cluster. + string TestNetworkId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciprotectedItemModelCustomProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciprotectedItemModelCustomProperties.json.cs new file mode 100644 index 000000000000..885c1105924a --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciprotectedItemModelCustomProperties.json.cs @@ -0,0 +1,313 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// VMware to AzStackHCI Protected item model custom properties. + public partial class VMwareToAzStackHciprotectedItemModelCustomProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedItemModelCustomProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new VMwareToAzStackHciprotectedItemModelCustomProperties(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __protectedItemModelCustomProperties?.ToJson(container, serializationMode); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._activeLocation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._activeLocation.ToString()) : null, "activeLocation" ,container.Add ); + } + AddIf( null != (((object)this._targetHciClusterId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._targetHciClusterId.ToString()) : null, "targetHciClusterId" ,container.Add ); + AddIf( null != (((object)this._targetArcClusterCustomLocationId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._targetArcClusterCustomLocationId.ToString()) : null, "targetArcClusterCustomLocationId" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._targetAzStackHciClusterName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._targetAzStackHciClusterName.ToString()) : null, "targetAzStackHciClusterName" ,container.Add ); + } + AddIf( null != (((object)this._storageContainerId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._storageContainerId.ToString()) : null, "storageContainerId" ,container.Add ); + AddIf( null != (((object)this._targetResourceGroupId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._targetResourceGroupId.ToString()) : null, "targetResourceGroupId" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._targetLocation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._targetLocation.ToString()) : null, "targetLocation" ,container.Add ); + } + AddIf( null != (((object)this._customLocationRegion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._customLocationRegion.ToString()) : null, "customLocationRegion" ,container.Add ); + if (null != this._disksToInclude) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.XNodeArray(); + foreach( var __x in this._disksToInclude ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("disksToInclude",__w); + } + if (null != this._nicsToInclude) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.XNodeArray(); + foreach( var __s in this._nicsToInclude ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("nicsToInclude",__r); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._protectedDisk) + { + var __m = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.XNodeArray(); + foreach( var __n in this._protectedDisk ) + { + AddIf(__n?.ToJson(null, serializationMode) ,__m.Add); + } + container.Add("protectedDisks",__m); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._protectedNic) + { + var __h = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.XNodeArray(); + foreach( var __i in this._protectedNic ) + { + AddIf(__i?.ToJson(null, serializationMode) ,__h.Add); + } + container.Add("protectedNics",__h); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._targetVMBiosId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._targetVMBiosId.ToString()) : null, "targetVmBiosId" ,container.Add ); + } + AddIf( null != (((object)this._targetVMName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._targetVMName.ToString()) : null, "targetVmName" ,container.Add ); + AddIf( null != (((object)this._hyperVGeneration)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._hyperVGeneration.ToString()) : null, "hyperVGeneration" ,container.Add ); + AddIf( null != (((object)this._targetNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._targetNetworkId.ToString()) : null, "targetNetworkId" ,container.Add ); + AddIf( null != (((object)this._testNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._testNetworkId.ToString()) : null, "testNetworkId" ,container.Add ); + AddIf( null != this._targetCpuCore ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNumber((int)this._targetCpuCore) : null, "targetCpuCores" ,container.Add ); + AddIf( null != this._isDynamicRam ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonBoolean((bool)this._isDynamicRam) : null, "isDynamicRam" ,container.Add ); + AddIf( null != this._dynamicMemoryConfig ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._dynamicMemoryConfig.ToJson(null,serializationMode) : null, "dynamicMemoryConfig" ,container.Add ); + AddIf( null != this._targetMemoryInMegaByte ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNumber((int)this._targetMemoryInMegaByte) : null, "targetMemoryInMegaBytes" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._oSType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._oSType.ToString()) : null, "osType" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._oSName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._oSName.ToString()) : null, "osName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._firmwareType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._firmwareType.ToString()) : null, "firmwareType" ,container.Add ); + } + AddIf( null != (((object)this._fabricDiscoveryMachineId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._fabricDiscoveryMachineId.ToString()) : null, "fabricDiscoveryMachineId" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._sourceVMName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._sourceVMName.ToString()) : null, "sourceVmName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._sourceCpuCore ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNumber((int)this._sourceCpuCore) : null, "sourceCpuCores" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._sourceMemoryInMegaByte ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNumber((double)this._sourceMemoryInMegaByte) : null, "sourceMemoryInMegaBytes" ,container.Add ); + } + AddIf( null != (((object)this._runAsAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._runAsAccountId.ToString()) : null, "runAsAccountId" ,container.Add ); + AddIf( null != (((object)this._sourceDraName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._sourceDraName.ToString()) : null, "sourceDraName" ,container.Add ); + AddIf( null != (((object)this._targetDraName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._targetDraName.ToString()) : null, "targetDraName" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._sourceApplianceName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._sourceApplianceName.ToString()) : null, "sourceApplianceName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._targetApplianceName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._targetApplianceName.ToString()) : null, "targetApplianceName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._failoverRecoveryPointId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._failoverRecoveryPointId.ToString()) : null, "failoverRecoveryPointId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._lastRecoveryPointReceived ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._lastRecoveryPointId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._lastRecoveryPointId.ToString()) : null, "lastRecoveryPointId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._initialReplicationProgressPercentage ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNumber((int)this._initialReplicationProgressPercentage) : null, "initialReplicationProgressPercentage" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._migrationProgressPercentage ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNumber((int)this._migrationProgressPercentage) : null, "migrationProgressPercentage" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._resumeProgressPercentage ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNumber((int)this._resumeProgressPercentage) : null, "resumeProgressPercentage" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._resyncProgressPercentage ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNumber((int)this._resyncProgressPercentage) : null, "resyncProgressPercentage" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._resyncRetryCount ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNumber((long)this._resyncRetryCount) : null, "resyncRetryCount" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._resyncRequired ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonBoolean((bool)this._resyncRequired) : null, "resyncRequired" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._resyncState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._resyncState.ToString()) : null, "resyncState" ,container.Add ); + } + AddIf( null != this._performAutoResync ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonBoolean((bool)this._performAutoResync) : null, "performAutoResync" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._resumeRetryCount ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNumber((long)this._resumeRetryCount) : null, "resumeRetryCount" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._lastReplicationUpdateTime ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._lastReplicationUpdateTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "lastReplicationUpdateTime" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal VMwareToAzStackHciprotectedItemModelCustomProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __protectedItemModelCustomProperties = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelCustomProperties(json); + {_activeLocation = If( json?.PropertyT("activeLocation"), out var __jsonActiveLocation) ? (string)__jsonActiveLocation : (string)ActiveLocation;} + {_targetHciClusterId = If( json?.PropertyT("targetHciClusterId"), out var __jsonTargetHciClusterId) ? (string)__jsonTargetHciClusterId : (string)TargetHciClusterId;} + {_targetArcClusterCustomLocationId = If( json?.PropertyT("targetArcClusterCustomLocationId"), out var __jsonTargetArcClusterCustomLocationId) ? (string)__jsonTargetArcClusterCustomLocationId : (string)TargetArcClusterCustomLocationId;} + {_targetAzStackHciClusterName = If( json?.PropertyT("targetAzStackHciClusterName"), out var __jsonTargetAzStackHciClusterName) ? (string)__jsonTargetAzStackHciClusterName : (string)TargetAzStackHciClusterName;} + {_storageContainerId = If( json?.PropertyT("storageContainerId"), out var __jsonStorageContainerId) ? (string)__jsonStorageContainerId : (string)StorageContainerId;} + {_targetResourceGroupId = If( json?.PropertyT("targetResourceGroupId"), out var __jsonTargetResourceGroupId) ? (string)__jsonTargetResourceGroupId : (string)TargetResourceGroupId;} + {_targetLocation = If( json?.PropertyT("targetLocation"), out var __jsonTargetLocation) ? (string)__jsonTargetLocation : (string)TargetLocation;} + {_customLocationRegion = If( json?.PropertyT("customLocationRegion"), out var __jsonCustomLocationRegion) ? (string)__jsonCustomLocationRegion : (string)CustomLocationRegion;} + {_disksToInclude = If( json?.PropertyT("disksToInclude"), out var __jsonDisksToInclude) ? If( __jsonDisksToInclude as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcidiskInput) (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareToAzStackHcidiskInput.FromJson(__u) )) ))() : null : DisksToInclude;} + {_nicsToInclude = If( json?.PropertyT("nicsToInclude"), out var __jsonNicsToInclude) ? If( __jsonNicsToInclude as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcinicInput) (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareToAzStackHcinicInput.FromJson(__p) )) ))() : null : NicsToInclude;} + {_protectedDisk = If( json?.PropertyT("protectedDisks"), out var __jsonProtectedDisks) ? If( __jsonProtectedDisks as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedDiskProperties) (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareToAzStackHciprotectedDiskProperties.FromJson(__k) )) ))() : null : ProtectedDisk;} + {_protectedNic = If( json?.PropertyT("protectedNics"), out var __jsonProtectedNics) ? If( __jsonProtectedNics as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicProperties) (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VMwareToAzStackHciprotectedNicProperties.FromJson(__f) )) ))() : null : ProtectedNic;} + {_targetVMBiosId = If( json?.PropertyT("targetVmBiosId"), out var __jsonTargetVMBiosId) ? (string)__jsonTargetVMBiosId : (string)TargetVMBiosId;} + {_targetVMName = If( json?.PropertyT("targetVmName"), out var __jsonTargetVMName) ? (string)__jsonTargetVMName : (string)TargetVMName;} + {_hyperVGeneration = If( json?.PropertyT("hyperVGeneration"), out var __jsonHyperVGeneration) ? (string)__jsonHyperVGeneration : (string)HyperVGeneration;} + {_targetNetworkId = If( json?.PropertyT("targetNetworkId"), out var __jsonTargetNetworkId) ? (string)__jsonTargetNetworkId : (string)TargetNetworkId;} + {_testNetworkId = If( json?.PropertyT("testNetworkId"), out var __jsonTestNetworkId) ? (string)__jsonTestNetworkId : (string)TestNetworkId;} + {_targetCpuCore = If( json?.PropertyT("targetCpuCores"), out var __jsonTargetCpuCores) ? (int?)__jsonTargetCpuCores : TargetCpuCore;} + {_isDynamicRam = If( json?.PropertyT("isDynamicRam"), out var __jsonIsDynamicRam) ? (bool?)__jsonIsDynamicRam : IsDynamicRam;} + {_dynamicMemoryConfig = If( json?.PropertyT("dynamicMemoryConfig"), out var __jsonDynamicMemoryConfig) ? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemDynamicMemoryConfig.FromJson(__jsonDynamicMemoryConfig) : DynamicMemoryConfig;} + {_targetMemoryInMegaByte = If( json?.PropertyT("targetMemoryInMegaBytes"), out var __jsonTargetMemoryInMegaBytes) ? (int?)__jsonTargetMemoryInMegaBytes : TargetMemoryInMegaByte;} + {_oSType = If( json?.PropertyT("osType"), out var __jsonOSType) ? (string)__jsonOSType : (string)OSType;} + {_oSName = If( json?.PropertyT("osName"), out var __jsonOSName) ? (string)__jsonOSName : (string)OSName;} + {_firmwareType = If( json?.PropertyT("firmwareType"), out var __jsonFirmwareType) ? (string)__jsonFirmwareType : (string)FirmwareType;} + {_fabricDiscoveryMachineId = If( json?.PropertyT("fabricDiscoveryMachineId"), out var __jsonFabricDiscoveryMachineId) ? (string)__jsonFabricDiscoveryMachineId : (string)FabricDiscoveryMachineId;} + {_sourceVMName = If( json?.PropertyT("sourceVmName"), out var __jsonSourceVMName) ? (string)__jsonSourceVMName : (string)SourceVMName;} + {_sourceCpuCore = If( json?.PropertyT("sourceCpuCores"), out var __jsonSourceCpuCores) ? (int?)__jsonSourceCpuCores : SourceCpuCore;} + {_sourceMemoryInMegaByte = If( json?.PropertyT("sourceMemoryInMegaBytes"), out var __jsonSourceMemoryInMegaBytes) ? (double?)__jsonSourceMemoryInMegaBytes : SourceMemoryInMegaByte;} + {_runAsAccountId = If( json?.PropertyT("runAsAccountId"), out var __jsonRunAsAccountId) ? (string)__jsonRunAsAccountId : (string)RunAsAccountId;} + {_sourceDraName = If( json?.PropertyT("sourceDraName"), out var __jsonSourceDraName) ? (string)__jsonSourceDraName : (string)SourceDraName;} + {_targetDraName = If( json?.PropertyT("targetDraName"), out var __jsonTargetDraName) ? (string)__jsonTargetDraName : (string)TargetDraName;} + {_sourceApplianceName = If( json?.PropertyT("sourceApplianceName"), out var __jsonSourceApplianceName) ? (string)__jsonSourceApplianceName : (string)SourceApplianceName;} + {_targetApplianceName = If( json?.PropertyT("targetApplianceName"), out var __jsonTargetApplianceName) ? (string)__jsonTargetApplianceName : (string)TargetApplianceName;} + {_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;} + {_lastRecoveryPointId = If( json?.PropertyT("lastRecoveryPointId"), out var __jsonLastRecoveryPointId) ? (string)__jsonLastRecoveryPointId : (string)LastRecoveryPointId;} + {_initialReplicationProgressPercentage = If( json?.PropertyT("initialReplicationProgressPercentage"), out var __jsonInitialReplicationProgressPercentage) ? (int?)__jsonInitialReplicationProgressPercentage : InitialReplicationProgressPercentage;} + {_migrationProgressPercentage = If( json?.PropertyT("migrationProgressPercentage"), out var __jsonMigrationProgressPercentage) ? (int?)__jsonMigrationProgressPercentage : MigrationProgressPercentage;} + {_resumeProgressPercentage = If( json?.PropertyT("resumeProgressPercentage"), out var __jsonResumeProgressPercentage) ? (int?)__jsonResumeProgressPercentage : ResumeProgressPercentage;} + {_resyncProgressPercentage = If( json?.PropertyT("resyncProgressPercentage"), out var __jsonResyncProgressPercentage) ? (int?)__jsonResyncProgressPercentage : ResyncProgressPercentage;} + {_resyncRetryCount = If( json?.PropertyT("resyncRetryCount"), out var __jsonResyncRetryCount) ? (long?)__jsonResyncRetryCount : ResyncRetryCount;} + {_resyncRequired = If( json?.PropertyT("resyncRequired"), out var __jsonResyncRequired) ? (bool?)__jsonResyncRequired : ResyncRequired;} + {_resyncState = If( json?.PropertyT("resyncState"), out var __jsonResyncState) ? (string)__jsonResyncState : (string)ResyncState;} + {_performAutoResync = If( json?.PropertyT("performAutoResync"), out var __jsonPerformAutoResync) ? (bool?)__jsonPerformAutoResync : PerformAutoResync;} + {_resumeRetryCount = If( json?.PropertyT("resumeRetryCount"), out var __jsonResumeRetryCount) ? (long?)__jsonResumeRetryCount : ResumeRetryCount;} + {_lastReplicationUpdateTime = If( json?.PropertyT("lastReplicationUpdateTime"), out var __jsonLastReplicationUpdateTime) ? global::System.DateTime.TryParse((string)__jsonLastReplicationUpdateTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonLastReplicationUpdateTimeValue) ? __jsonLastReplicationUpdateTimeValue : LastReplicationUpdateTime : LastReplicationUpdateTime;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciprotectedNicProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciprotectedNicProperties.PowerShell.cs new file mode 100644 index 000000000000..406b02031e2a --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciprotectedNicProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// VMwareToAzStackHCI NIC properties. + [System.ComponentModel.TypeConverter(typeof(VMwareToAzStackHciprotectedNicPropertiesTypeConverter))] + public partial class VMwareToAzStackHciprotectedNicProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMwareToAzStackHciprotectedNicProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMwareToAzStackHciprotectedNicProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMwareToAzStackHciprotectedNicProperties(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.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicPropertiesInternal)this).NicId = (string) content.GetValueForProperty("NicId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicPropertiesInternal)this).NicId, global::System.Convert.ToString); + } + if (content.Contains("MacAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicPropertiesInternal)this).MacAddress = (string) content.GetValueForProperty("MacAddress",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicPropertiesInternal)this).MacAddress, global::System.Convert.ToString); + } + if (content.Contains("Label")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicPropertiesInternal)this).Label = (string) content.GetValueForProperty("Label",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicPropertiesInternal)this).Label, global::System.Convert.ToString); + } + if (content.Contains("IsPrimaryNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicPropertiesInternal)this).IsPrimaryNic = (bool?) content.GetValueForProperty("IsPrimaryNic",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicPropertiesInternal)this).IsPrimaryNic, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("NetworkName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicPropertiesInternal)this).NetworkName = (string) content.GetValueForProperty("NetworkName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicPropertiesInternal)this).NetworkName, global::System.Convert.ToString); + } + if (content.Contains("TargetNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicPropertiesInternal)this).TargetNetworkId = (string) content.GetValueForProperty("TargetNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicPropertiesInternal)this).TargetNetworkId, global::System.Convert.ToString); + } + if (content.Contains("TestNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicPropertiesInternal)this).TestNetworkId = (string) content.GetValueForProperty("TestNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicPropertiesInternal)this).TestNetworkId, global::System.Convert.ToString); + } + if (content.Contains("SelectionTypeForFailover")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicPropertiesInternal)this).SelectionTypeForFailover = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection?) content.GetValueForProperty("SelectionTypeForFailover",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicPropertiesInternal)this).SelectionTypeForFailover, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VMwareToAzStackHciprotectedNicProperties(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.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicPropertiesInternal)this).NicId = (string) content.GetValueForProperty("NicId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicPropertiesInternal)this).NicId, global::System.Convert.ToString); + } + if (content.Contains("MacAddress")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicPropertiesInternal)this).MacAddress = (string) content.GetValueForProperty("MacAddress",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicPropertiesInternal)this).MacAddress, global::System.Convert.ToString); + } + if (content.Contains("Label")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicPropertiesInternal)this).Label = (string) content.GetValueForProperty("Label",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicPropertiesInternal)this).Label, global::System.Convert.ToString); + } + if (content.Contains("IsPrimaryNic")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicPropertiesInternal)this).IsPrimaryNic = (bool?) content.GetValueForProperty("IsPrimaryNic",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicPropertiesInternal)this).IsPrimaryNic, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("NetworkName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicPropertiesInternal)this).NetworkName = (string) content.GetValueForProperty("NetworkName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicPropertiesInternal)this).NetworkName, global::System.Convert.ToString); + } + if (content.Contains("TargetNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicPropertiesInternal)this).TargetNetworkId = (string) content.GetValueForProperty("TargetNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicPropertiesInternal)this).TargetNetworkId, global::System.Convert.ToString); + } + if (content.Contains("TestNetworkId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicPropertiesInternal)this).TestNetworkId = (string) content.GetValueForProperty("TestNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicPropertiesInternal)this).TestNetworkId, global::System.Convert.ToString); + } + if (content.Contains("SelectionTypeForFailover")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicPropertiesInternal)this).SelectionTypeForFailover = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection?) content.GetValueForProperty("SelectionTypeForFailover",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicPropertiesInternal)this).SelectionTypeForFailover, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection.CreateFrom); + } + AfterDeserializePSObject(content); + } + } + /// VMwareToAzStackHCI NIC properties. + [System.ComponentModel.TypeConverter(typeof(VMwareToAzStackHciprotectedNicPropertiesTypeConverter))] + public partial interface IVMwareToAzStackHciprotectedNicProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciprotectedNicProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciprotectedNicProperties.TypeConverter.cs new file mode 100644 index 000000000000..f3a91b966c46 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciprotectedNicProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMwareToAzStackHciprotectedNicPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMwareToAzStackHciprotectedNicProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMwareToAzStackHciprotectedNicProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMwareToAzStackHciprotectedNicProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciprotectedNicProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciprotectedNicProperties.cs new file mode 100644 index 000000000000..cc2452d0cc1d --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciprotectedNicProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// VMwareToAzStackHCI NIC properties. + public partial class VMwareToAzStackHciprotectedNicProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicPropertiesInternal + { + + /// Backing field for property. + private bool? _isPrimaryNic; + + /// Gets or sets a value indicating whether this is the primary NIC. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public bool? IsPrimaryNic { get => this._isPrimaryNic; set => this._isPrimaryNic = value; } + + /// Backing field for property. + private string _label; + + /// Gets or sets the NIC label. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Label { get => this._label; } + + /// Backing field for property. + private string _macAddress; + + /// Gets or sets the NIC mac address. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string MacAddress { get => this._macAddress; } + + /// Internal Acessors for Label + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicPropertiesInternal.Label { get => this._label; set { {_label = value;} } } + + /// Internal Acessors for MacAddress + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicPropertiesInternal.MacAddress { get => this._macAddress; set { {_macAddress = value;} } } + + /// Internal Acessors for NetworkName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicPropertiesInternal.NetworkName { get => this._networkName; set { {_networkName = value;} } } + + /// Internal Acessors for NicId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicPropertiesInternal.NicId { get => this._nicId; set { {_nicId = value;} } } + + /// Internal Acessors for SelectionTypeForFailover + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicPropertiesInternal.SelectionTypeForFailover { get => this._selectionTypeForFailover; set { {_selectionTypeForFailover = value;} } } + + /// Internal Acessors for TargetNetworkId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicPropertiesInternal.TargetNetworkId { get => this._targetNetworkId; set { {_targetNetworkId = value;} } } + + /// Internal Acessors for TestNetworkId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicPropertiesInternal.TestNetworkId { get => this._testNetworkId; set { {_testNetworkId = value;} } } + + /// Backing field for property. + private string _networkName; + + /// Gets or sets the network name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string NetworkName { get => this._networkName; } + + /// Backing field for property. + private string _nicId; + + /// Gets or sets the NIC Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string NicId { get => this._nicId; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection? _selectionTypeForFailover; + + /// Gets or sets the selection type of the NIC. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection? SelectionTypeForFailover { get => this._selectionTypeForFailover; } + + /// Backing field for property. + private string _targetNetworkId; + + /// Gets or sets the target network Id within AzStackHCI Cluster. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TargetNetworkId { get => this._targetNetworkId; } + + /// Backing field for property. + private string _testNetworkId; + + /// Gets or sets the target test network Id within AzStackHCI Cluster. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TestNetworkId { get => this._testNetworkId; } + + /// + /// Creates an new instance. + /// + public VMwareToAzStackHciprotectedNicProperties() + { + + } + } + /// VMwareToAzStackHCI NIC properties. + public partial interface IVMwareToAzStackHciprotectedNicProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets a value indicating whether this is the primary NIC. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets a value indicating whether this is the primary NIC.", + SerializedName = @"isPrimaryNic", + PossibleTypes = new [] { typeof(bool) })] + bool? IsPrimaryNic { get; set; } + /// Gets or sets the NIC label. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the NIC label.", + SerializedName = @"label", + PossibleTypes = new [] { typeof(string) })] + string Label { get; } + /// Gets or sets the NIC mac address. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the NIC mac address.", + SerializedName = @"macAddress", + PossibleTypes = new [] { typeof(string) })] + string MacAddress { get; } + /// Gets or sets the network name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the network name.", + SerializedName = @"networkName", + PossibleTypes = new [] { typeof(string) })] + string NetworkName { get; } + /// Gets or sets the NIC Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the NIC Id.", + SerializedName = @"nicId", + PossibleTypes = new [] { typeof(string) })] + string NicId { get; } + /// Gets or sets the selection type of the NIC. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the selection type of the NIC.", + SerializedName = @"selectionTypeForFailover", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection? SelectionTypeForFailover { get; } + /// Gets or sets the target network Id within AzStackHCI Cluster. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the target network Id within AzStackHCI Cluster.", + SerializedName = @"targetNetworkId", + PossibleTypes = new [] { typeof(string) })] + string TargetNetworkId { get; } + /// Gets or sets the target test network Id within AzStackHCI Cluster. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the target test network Id within AzStackHCI Cluster.", + SerializedName = @"testNetworkId", + PossibleTypes = new [] { typeof(string) })] + string TestNetworkId { get; } + + } + /// VMwareToAzStackHCI NIC properties. + internal partial interface IVMwareToAzStackHciprotectedNicPropertiesInternal + + { + /// Gets or sets a value indicating whether this is the primary NIC. + bool? IsPrimaryNic { get; set; } + /// Gets or sets the NIC label. + string Label { get; set; } + /// Gets or sets the NIC mac address. + string MacAddress { get; set; } + /// Gets or sets the network name. + string NetworkName { get; set; } + /// Gets or sets the NIC Id. + string NicId { get; set; } + /// Gets or sets the selection type of the NIC. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection? SelectionTypeForFailover { get; set; } + /// Gets or sets the target network Id within AzStackHCI Cluster. + string TargetNetworkId { get; set; } + /// Gets or sets the target test network Id within AzStackHCI Cluster. + string TestNetworkId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciprotectedNicProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciprotectedNicProperties.json.cs new file mode 100644 index 000000000000..0db1e9567fe3 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHciprotectedNicProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// VMwareToAzStackHCI NIC properties. + public partial class VMwareToAzStackHciprotectedNicProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHciprotectedNicProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new VMwareToAzStackHciprotectedNicProperties(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._nicId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._nicId.ToString()) : null, "nicId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._macAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._macAddress.ToString()) : null, "macAddress" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._label)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._label.ToString()) : null, "label" ,container.Add ); + } + AddIf( null != this._isPrimaryNic ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonBoolean((bool)this._isPrimaryNic) : null, "isPrimaryNic" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._networkName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._networkName.ToString()) : null, "networkName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._targetNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._targetNetworkId.ToString()) : null, "targetNetworkId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._testNetworkId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._testNetworkId.ToString()) : null, "testNetworkId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._selectionTypeForFailover)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._selectionTypeForFailover.ToString()) : null, "selectionTypeForFailover" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal VMwareToAzStackHciprotectedNicProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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;} + {_macAddress = If( json?.PropertyT("macAddress"), out var __jsonMacAddress) ? (string)__jsonMacAddress : (string)MacAddress;} + {_label = If( json?.PropertyT("label"), out var __jsonLabel) ? (string)__jsonLabel : (string)Label;} + {_isPrimaryNic = If( json?.PropertyT("isPrimaryNic"), out var __jsonIsPrimaryNic) ? (bool?)__jsonIsPrimaryNic : IsPrimaryNic;} + {_networkName = If( json?.PropertyT("networkName"), out var __jsonNetworkName) ? (string)__jsonNetworkName : (string)NetworkName;} + {_targetNetworkId = If( json?.PropertyT("targetNetworkId"), out var __jsonTargetNetworkId) ? (string)__jsonTargetNetworkId : (string)TargetNetworkId;} + {_testNetworkId = If( json?.PropertyT("testNetworkId"), out var __jsonTestNetworkId) ? (string)__jsonTestNetworkId : (string)TestNetworkId;} + {_selectionTypeForFailover = If( json?.PropertyT("selectionTypeForFailover"), out var __jsonSelectionTypeForFailover) ? (string)__jsonSelectionTypeForFailover : (string)SelectionTypeForFailover;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcireplicationExtensionModelCustomProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcireplicationExtensionModelCustomProperties.PowerShell.cs new file mode 100644 index 000000000000..6e55b4f10d6b --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcireplicationExtensionModelCustomProperties.PowerShell.cs @@ -0,0 +1,277 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// VMware to AzStackHCI Replication extension model custom properties. + [System.ComponentModel.TypeConverter(typeof(VMwareToAzStackHcireplicationExtensionModelCustomPropertiesTypeConverter))] + public partial class VMwareToAzStackHcireplicationExtensionModelCustomProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VMwareToAzStackHcireplicationExtensionModelCustomProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VMwareToAzStackHcireplicationExtensionModelCustomProperties(content); + } + + /// + /// Creates a new instance of , deserializing the + /// content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VMwareToAzStackHcireplicationExtensionModelCustomProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("VmwareFabricArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).VmwareFabricArmId = (string) content.GetValueForProperty("VmwareFabricArmId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).VmwareFabricArmId, global::System.Convert.ToString); + } + if (content.Contains("VmwareSiteId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).VmwareSiteId = (string) content.GetValueForProperty("VmwareSiteId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).VmwareSiteId, global::System.Convert.ToString); + } + if (content.Contains("AzStackHciFabricArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).AzStackHciFabricArmId = (string) content.GetValueForProperty("AzStackHciFabricArmId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).AzStackHciFabricArmId, global::System.Convert.ToString); + } + if (content.Contains("AzStackHciSiteId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).AzStackHciSiteId = (string) content.GetValueForProperty("AzStackHciSiteId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).AzStackHciSiteId, global::System.Convert.ToString); + } + if (content.Contains("StorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).StorageAccountId = (string) content.GetValueForProperty("StorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).StorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("StorageAccountSasSecretName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).StorageAccountSasSecretName = (string) content.GetValueForProperty("StorageAccountSasSecretName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).StorageAccountSasSecretName, global::System.Convert.ToString); + } + if (content.Contains("AsrServiceUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).AsrServiceUri = (string) content.GetValueForProperty("AsrServiceUri",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).AsrServiceUri, global::System.Convert.ToString); + } + if (content.Contains("RcmServiceUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).RcmServiceUri = (string) content.GetValueForProperty("RcmServiceUri",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).RcmServiceUri, global::System.Convert.ToString); + } + if (content.Contains("GatewayServiceUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).GatewayServiceUri = (string) content.GetValueForProperty("GatewayServiceUri",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).GatewayServiceUri, global::System.Convert.ToString); + } + if (content.Contains("SourceGatewayServiceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).SourceGatewayServiceId = (string) content.GetValueForProperty("SourceGatewayServiceId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).SourceGatewayServiceId, global::System.Convert.ToString); + } + if (content.Contains("TargetGatewayServiceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).TargetGatewayServiceId = (string) content.GetValueForProperty("TargetGatewayServiceId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).TargetGatewayServiceId, global::System.Convert.ToString); + } + if (content.Contains("SourceStorageContainerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).SourceStorageContainerName = (string) content.GetValueForProperty("SourceStorageContainerName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).SourceStorageContainerName, global::System.Convert.ToString); + } + if (content.Contains("TargetStorageContainerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).TargetStorageContainerName = (string) content.GetValueForProperty("TargetStorageContainerName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).TargetStorageContainerName, global::System.Convert.ToString); + } + if (content.Contains("ResourceLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).ResourceLocation = (string) content.GetValueForProperty("ResourceLocation",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).ResourceLocation, global::System.Convert.ToString); + } + if (content.Contains("SubscriptionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).SubscriptionId, global::System.Convert.ToString); + } + if (content.Contains("ResourceGroup")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).ResourceGroup = (string) content.GetValueForProperty("ResourceGroup",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).ResourceGroup, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCustomPropertiesInternal)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 VMwareToAzStackHcireplicationExtensionModelCustomProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("VmwareFabricArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).VmwareFabricArmId = (string) content.GetValueForProperty("VmwareFabricArmId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).VmwareFabricArmId, global::System.Convert.ToString); + } + if (content.Contains("VmwareSiteId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).VmwareSiteId = (string) content.GetValueForProperty("VmwareSiteId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).VmwareSiteId, global::System.Convert.ToString); + } + if (content.Contains("AzStackHciFabricArmId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).AzStackHciFabricArmId = (string) content.GetValueForProperty("AzStackHciFabricArmId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).AzStackHciFabricArmId, global::System.Convert.ToString); + } + if (content.Contains("AzStackHciSiteId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).AzStackHciSiteId = (string) content.GetValueForProperty("AzStackHciSiteId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).AzStackHciSiteId, global::System.Convert.ToString); + } + if (content.Contains("StorageAccountId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).StorageAccountId = (string) content.GetValueForProperty("StorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).StorageAccountId, global::System.Convert.ToString); + } + if (content.Contains("StorageAccountSasSecretName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).StorageAccountSasSecretName = (string) content.GetValueForProperty("StorageAccountSasSecretName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).StorageAccountSasSecretName, global::System.Convert.ToString); + } + if (content.Contains("AsrServiceUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).AsrServiceUri = (string) content.GetValueForProperty("AsrServiceUri",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).AsrServiceUri, global::System.Convert.ToString); + } + if (content.Contains("RcmServiceUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).RcmServiceUri = (string) content.GetValueForProperty("RcmServiceUri",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).RcmServiceUri, global::System.Convert.ToString); + } + if (content.Contains("GatewayServiceUri")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).GatewayServiceUri = (string) content.GetValueForProperty("GatewayServiceUri",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).GatewayServiceUri, global::System.Convert.ToString); + } + if (content.Contains("SourceGatewayServiceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).SourceGatewayServiceId = (string) content.GetValueForProperty("SourceGatewayServiceId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).SourceGatewayServiceId, global::System.Convert.ToString); + } + if (content.Contains("TargetGatewayServiceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).TargetGatewayServiceId = (string) content.GetValueForProperty("TargetGatewayServiceId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).TargetGatewayServiceId, global::System.Convert.ToString); + } + if (content.Contains("SourceStorageContainerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).SourceStorageContainerName = (string) content.GetValueForProperty("SourceStorageContainerName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).SourceStorageContainerName, global::System.Convert.ToString); + } + if (content.Contains("TargetStorageContainerName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).TargetStorageContainerName = (string) content.GetValueForProperty("TargetStorageContainerName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).TargetStorageContainerName, global::System.Convert.ToString); + } + if (content.Contains("ResourceLocation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).ResourceLocation = (string) content.GetValueForProperty("ResourceLocation",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).ResourceLocation, global::System.Convert.ToString); + } + if (content.Contains("SubscriptionId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).SubscriptionId, global::System.Convert.ToString); + } + if (content.Contains("ResourceGroup")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).ResourceGroup = (string) content.GetValueForProperty("ResourceGroup",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal)this).ResourceGroup, global::System.Convert.ToString); + } + if (content.Contains("InstanceType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCustomPropertiesInternal)this).InstanceType, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// VMware to AzStackHCI Replication extension model custom properties. + [System.ComponentModel.TypeConverter(typeof(VMwareToAzStackHcireplicationExtensionModelCustomPropertiesTypeConverter))] + public partial interface IVMwareToAzStackHcireplicationExtensionModelCustomProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcireplicationExtensionModelCustomProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcireplicationExtensionModelCustomProperties.TypeConverter.cs new file mode 100644 index 000000000000..663c97edbf7b --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcireplicationExtensionModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VMwareToAzStackHcireplicationExtensionModelCustomPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is + /// no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is + /// no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VMwareToAzStackHcireplicationExtensionModelCustomProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VMwareToAzStackHcireplicationExtensionModelCustomProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VMwareToAzStackHcireplicationExtensionModelCustomProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcireplicationExtensionModelCustomProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcireplicationExtensionModelCustomProperties.cs new file mode 100644 index 000000000000..ef7a9088a345 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcireplicationExtensionModelCustomProperties.cs @@ -0,0 +1,367 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// VMware to AzStackHCI Replication extension model custom properties. + public partial class VMwareToAzStackHcireplicationExtensionModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCustomProperties __replicationExtensionModelCustomProperties = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ReplicationExtensionModelCustomProperties(); + + /// Backing field for property. + private string _asrServiceUri; + + /// Gets or sets the Uri of ASR. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string AsrServiceUri { get => this._asrServiceUri; } + + /// Backing field for property. + private string _azStackHciFabricArmId; + + /// Gets or sets the ARM Id of the target AzStackHCI fabric. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string AzStackHciFabricArmId { get => this._azStackHciFabricArmId; set => this._azStackHciFabricArmId = value; } + + /// Backing field for property. + private string _azStackHciSiteId; + + /// Gets or sets the ARM Id of the AzStackHCI site. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string AzStackHciSiteId { get => this._azStackHciSiteId; } + + /// Backing field for property. + private string _gatewayServiceUri; + + /// Gets or sets the Uri of Gateway. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string GatewayServiceUri { get => this._gatewayServiceUri; } + + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string InstanceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCustomPropertiesInternal)__replicationExtensionModelCustomProperties).InstanceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCustomPropertiesInternal)__replicationExtensionModelCustomProperties).InstanceType = value ; } + + /// Internal Acessors for AsrServiceUri + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal.AsrServiceUri { get => this._asrServiceUri; set { {_asrServiceUri = value;} } } + + /// Internal Acessors for AzStackHciSiteId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal.AzStackHciSiteId { get => this._azStackHciSiteId; set { {_azStackHciSiteId = value;} } } + + /// Internal Acessors for GatewayServiceUri + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal.GatewayServiceUri { get => this._gatewayServiceUri; set { {_gatewayServiceUri = value;} } } + + /// Internal Acessors for RcmServiceUri + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal.RcmServiceUri { get => this._rcmServiceUri; set { {_rcmServiceUri = value;} } } + + /// Internal Acessors for ResourceGroup + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal.ResourceGroup { get => this._resourceGroup; set { {_resourceGroup = value;} } } + + /// Internal Acessors for ResourceLocation + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal.ResourceLocation { get => this._resourceLocation; set { {_resourceLocation = value;} } } + + /// Internal Acessors for SourceGatewayServiceId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal.SourceGatewayServiceId { get => this._sourceGatewayServiceId; set { {_sourceGatewayServiceId = value;} } } + + /// Internal Acessors for SourceStorageContainerName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal.SourceStorageContainerName { get => this._sourceStorageContainerName; set { {_sourceStorageContainerName = value;} } } + + /// Internal Acessors for SubscriptionId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal.SubscriptionId { get => this._subscriptionId; set { {_subscriptionId = value;} } } + + /// Internal Acessors for TargetGatewayServiceId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal.TargetGatewayServiceId { get => this._targetGatewayServiceId; set { {_targetGatewayServiceId = value;} } } + + /// Internal Acessors for TargetStorageContainerName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal.TargetStorageContainerName { get => this._targetStorageContainerName; set { {_targetStorageContainerName = value;} } } + + /// Internal Acessors for VmwareSiteId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal.VmwareSiteId { get => this._vmwareSiteId; set { {_vmwareSiteId = value;} } } + + /// Backing field for property. + private string _rcmServiceUri; + + /// Gets or sets the Uri of Rcm. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string RcmServiceUri { get => this._rcmServiceUri; } + + /// Backing field for property. + private string _resourceGroup; + + /// Gets or sets the resource group. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string ResourceGroup { get => this._resourceGroup; } + + /// Backing field for property. + private string _resourceLocation; + + /// Gets or sets the resource location. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string ResourceLocation { get => this._resourceLocation; } + + /// Backing field for property. + private string _sourceGatewayServiceId; + + /// Gets or sets the gateway service Id of source. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string SourceGatewayServiceId { get => this._sourceGatewayServiceId; } + + /// Backing field for property. + private string _sourceStorageContainerName; + + /// Gets or sets the source storage container name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string SourceStorageContainerName { get => this._sourceStorageContainerName; } + + /// Backing field for property. + private string _storageAccountId; + + /// Gets or sets the storage account Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string StorageAccountId { get => this._storageAccountId; set => this._storageAccountId = value; } + + /// Backing field for property. + private string _storageAccountSasSecretName; + + /// Gets or sets the Sas Secret of storage account. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string StorageAccountSasSecretName { get => this._storageAccountSasSecretName; set => this._storageAccountSasSecretName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// Gets or sets the subscription. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string SubscriptionId { get => this._subscriptionId; } + + /// Backing field for property. + private string _targetGatewayServiceId; + + /// Gets or sets the gateway service Id of target. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TargetGatewayServiceId { get => this._targetGatewayServiceId; } + + /// Backing field for property. + private string _targetStorageContainerName; + + /// Gets or sets the target storage container name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TargetStorageContainerName { get => this._targetStorageContainerName; } + + /// Backing field for property. + private string _vmwareFabricArmId; + + /// Gets or sets the ARM Id of the source VMware fabric. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string VmwareFabricArmId { get => this._vmwareFabricArmId; set => this._vmwareFabricArmId = value; } + + /// Backing field for property. + private string _vmwareSiteId; + + /// Gets or sets the ARM Id of the VMware site. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string VmwareSiteId { get => this._vmwareSiteId; } + + /// + /// Creates an new instance. + /// + public VMwareToAzStackHcireplicationExtensionModelCustomProperties() + { + + } + + /// 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.Migrate.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__replicationExtensionModelCustomProperties), __replicationExtensionModelCustomProperties); + await eventListener.AssertObjectIsValid(nameof(__replicationExtensionModelCustomProperties), __replicationExtensionModelCustomProperties); + } + } + /// VMware to AzStackHCI Replication extension model custom properties. + public partial interface IVMwareToAzStackHcireplicationExtensionModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCustomProperties + { + /// Gets or sets the Uri of ASR. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the Uri of ASR.", + SerializedName = @"asrServiceUri", + PossibleTypes = new [] { typeof(string) })] + string AsrServiceUri { get; } + /// Gets or sets the ARM Id of the target AzStackHCI fabric. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the ARM Id of the target AzStackHCI fabric.", + SerializedName = @"azStackHciFabricArmId", + PossibleTypes = new [] { typeof(string) })] + string AzStackHciFabricArmId { get; set; } + /// Gets or sets the ARM Id of the AzStackHCI site. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the ARM Id of the AzStackHCI site.", + SerializedName = @"azStackHciSiteId", + PossibleTypes = new [] { typeof(string) })] + string AzStackHciSiteId { get; } + /// Gets or sets the Uri of Gateway. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the Uri of Gateway.", + SerializedName = @"gatewayServiceUri", + PossibleTypes = new [] { typeof(string) })] + string GatewayServiceUri { get; } + /// Gets or sets the Uri of Rcm. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the Uri of Rcm.", + SerializedName = @"rcmServiceUri", + PossibleTypes = new [] { typeof(string) })] + string RcmServiceUri { get; } + /// Gets or sets the resource group. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the resource group.", + SerializedName = @"resourceGroup", + PossibleTypes = new [] { typeof(string) })] + string ResourceGroup { get; } + /// Gets or sets the resource location. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the resource location.", + SerializedName = @"resourceLocation", + PossibleTypes = new [] { typeof(string) })] + string ResourceLocation { get; } + /// Gets or sets the gateway service Id of source. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the gateway service Id of source.", + SerializedName = @"sourceGatewayServiceId", + PossibleTypes = new [] { typeof(string) })] + string SourceGatewayServiceId { get; } + /// Gets or sets the source storage container name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the source storage container name.", + SerializedName = @"sourceStorageContainerName", + PossibleTypes = new [] { typeof(string) })] + string SourceStorageContainerName { get; } + /// Gets or sets the storage account Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the storage account Id.", + SerializedName = @"storageAccountId", + PossibleTypes = new [] { typeof(string) })] + string StorageAccountId { get; set; } + /// Gets or sets the Sas Secret of storage account. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the Sas Secret of storage account.", + SerializedName = @"storageAccountSasSecretName", + PossibleTypes = new [] { typeof(string) })] + string StorageAccountSasSecretName { get; set; } + /// Gets or sets the subscription. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + string SubscriptionId { get; } + /// Gets or sets the gateway service Id of target. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the gateway service Id of target.", + SerializedName = @"targetGatewayServiceId", + PossibleTypes = new [] { typeof(string) })] + string TargetGatewayServiceId { get; } + /// Gets or sets the target storage container name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the target storage container name.", + SerializedName = @"targetStorageContainerName", + PossibleTypes = new [] { typeof(string) })] + string TargetStorageContainerName { get; } + /// Gets or sets the ARM Id of the source VMware fabric. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the ARM Id of the source VMware fabric.", + SerializedName = @"vmwareFabricArmId", + PossibleTypes = new [] { typeof(string) })] + string VmwareFabricArmId { get; set; } + /// Gets or sets the ARM Id of the VMware site. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the ARM Id of the VMware site.", + SerializedName = @"vmwareSiteId", + PossibleTypes = new [] { typeof(string) })] + string VmwareSiteId { get; } + + } + /// VMware to AzStackHCI Replication extension model custom properties. + internal partial interface IVMwareToAzStackHcireplicationExtensionModelCustomPropertiesInternal : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCustomPropertiesInternal + { + /// Gets or sets the Uri of ASR. + string AsrServiceUri { get; set; } + /// Gets or sets the ARM Id of the target AzStackHCI fabric. + string AzStackHciFabricArmId { get; set; } + /// Gets or sets the ARM Id of the AzStackHCI site. + string AzStackHciSiteId { get; set; } + /// Gets or sets the Uri of Gateway. + string GatewayServiceUri { get; set; } + /// Gets or sets the Uri of Rcm. + string RcmServiceUri { get; set; } + /// Gets or sets the resource group. + string ResourceGroup { get; set; } + /// Gets or sets the resource location. + string ResourceLocation { get; set; } + /// Gets or sets the gateway service Id of source. + string SourceGatewayServiceId { get; set; } + /// Gets or sets the source storage container name. + string SourceStorageContainerName { get; set; } + /// Gets or sets the storage account Id. + string StorageAccountId { get; set; } + /// Gets or sets the Sas Secret of storage account. + string StorageAccountSasSecretName { get; set; } + /// Gets or sets the subscription. + string SubscriptionId { get; set; } + /// Gets or sets the gateway service Id of target. + string TargetGatewayServiceId { get; set; } + /// Gets or sets the target storage container name. + string TargetStorageContainerName { get; set; } + /// Gets or sets the ARM Id of the source VMware fabric. + string VmwareFabricArmId { get; set; } + /// Gets or sets the ARM Id of the VMware site. + string VmwareSiteId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcireplicationExtensionModelCustomProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcireplicationExtensionModelCustomProperties.json.cs new file mode 100644 index 000000000000..8e1c50c527a1 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VMwareToAzStackHcireplicationExtensionModelCustomProperties.json.cs @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// VMware to AzStackHCI Replication extension model custom properties. + public partial class VMwareToAzStackHcireplicationExtensionModelCustomProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVMwareToAzStackHcireplicationExtensionModelCustomProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new VMwareToAzStackHcireplicationExtensionModelCustomProperties(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __replicationExtensionModelCustomProperties?.ToJson(container, serializationMode); + AddIf( null != (((object)this._vmwareFabricArmId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._vmwareFabricArmId.ToString()) : null, "vmwareFabricArmId" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._vmwareSiteId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._vmwareSiteId.ToString()) : null, "vmwareSiteId" ,container.Add ); + } + AddIf( null != (((object)this._azStackHciFabricArmId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._azStackHciFabricArmId.ToString()) : null, "azStackHciFabricArmId" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._azStackHciSiteId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._azStackHciSiteId.ToString()) : null, "azStackHciSiteId" ,container.Add ); + } + AddIf( null != (((object)this._storageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._storageAccountId.ToString()) : null, "storageAccountId" ,container.Add ); + AddIf( null != (((object)this._storageAccountSasSecretName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._storageAccountSasSecretName.ToString()) : null, "storageAccountSasSecretName" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._asrServiceUri)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._asrServiceUri.ToString()) : null, "asrServiceUri" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._rcmServiceUri)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._rcmServiceUri.ToString()) : null, "rcmServiceUri" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._gatewayServiceUri)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._gatewayServiceUri.ToString()) : null, "gatewayServiceUri" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._sourceGatewayServiceId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._sourceGatewayServiceId.ToString()) : null, "sourceGatewayServiceId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._targetGatewayServiceId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._targetGatewayServiceId.ToString()) : null, "targetGatewayServiceId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._sourceStorageContainerName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._sourceStorageContainerName.ToString()) : null, "sourceStorageContainerName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._targetStorageContainerName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._targetStorageContainerName.ToString()) : null, "targetStorageContainerName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._resourceLocation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._resourceLocation.ToString()) : null, "resourceLocation" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._subscriptionId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._subscriptionId.ToString()) : null, "subscriptionId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._resourceGroup)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._resourceGroup.ToString()) : null, "resourceGroup" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal VMwareToAzStackHcireplicationExtensionModelCustomProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __replicationExtensionModelCustomProperties = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ReplicationExtensionModelCustomProperties(json); + {_vmwareFabricArmId = If( json?.PropertyT("vmwareFabricArmId"), out var __jsonVmwareFabricArmId) ? (string)__jsonVmwareFabricArmId : (string)VmwareFabricArmId;} + {_vmwareSiteId = If( json?.PropertyT("vmwareSiteId"), out var __jsonVmwareSiteId) ? (string)__jsonVmwareSiteId : (string)VmwareSiteId;} + {_azStackHciFabricArmId = If( json?.PropertyT("azStackHciFabricArmId"), out var __jsonAzStackHciFabricArmId) ? (string)__jsonAzStackHciFabricArmId : (string)AzStackHciFabricArmId;} + {_azStackHciSiteId = If( json?.PropertyT("azStackHciSiteId"), out var __jsonAzStackHciSiteId) ? (string)__jsonAzStackHciSiteId : (string)AzStackHciSiteId;} + {_storageAccountId = If( json?.PropertyT("storageAccountId"), out var __jsonStorageAccountId) ? (string)__jsonStorageAccountId : (string)StorageAccountId;} + {_storageAccountSasSecretName = If( json?.PropertyT("storageAccountSasSecretName"), out var __jsonStorageAccountSasSecretName) ? (string)__jsonStorageAccountSasSecretName : (string)StorageAccountSasSecretName;} + {_asrServiceUri = If( json?.PropertyT("asrServiceUri"), out var __jsonAsrServiceUri) ? (string)__jsonAsrServiceUri : (string)AsrServiceUri;} + {_rcmServiceUri = If( json?.PropertyT("rcmServiceUri"), out var __jsonRcmServiceUri) ? (string)__jsonRcmServiceUri : (string)RcmServiceUri;} + {_gatewayServiceUri = If( json?.PropertyT("gatewayServiceUri"), out var __jsonGatewayServiceUri) ? (string)__jsonGatewayServiceUri : (string)GatewayServiceUri;} + {_sourceGatewayServiceId = If( json?.PropertyT("sourceGatewayServiceId"), out var __jsonSourceGatewayServiceId) ? (string)__jsonSourceGatewayServiceId : (string)SourceGatewayServiceId;} + {_targetGatewayServiceId = If( json?.PropertyT("targetGatewayServiceId"), out var __jsonTargetGatewayServiceId) ? (string)__jsonTargetGatewayServiceId : (string)TargetGatewayServiceId;} + {_sourceStorageContainerName = If( json?.PropertyT("sourceStorageContainerName"), out var __jsonSourceStorageContainerName) ? (string)__jsonSourceStorageContainerName : (string)SourceStorageContainerName;} + {_targetStorageContainerName = If( json?.PropertyT("targetStorageContainerName"), out var __jsonTargetStorageContainerName) ? (string)__jsonTargetStorageContainerName : (string)TargetStorageContainerName;} + {_resourceLocation = If( json?.PropertyT("resourceLocation"), out var __jsonResourceLocation) ? (string)__jsonResourceLocation : (string)ResourceLocation;} + {_subscriptionId = If( json?.PropertyT("subscriptionId"), out var __jsonSubscriptionId) ? (string)__jsonSubscriptionId : (string)SubscriptionId;} + {_resourceGroup = If( json?.PropertyT("resourceGroup"), out var __jsonResourceGroup) ? (string)__jsonResourceGroup : (string)ResourceGroup;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModel.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModel.PowerShell.cs new file mode 100644 index 000000000000..4dc10e49fd87 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModel.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Vault model. + [System.ComponentModel.TypeConverter(typeof(VaultModelTypeConverter))] + public partial class VaultModel + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModel DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VaultModel(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModel DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VaultModel(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModel FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VaultModel(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.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VaultModelPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModelTypeConverter.ConvertFrom); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VaultModelTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState.CreateFrom); + } + if (content.Contains("ServiceResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).ServiceResourceId = (string) content.GetValueForProperty("ServiceResourceId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).ServiceResourceId, global::System.Convert.ToString); + } + if (content.Contains("VaultType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).VaultType = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ReplicationVaultType?) content.GetValueForProperty("VaultType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).VaultType, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ReplicationVaultType.CreateFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).SystemDataLastModifiedAt, (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 VaultModel(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.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VaultModelPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModelTypeConverter.ConvertFrom); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VaultModelTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState.CreateFrom); + } + if (content.Contains("ServiceResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).ServiceResourceId = (string) content.GetValueForProperty("ServiceResourceId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).ServiceResourceId, global::System.Convert.ToString); + } + if (content.Contains("VaultType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).VaultType = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ReplicationVaultType?) content.GetValueForProperty("VaultType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).VaultType, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ReplicationVaultType.CreateFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializePSObject(content); + } + } + /// Vault model. + [System.ComponentModel.TypeConverter(typeof(VaultModelTypeConverter))] + public partial interface IVaultModel + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModel.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModel.TypeConverter.cs new file mode 100644 index 000000000000..77b240bc7f82 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModel.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VaultModelTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModel ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModel).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VaultModel.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VaultModel.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VaultModel.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModel.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModel.cs new file mode 100644 index 000000000000..c46067baf366 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModel.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Vault model. + public partial class VaultModel : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModel, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal + { + + /// Backing field for property. + private string _id; + + /// Gets or sets the Id of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Id { get => this._id; } + + /// Backing field for property. + private string _location; + + /// Gets or sets the location of the vault. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Location { get => this._location; set => this._location = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal.Id { get => this._id; set { {_id = value;} } } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal.Name { get => this._name; set { {_name = value;} } } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelProperties Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VaultModelProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal.ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelPropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelPropertiesInternal)Property).ProvisioningState = value; } + + /// Internal Acessors for ServiceResourceId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal.ServiceResourceId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelPropertiesInternal)Property).ServiceResourceId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelPropertiesInternal)Property).ServiceResourceId = value; } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal.SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel()); set { {_systemData = value;} } } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelInternal.Type { get => this._type; set { {_type = value;} } } + + /// Backing field for property. + private string _name; + + /// Gets or sets the name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Name { get => this._name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelProperties _property; + + /// Vault properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VaultModelProperties()); set => this._property = value; } + + /// Gets or sets the provisioning state of the vault. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState? ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelPropertiesInternal)Property).ProvisioningState; } + + /// Gets or sets the service resource Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string ServiceResourceId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelPropertiesInternal)Property).ServiceResourceId; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel _systemData; + + /// System data required to be defined for Azure resources. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel()); } + + /// Gets or sets the timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedByType = value ?? null; } + + /// Gets or sets the timestamp of resource last modification (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets the identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedByType = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelTags _tag; + + /// Gets or sets the resource tags. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VaultModelTags()); set => this._tag = value; } + + /// Backing field for property. + private string _type; + + /// Gets or sets the type of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Type { get => this._type; } + + /// Gets or sets the type of vault. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ReplicationVaultType? VaultType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelPropertiesInternal)Property).VaultType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelPropertiesInternal)Property).VaultType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ReplicationVaultType)""); } + + /// Creates an new instance. + public VaultModel() + { + + } + } + /// Vault model. + public partial interface IVaultModel : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the Id of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the Id of the resource.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; } + /// Gets or sets the location of the vault. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the location of the vault.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + string Location { get; set; } + /// Gets or sets the name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the name of the resource.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; } + /// Gets or sets the provisioning state of the vault. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the provisioning state of the vault.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState? ProvisioningState { get; } + /// Gets or sets the service resource Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the service resource Id.", + SerializedName = @"serviceResourceId", + PossibleTypes = new [] { typeof(string) })] + string ServiceResourceId { get; } + /// Gets or sets the timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the timestamp of resource creation (UTC).", + SerializedName = @"createdAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataCreatedAt { get; set; } + /// Gets or sets identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets identity that created the resource.", + SerializedName = @"createdBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataCreatedBy { get; set; } + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the type of identity that created the resource: user, application, + managedIdentity.", + SerializedName = @"createdByType", + PossibleTypes = new [] { typeof(string) })] + string SystemDataCreatedByType { get; set; } + /// Gets or sets the timestamp of resource last modification (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the timestamp of resource last modification (UTC).", + SerializedName = @"lastModifiedAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataLastModifiedAt { get; set; } + /// Gets or sets the identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the identity that last modified the resource.", + SerializedName = @"lastModifiedBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataLastModifiedBy { get; set; } + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the type of identity that last modified the resource: user, application, + managedIdentity.", + SerializedName = @"lastModifiedByType", + PossibleTypes = new [] { typeof(string) })] + string SystemDataLastModifiedByType { get; set; } + /// Gets or sets the resource tags. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelTags) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelTags Tag { get; set; } + /// Gets or sets the type of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the type of the resource.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; } + /// Gets or sets the type of vault. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the type of vault.", + SerializedName = @"vaultType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ReplicationVaultType) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ReplicationVaultType? VaultType { get; set; } + + } + /// Vault model. + internal partial interface IVaultModelInternal + + { + /// Gets or sets the Id of the resource. + string Id { get; set; } + /// Gets or sets the location of the vault. + string Location { get; set; } + /// Gets or sets the name of the resource. + string Name { get; set; } + /// Vault properties. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelProperties Property { get; set; } + /// Gets or sets the provisioning state of the vault. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState? ProvisioningState { get; set; } + /// Gets or sets the service resource Id. + string ServiceResourceId { get; set; } + /// System data required to be defined for Azure resources. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel SystemData { get; set; } + /// Gets or sets the timestamp of resource creation (UTC). + global::System.DateTime? SystemDataCreatedAt { get; set; } + /// Gets or sets identity that created the resource. + string SystemDataCreatedBy { get; set; } + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + string SystemDataCreatedByType { get; set; } + /// Gets or sets the timestamp of resource last modification (UTC). + global::System.DateTime? SystemDataLastModifiedAt { get; set; } + /// Gets or sets the identity that last modified the resource. + string SystemDataLastModifiedBy { get; set; } + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + string SystemDataLastModifiedByType { get; set; } + /// Gets or sets the resource tags. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelTags Tag { get; set; } + /// Gets or sets the type of the resource. + string Type { get; set; } + /// Gets or sets the type of vault. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ReplicationVaultType? VaultType { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModel.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModel.json.cs new file mode 100644 index 000000000000..a173034182b9 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModel.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Vault model. + public partial class VaultModel + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModel. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModel. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModel FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new VaultModel(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._systemData ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._systemData.ToJson(null,serializationMode) : null, "systemData" ,container.Add ); + } + AddIf( null != (((object)this._location)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._location.ToString()) : null, "location" ,container.Add ); + AddIf( null != this._tag ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._tag.ToJson(null,serializationMode) : null, "tags" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal VaultModel(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api20210216Preview.VaultModelProperties.FromJson(__jsonProperties) : Property;} + {_systemData = If( json?.PropertyT("systemData"), out var __jsonSystemData) ? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel.FromJson(__jsonSystemData) : SystemData;} + {_location = If( json?.PropertyT("location"), out var __jsonLocation) ? (string)__jsonLocation : (string)Location;} + {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VaultModelTags.FromJson(__jsonTags) : Tag;} + {_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); + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelCollection.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelCollection.PowerShell.cs new file mode 100644 index 000000000000..36f544a3d418 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelCollection.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Vault model collection. + [System.ComponentModel.TypeConverter(typeof(VaultModelCollectionTypeConverter))] + public partial class VaultModelCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VaultModelCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VaultModelCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VaultModelCollection(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.Migrate.Models.Api20210216Preview.IVaultModelCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModel[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VaultModelTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelCollectionInternal)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 VaultModelCollection(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.Migrate.Models.Api20210216Preview.IVaultModelCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModel[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VaultModelTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// Vault model collection. + [System.ComponentModel.TypeConverter(typeof(VaultModelCollectionTypeConverter))] + public partial interface IVaultModelCollection + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelCollection.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelCollection.TypeConverter.cs new file mode 100644 index 000000000000..0b0dffda95e8 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelCollection.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VaultModelCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VaultModelCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VaultModelCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VaultModelCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelCollection.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelCollection.cs new file mode 100644 index 000000000000..371df64789ec --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelCollection.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Vault model collection. + public partial class VaultModelCollection : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelCollection, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// Gets or sets the value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModel[] _value; + + /// Gets or sets the list of vaults. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModel[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public VaultModelCollection() + { + + } + } + /// Vault model collection. + public partial interface IVaultModelCollection : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the value of next link.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// Gets or sets the list of vaults. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the list of vaults.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModel) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModel[] Value { get; set; } + + } + /// Vault model collection. + internal partial interface IVaultModelCollectionInternal + + { + /// Gets or sets the value of next link. + string NextLink { get; set; } + /// Gets or sets the list of vaults. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModel[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelCollection.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelCollection.json.cs new file mode 100644 index 000000000000..4d43d83d30c8 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelCollection.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Vault model collection. + public partial class VaultModelCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new VaultModelCollection(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal VaultModelCollection(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Models.Api20210216Preview.IVaultModel) (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VaultModel.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/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelProperties.PowerShell.cs new file mode 100644 index 000000000000..1ea1af7720f2 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Vault properties. + [System.ComponentModel.TypeConverter(typeof(VaultModelPropertiesTypeConverter))] + public partial class VaultModelProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VaultModelProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VaultModelProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VaultModelProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelPropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelPropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState.CreateFrom); + } + if (content.Contains("ServiceResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelPropertiesInternal)this).ServiceResourceId = (string) content.GetValueForProperty("ServiceResourceId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelPropertiesInternal)this).ServiceResourceId, global::System.Convert.ToString); + } + if (content.Contains("VaultType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelPropertiesInternal)this).VaultType = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ReplicationVaultType?) content.GetValueForProperty("VaultType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelPropertiesInternal)this).VaultType, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ReplicationVaultType.CreateFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VaultModelProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelPropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelPropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState.CreateFrom); + } + if (content.Contains("ServiceResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelPropertiesInternal)this).ServiceResourceId = (string) content.GetValueForProperty("ServiceResourceId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelPropertiesInternal)this).ServiceResourceId, global::System.Convert.ToString); + } + if (content.Contains("VaultType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelPropertiesInternal)this).VaultType = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ReplicationVaultType?) content.GetValueForProperty("VaultType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelPropertiesInternal)this).VaultType, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ReplicationVaultType.CreateFrom); + } + AfterDeserializePSObject(content); + } + } + /// Vault properties. + [System.ComponentModel.TypeConverter(typeof(VaultModelPropertiesTypeConverter))] + public partial interface IVaultModelProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelProperties.TypeConverter.cs new file mode 100644 index 000000000000..216d40681093 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VaultModelPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VaultModelProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VaultModelProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VaultModelProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelProperties.cs new file mode 100644 index 000000000000..89f131ff57e8 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Vault properties. + public partial class VaultModelProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelPropertiesInternal + { + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelPropertiesInternal.ProvisioningState { get => this._provisioningState; set { {_provisioningState = value;} } } + + /// Internal Acessors for ServiceResourceId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelPropertiesInternal.ServiceResourceId { get => this._serviceResourceId; set { {_serviceResourceId = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState? _provisioningState; + + /// Gets or sets the provisioning state of the vault. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState? ProvisioningState { get => this._provisioningState; } + + /// Backing field for property. + private string _serviceResourceId; + + /// Gets or sets the service resource Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string ServiceResourceId { get => this._serviceResourceId; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ReplicationVaultType? _vaultType; + + /// Gets or sets the type of vault. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ReplicationVaultType? VaultType { get => this._vaultType; set => this._vaultType = value; } + + /// Creates an new instance. + public VaultModelProperties() + { + + } + } + /// Vault properties. + public partial interface IVaultModelProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the provisioning state of the vault. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the provisioning state of the vault.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState? ProvisioningState { get; } + /// Gets or sets the service resource Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the service resource Id.", + SerializedName = @"serviceResourceId", + PossibleTypes = new [] { typeof(string) })] + string ServiceResourceId { get; } + /// Gets or sets the type of vault. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the type of vault.", + SerializedName = @"vaultType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ReplicationVaultType) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ReplicationVaultType? VaultType { get; set; } + + } + /// Vault properties. + internal partial interface IVaultModelPropertiesInternal + + { + /// Gets or sets the provisioning state of the vault. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState? ProvisioningState { get; set; } + /// Gets or sets the service resource Id. + string ServiceResourceId { get; set; } + /// Gets or sets the type of vault. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ReplicationVaultType? VaultType { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelProperties.json.cs new file mode 100644 index 000000000000..5f4a3f5acac6 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Vault properties. + public partial class VaultModelProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new VaultModelProperties(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._serviceResourceId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._serviceResourceId.ToString()) : null, "serviceResourceId" ,container.Add ); + } + AddIf( null != (((object)this._vaultType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._vaultType.ToString()) : null, "vaultType" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal VaultModelProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)ProvisioningState;} + {_serviceResourceId = If( json?.PropertyT("serviceResourceId"), out var __jsonServiceResourceId) ? (string)__jsonServiceResourceId : (string)ServiceResourceId;} + {_vaultType = If( json?.PropertyT("vaultType"), out var __jsonVaultType) ? (string)__jsonVaultType : (string)VaultType;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelSystemData.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelSystemData.PowerShell.cs new file mode 100644 index 000000000000..c2c4b8d7c151 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelSystemData.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(VaultModelSystemDataTypeConverter))] + public partial class VaultModelSystemData + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelSystemData DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VaultModelSystemData(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelSystemData DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VaultModelSystemData(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelSystemData FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VaultModelSystemData(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy, global::System.Convert.ToString); + } + if (content.Contains("CreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType = (string) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType, global::System.Convert.ToString); + } + if (content.Contains("CreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType = (string) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt, (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 VaultModelSystemData(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy, global::System.Convert.ToString); + } + if (content.Contains("CreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType = (string) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType, global::System.Convert.ToString); + } + if (content.Contains("CreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType = (string) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializePSObject(content); + } + } + [System.ComponentModel.TypeConverter(typeof(VaultModelSystemDataTypeConverter))] + public partial interface IVaultModelSystemData + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelSystemData.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelSystemData.TypeConverter.cs new file mode 100644 index 000000000000..0edeed3897c1 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelSystemData.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VaultModelSystemDataTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelSystemData ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelSystemData).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VaultModelSystemData.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VaultModelSystemData.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VaultModelSystemData.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelSystemData.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelSystemData.cs new file mode 100644 index 000000000000..22eb0553adc1 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelSystemData.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + public partial class VaultModelSystemData : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelSystemData, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelSystemDataInternal, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel __systemDataModel = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel(); + + /// Gets or sets the timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public global::System.DateTime? CreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string CreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string CreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedByType = value ?? null; } + + /// Gets or sets the timestamp of resource last modification (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public global::System.DateTime? LastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets the identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string LastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string LastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedByType = 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.Migrate.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__systemDataModel), __systemDataModel); + await eventListener.AssertObjectIsValid(nameof(__systemDataModel), __systemDataModel); + } + + /// Creates an new instance. + public VaultModelSystemData() + { + + } + } + public partial interface IVaultModelSystemData : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel + { + + } + internal partial interface IVaultModelSystemDataInternal : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelSystemData.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelSystemData.json.cs new file mode 100644 index 000000000000..29e6a916268a --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelSystemData.json.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + public partial class VaultModelSystemData + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelSystemData. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelSystemData. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelSystemData FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new VaultModelSystemData(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __systemDataModel?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal VaultModelSystemData(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __systemDataModel = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel(json); + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelTags.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelTags.PowerShell.cs new file mode 100644 index 000000000000..9a261b121f74 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelTags.PowerShell.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Gets or sets the resource tags. + [System.ComponentModel.TypeConverter(typeof(VaultModelTagsTypeConverter))] + public partial class VaultModelTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VaultModelTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VaultModelTags(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VaultModelTags(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 VaultModelTags(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); + } + } + /// Gets or sets the resource tags. + [System.ComponentModel.TypeConverter(typeof(VaultModelTagsTypeConverter))] + public partial interface IVaultModelTags + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelTags.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelTags.TypeConverter.cs new file mode 100644 index 000000000000..e1bd222af960 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelTags.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VaultModelTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VaultModelTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VaultModelTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VaultModelTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelTags.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelTags.cs new file mode 100644 index 000000000000..0d1f97355602 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelTags.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Gets or sets the resource tags. + public partial class VaultModelTags : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelTags, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelTagsInternal + { + + /// Creates an new instance. + public VaultModelTags() + { + + } + } + /// Gets or sets the resource tags. + public partial interface IVaultModelTags : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IAssociativeArray + { + + } + /// Gets or sets the resource tags. + internal partial interface IVaultModelTagsInternal + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelTags.dictionary.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelTags.dictionary.cs new file mode 100644 index 000000000000..609de4c12ba7 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelTags.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + public partial class VaultModelTags : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Models.Api20210216Preview.VaultModelTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelTags.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelTags.json.cs new file mode 100644 index 000000000000..49783a92d09f --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelTags.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Gets or sets the resource tags. + public partial class VaultModelTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new VaultModelTags(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + /// + internal VaultModelTags(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelUpdate.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelUpdate.PowerShell.cs new file mode 100644 index 000000000000..afa497ec3cdf --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelUpdate.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Vault model for update. + [System.ComponentModel.TypeConverter(typeof(VaultModelUpdateTypeConverter))] + public partial class VaultModelUpdate + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdate DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VaultModelUpdate(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdate DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VaultModelUpdate(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdate FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VaultModelUpdate(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.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VaultModelPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModelTypeConverter.ConvertFrom); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VaultModelUpdateTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState.CreateFrom); + } + if (content.Contains("ServiceResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).ServiceResourceId = (string) content.GetValueForProperty("ServiceResourceId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).ServiceResourceId, global::System.Convert.ToString); + } + if (content.Contains("VaultType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).VaultType = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ReplicationVaultType?) content.GetValueForProperty("VaultType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).VaultType, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ReplicationVaultType.CreateFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).SystemDataLastModifiedAt, (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 VaultModelUpdate(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.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VaultModelPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModelTypeConverter.ConvertFrom); + } + if (content.Contains("Tag")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VaultModelUpdateTagsTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("ProvisioningState")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState.CreateFrom); + } + if (content.Contains("ServiceResourceId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).ServiceResourceId = (string) content.GetValueForProperty("ServiceResourceId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).ServiceResourceId, global::System.Convert.ToString); + } + if (content.Contains("VaultType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).VaultType = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ReplicationVaultType?) content.GetValueForProperty("VaultType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).VaultType, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ReplicationVaultType.CreateFrom); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializePSObject(content); + } + } + /// Vault model for update. + [System.ComponentModel.TypeConverter(typeof(VaultModelUpdateTypeConverter))] + public partial interface IVaultModelUpdate + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelUpdate.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelUpdate.TypeConverter.cs new file mode 100644 index 000000000000..d20134c3ac1e --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelUpdate.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VaultModelUpdateTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdate ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdate).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VaultModelUpdate.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VaultModelUpdate.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VaultModelUpdate.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelUpdate.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelUpdate.cs new file mode 100644 index 000000000000..40d0d90f2e0d --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelUpdate.cs @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Vault model for update. + public partial class VaultModelUpdate : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdate, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal + { + + /// Backing field for property. + private string _id; + + /// Gets or sets the Id of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Id { get => this._id; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal.Id { get => this._id; set { {_id = value;} } } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal.Name { get => this._name; set { {_name = value;} } } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelProperties Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VaultModelProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal.ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelPropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelPropertiesInternal)Property).ProvisioningState = value; } + + /// Internal Acessors for ServiceResourceId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal.ServiceResourceId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelPropertiesInternal)Property).ServiceResourceId; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelPropertiesInternal)Property).ServiceResourceId = value; } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal.SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel()); set { {_systemData = value;} } } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateInternal.Type { get => this._type; set { {_type = value;} } } + + /// Backing field for property. + private string _name; + + /// Gets or sets the name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Name { get => this._name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelProperties _property; + + /// Vault properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VaultModelProperties()); set => this._property = value; } + + /// Gets or sets the provisioning state of the vault. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState? ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelPropertiesInternal)Property).ProvisioningState; } + + /// Gets or sets the service resource Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string ServiceResourceId { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelPropertiesInternal)Property).ServiceResourceId; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel _systemData; + + /// System data required to be defined for Azure resources. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel()); } + + /// Gets or sets the timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedByType = value ?? null; } + + /// Gets or sets the timestamp of resource last modification (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets the identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedByType = value ?? null; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateTags _tag; + + /// Gets or sets the resource tags. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VaultModelUpdateTags()); set => this._tag = value; } + + /// Backing field for property. + private string _type; + + /// Gets or sets the type of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Type { get => this._type; } + + /// Gets or sets the type of vault. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ReplicationVaultType? VaultType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelPropertiesInternal)Property).VaultType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelPropertiesInternal)Property).VaultType = value ?? ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ReplicationVaultType)""); } + + /// Creates an new instance. + public VaultModelUpdate() + { + + } + } + /// Vault model for update. + public partial interface IVaultModelUpdate : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the Id of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the Id of the resource.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; } + /// Gets or sets the name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the name of the resource.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; } + /// Gets or sets the provisioning state of the vault. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the provisioning state of the vault.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState? ProvisioningState { get; } + /// Gets or sets the service resource Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the service resource Id.", + SerializedName = @"serviceResourceId", + PossibleTypes = new [] { typeof(string) })] + string ServiceResourceId { get; } + /// Gets or sets the timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the timestamp of resource creation (UTC).", + SerializedName = @"createdAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataCreatedAt { get; set; } + /// Gets or sets identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets identity that created the resource.", + SerializedName = @"createdBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataCreatedBy { get; set; } + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the type of identity that created the resource: user, application, + managedIdentity.", + SerializedName = @"createdByType", + PossibleTypes = new [] { typeof(string) })] + string SystemDataCreatedByType { get; set; } + /// Gets or sets the timestamp of resource last modification (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the timestamp of resource last modification (UTC).", + SerializedName = @"lastModifiedAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataLastModifiedAt { get; set; } + /// Gets or sets the identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the identity that last modified the resource.", + SerializedName = @"lastModifiedBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataLastModifiedBy { get; set; } + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the type of identity that last modified the resource: user, application, + managedIdentity.", + SerializedName = @"lastModifiedByType", + PossibleTypes = new [] { typeof(string) })] + string SystemDataLastModifiedByType { get; set; } + /// Gets or sets the resource tags. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the resource tags.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateTags) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateTags Tag { get; set; } + /// Gets or sets the type of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the type of the resource.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; } + /// Gets or sets the type of vault. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the type of vault.", + SerializedName = @"vaultType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ReplicationVaultType) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ReplicationVaultType? VaultType { get; set; } + + } + /// Vault model for update. + internal partial interface IVaultModelUpdateInternal + + { + /// Gets or sets the Id of the resource. + string Id { get; set; } + /// Gets or sets the name of the resource. + string Name { get; set; } + /// Vault properties. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelProperties Property { get; set; } + /// Gets or sets the provisioning state of the vault. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState? ProvisioningState { get; set; } + /// Gets or sets the service resource Id. + string ServiceResourceId { get; set; } + /// System data required to be defined for Azure resources. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel SystemData { get; set; } + /// Gets or sets the timestamp of resource creation (UTC). + global::System.DateTime? SystemDataCreatedAt { get; set; } + /// Gets or sets identity that created the resource. + string SystemDataCreatedBy { get; set; } + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + string SystemDataCreatedByType { get; set; } + /// Gets or sets the timestamp of resource last modification (UTC). + global::System.DateTime? SystemDataLastModifiedAt { get; set; } + /// Gets or sets the identity that last modified the resource. + string SystemDataLastModifiedBy { get; set; } + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + string SystemDataLastModifiedByType { get; set; } + /// Gets or sets the resource tags. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateTags Tag { get; set; } + /// Gets or sets the type of the resource. + string Type { get; set; } + /// Gets or sets the type of vault. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ReplicationVaultType? VaultType { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelUpdate.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelUpdate.json.cs new file mode 100644 index 000000000000..6f9e94028097 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelUpdate.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Vault model for update. + public partial class VaultModelUpdate + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdate. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdate. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdate FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new VaultModelUpdate(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._systemData ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._systemData.ToJson(null,serializationMode) : null, "systemData" ,container.Add ); + } + AddIf( null != this._tag ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._tag.ToJson(null,serializationMode) : null, "tags" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal VaultModelUpdate(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api20210216Preview.VaultModelProperties.FromJson(__jsonProperties) : Property;} + {_systemData = If( json?.PropertyT("systemData"), out var __jsonSystemData) ? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel.FromJson(__jsonSystemData) : SystemData;} + {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.VaultModelUpdateTags.FromJson(__jsonTags) : Tag;} + {_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); + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelUpdateSystemData.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelUpdateSystemData.PowerShell.cs new file mode 100644 index 000000000000..ba99207e9b02 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelUpdateSystemData.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(VaultModelUpdateSystemDataTypeConverter))] + public partial class VaultModelUpdateSystemData + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateSystemData DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VaultModelUpdateSystemData(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateSystemData DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VaultModelUpdateSystemData(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateSystemData FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VaultModelUpdateSystemData(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy, global::System.Convert.ToString); + } + if (content.Contains("CreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType = (string) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType, global::System.Convert.ToString); + } + if (content.Contains("CreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType = (string) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt, (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 VaultModelUpdateSystemData(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy, global::System.Convert.ToString); + } + if (content.Contains("CreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType = (string) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType, global::System.Convert.ToString); + } + if (content.Contains("CreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType = (string) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializePSObject(content); + } + } + [System.ComponentModel.TypeConverter(typeof(VaultModelUpdateSystemDataTypeConverter))] + public partial interface IVaultModelUpdateSystemData + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelUpdateSystemData.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelUpdateSystemData.TypeConverter.cs new file mode 100644 index 000000000000..cef3703ad50d --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelUpdateSystemData.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VaultModelUpdateSystemDataTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateSystemData ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateSystemData).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VaultModelUpdateSystemData.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VaultModelUpdateSystemData.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VaultModelUpdateSystemData.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelUpdateSystemData.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelUpdateSystemData.cs new file mode 100644 index 000000000000..042eb52a6740 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelUpdateSystemData.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + public partial class VaultModelUpdateSystemData : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateSystemData, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateSystemDataInternal, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel __systemDataModel = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel(); + + /// Gets or sets the timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public global::System.DateTime? CreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string CreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string CreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedByType = value ?? null; } + + /// Gets or sets the timestamp of resource last modification (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public global::System.DateTime? LastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets the identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string LastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string LastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedByType = 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.Migrate.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__systemDataModel), __systemDataModel); + await eventListener.AssertObjectIsValid(nameof(__systemDataModel), __systemDataModel); + } + + /// Creates an new instance. + public VaultModelUpdateSystemData() + { + + } + } + public partial interface IVaultModelUpdateSystemData : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel + { + + } + internal partial interface IVaultModelUpdateSystemDataInternal : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelUpdateSystemData.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelUpdateSystemData.json.cs new file mode 100644 index 000000000000..09404ee46b22 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelUpdateSystemData.json.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + public partial class VaultModelUpdateSystemData + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateSystemData. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateSystemData. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateSystemData FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new VaultModelUpdateSystemData(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __systemDataModel?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal VaultModelUpdateSystemData(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __systemDataModel = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel(json); + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelUpdateTags.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelUpdateTags.PowerShell.cs new file mode 100644 index 000000000000..be5910af93d5 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelUpdateTags.PowerShell.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Gets or sets the resource tags. + [System.ComponentModel.TypeConverter(typeof(VaultModelUpdateTagsTypeConverter))] + public partial class VaultModelUpdateTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VaultModelUpdateTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VaultModelUpdateTags(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VaultModelUpdateTags(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 VaultModelUpdateTags(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); + } + } + /// Gets or sets the resource tags. + [System.ComponentModel.TypeConverter(typeof(VaultModelUpdateTagsTypeConverter))] + public partial interface IVaultModelUpdateTags + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelUpdateTags.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelUpdateTags.TypeConverter.cs new file mode 100644 index 000000000000..c5e9b6761924 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelUpdateTags.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VaultModelUpdateTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VaultModelUpdateTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VaultModelUpdateTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VaultModelUpdateTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelUpdateTags.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelUpdateTags.cs new file mode 100644 index 000000000000..b3d94024f44c --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelUpdateTags.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Gets or sets the resource tags. + public partial class VaultModelUpdateTags : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateTags, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateTagsInternal + { + + /// Creates an new instance. + public VaultModelUpdateTags() + { + + } + } + /// Gets or sets the resource tags. + public partial interface IVaultModelUpdateTags : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IAssociativeArray + { + + } + /// Gets or sets the resource tags. + internal partial interface IVaultModelUpdateTagsInternal + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelUpdateTags.dictionary.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelUpdateTags.dictionary.cs new file mode 100644 index 000000000000..97a1a07f3283 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelUpdateTags.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + public partial class VaultModelUpdateTags : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Models.Api20210216Preview.VaultModelUpdateTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelUpdateTags.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelUpdateTags.json.cs new file mode 100644 index 000000000000..964248522b6f --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/VaultModelUpdateTags.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Gets or sets the resource tags. + public partial class VaultModelUpdateTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModelUpdateTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new VaultModelUpdateTags(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + /// + internal VaultModelUpdateTags(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModel.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModel.PowerShell.cs new file mode 100644 index 000000000000..714c7b68cd0e --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModel.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Workflow model. + [System.ComponentModel.TypeConverter(typeof(WorkflowModelTypeConverter))] + public partial class WorkflowModel + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new WorkflowModel(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new WorkflowModel(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal WorkflowModel(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModelTypeConverter.ConvertFrom); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal)this).SystemDataLastModifiedAt, (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 WorkflowModel(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("SystemData")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal)this).SystemData = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel) content.GetValueForProperty("SystemData",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal)this).SystemData, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModelTypeConverter.ConvertFrom); + } + if (content.Contains("Property")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelPropertiesTypeConverter.ConvertFrom); + } + if (content.Contains("Id")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal)this).Id, global::System.Convert.ToString); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal)this).SystemDataCreatedBy = (string) content.GetValueForProperty("SystemDataCreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal)this).SystemDataCreatedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal)this).SystemDataCreatedByType = (string) content.GetValueForProperty("SystemDataCreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal)this).SystemDataCreatedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataCreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal)this).SystemDataCreatedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataCreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal)this).SystemDataCreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("SystemDataLastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal)this).SystemDataLastModifiedBy = (string) content.GetValueForProperty("SystemDataLastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal)this).SystemDataLastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal)this).SystemDataLastModifiedByType = (string) content.GetValueForProperty("SystemDataLastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal)this).SystemDataLastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("SystemDataLastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal)this).SystemDataLastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("SystemDataLastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal)this).SystemDataLastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializePSObject(content); + } + } + /// Workflow model. + [System.ComponentModel.TypeConverter(typeof(WorkflowModelTypeConverter))] + public partial interface IWorkflowModel + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModel.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModel.TypeConverter.cs new file mode 100644 index 000000000000..b65bd20ed27d --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModel.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class WorkflowModelTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return WorkflowModel.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return WorkflowModel.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return WorkflowModel.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModel.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModel.cs new file mode 100644 index 000000000000..da5e2835c47b --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModel.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Workflow model. + public partial class WorkflowModel : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal + { + + /// Backing field for property. + private string _id; + + /// Gets or sets the Id of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Id { get => this._id; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal.Id { get => this._id; set { {_id = value;} } } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal.Name { get => this._name; set { {_name = value;} } } + + /// Internal Acessors for SystemData + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal.SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel()); set { {_systemData = value;} } } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelInternal.Type { get => this._type; set { {_type = value;} } } + + /// Backing field for property. + private string _name; + + /// Gets or sets the name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Name { get => this._name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelProperties _property; + + /// Workflow model properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelProperties()); set => this._property = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel _systemData; + + /// System data required to be defined for Azure resources. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel SystemData { get => (this._systemData = this._systemData ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel()); } + + /// Gets or sets the timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public global::System.DateTime? SystemDataCreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataCreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataCreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).CreatedByType = value ?? null; } + + /// Gets or sets the timestamp of resource last modification (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public global::System.DateTime? SystemDataLastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets the identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataLastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string SystemDataLastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)SystemData).LastModifiedByType = value ?? null; } + + /// Backing field for property. + private string _type; + + /// Gets or sets the type of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Type { get => this._type; } + + /// Creates an new instance. + public WorkflowModel() + { + + } + } + /// Workflow model. + public partial interface IWorkflowModel : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the Id of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the Id of the resource.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; } + /// Gets or sets the name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the name of the resource.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; } + /// Workflow model properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Workflow model properties.", + SerializedName = @"properties", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelProperties) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelProperties Property { get; set; } + /// Gets or sets the timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the timestamp of resource creation (UTC).", + SerializedName = @"createdAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataCreatedAt { get; set; } + /// Gets or sets identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets identity that created the resource.", + SerializedName = @"createdBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataCreatedBy { get; set; } + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the type of identity that created the resource: user, application, + managedIdentity.", + SerializedName = @"createdByType", + PossibleTypes = new [] { typeof(string) })] + string SystemDataCreatedByType { get; set; } + /// Gets or sets the timestamp of resource last modification (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the timestamp of resource last modification (UTC).", + SerializedName = @"lastModifiedAt", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? SystemDataLastModifiedAt { get; set; } + /// Gets or sets the identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the identity that last modified the resource.", + SerializedName = @"lastModifiedBy", + PossibleTypes = new [] { typeof(string) })] + string SystemDataLastModifiedBy { get; set; } + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the type of identity that last modified the resource: user, application, + managedIdentity.", + SerializedName = @"lastModifiedByType", + PossibleTypes = new [] { typeof(string) })] + string SystemDataLastModifiedByType { get; set; } + /// Gets or sets the type of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the type of the resource.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; } + + } + /// Workflow model. + internal partial interface IWorkflowModelInternal + + { + /// Gets or sets the Id of the resource. + string Id { get; set; } + /// Gets or sets the name of the resource. + string Name { get; set; } + /// Workflow model properties. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelProperties Property { get; set; } + /// System data required to be defined for Azure resources. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel SystemData { get; set; } + /// Gets or sets the timestamp of resource creation (UTC). + global::System.DateTime? SystemDataCreatedAt { get; set; } + /// Gets or sets identity that created the resource. + string SystemDataCreatedBy { get; set; } + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + string SystemDataCreatedByType { get; set; } + /// Gets or sets the timestamp of resource last modification (UTC). + global::System.DateTime? SystemDataLastModifiedAt { get; set; } + /// Gets or sets the identity that last modified the resource. + string SystemDataLastModifiedBy { get; set; } + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + string SystemDataLastModifiedByType { get; set; } + /// Gets or sets the type of the resource. + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModel.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModel.json.cs new file mode 100644 index 000000000000..3adad56471e2 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModel.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Workflow model. + public partial class WorkflowModel + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new WorkflowModel(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._systemData ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._systemData.ToJson(null,serializationMode) : null, "systemData" ,container.Add ); + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal WorkflowModel(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_systemData = If( json?.PropertyT("systemData"), out var __jsonSystemData) ? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel.FromJson(__jsonSystemData) : SystemData;} + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelProperties.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); + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelCollection.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelCollection.PowerShell.cs new file mode 100644 index 000000000000..eeecf48039f0 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelCollection.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Workflow model collection. + [System.ComponentModel.TypeConverter(typeof(WorkflowModelCollectionTypeConverter))] + public partial class WorkflowModelCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new WorkflowModelCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new WorkflowModelCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal WorkflowModelCollection(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.Migrate.Models.Api20210216Preview.IWorkflowModelCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCollectionInternal)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 WorkflowModelCollection(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.Migrate.Models.Api20210216Preview.IWorkflowModelCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCollectionInternal)this).NextLink, global::System.Convert.ToString); + } + AfterDeserializePSObject(content); + } + } + /// Workflow model collection. + [System.ComponentModel.TypeConverter(typeof(WorkflowModelCollectionTypeConverter))] + public partial interface IWorkflowModelCollection + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelCollection.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelCollection.TypeConverter.cs new file mode 100644 index 000000000000..dbf2498677c3 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelCollection.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class WorkflowModelCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return WorkflowModelCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return WorkflowModelCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return WorkflowModelCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelCollection.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelCollection.cs new file mode 100644 index 000000000000..6db01fe0b7eb --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelCollection.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Workflow model collection. + public partial class WorkflowModelCollection : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCollection, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// Gets or sets the value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel[] _value; + + /// Gets or sets the list of workflows. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public WorkflowModelCollection() + { + + } + } + /// Workflow model collection. + public partial interface IWorkflowModelCollection : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the value of next link. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the value of next link.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// Gets or sets the list of workflows. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the list of workflows.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel[] Value { get; set; } + + } + /// Workflow model collection. + internal partial interface IWorkflowModelCollectionInternal + + { + /// Gets or sets the value of next link. + string NextLink { get; set; } + /// Gets or sets the list of workflows. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelCollection.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelCollection.json.cs new file mode 100644 index 000000000000..ce86bc9d53fc --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelCollection.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Workflow model collection. + public partial class WorkflowModelCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new WorkflowModelCollection(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal WorkflowModelCollection(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Models.Api20210216Preview.IWorkflowModel) (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModel.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/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelCustomProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelCustomProperties.PowerShell.cs new file mode 100644 index 000000000000..bb34299525b2 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Workflow model custom properties. + [System.ComponentModel.TypeConverter(typeof(WorkflowModelCustomPropertiesTypeConverter))] + public partial class WorkflowModelCustomProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new WorkflowModelCustomProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new WorkflowModelCustomProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal WorkflowModelCustomProperties(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.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("AffectedObjectDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)this).AffectedObjectDetail = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesAffectedObjectDetails) content.GetValueForProperty("AffectedObjectDetail",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)this).AffectedObjectDetail, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetailsTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal WorkflowModelCustomProperties(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.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)this).InstanceType, global::System.Convert.ToString); + } + if (content.Contains("AffectedObjectDetail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)this).AffectedObjectDetail = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesAffectedObjectDetails) content.GetValueForProperty("AffectedObjectDetail",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal)this).AffectedObjectDetail, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetailsTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + } + /// Workflow model custom properties. + [System.ComponentModel.TypeConverter(typeof(WorkflowModelCustomPropertiesTypeConverter))] + public partial interface IWorkflowModelCustomProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelCustomProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelCustomProperties.TypeConverter.cs new file mode 100644 index 000000000000..7165b9768469 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelCustomProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class WorkflowModelCustomPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return WorkflowModelCustomProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return WorkflowModelCustomProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return WorkflowModelCustomProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelCustomProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelCustomProperties.cs new file mode 100644 index 000000000000..07a3ef176445 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Workflow model custom properties. + public partial class WorkflowModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesAffectedObjectDetails _affectedObjectDetail; + + /// Gets or sets any custom properties of the affected object. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesAffectedObjectDetails AffectedObjectDetail { get => (this._affectedObjectDetail = this._affectedObjectDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetails()); } + + /// Backing field for property. + private string _instanceType; + + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string InstanceType { get => this._instanceType; set => this._instanceType = value; } + + /// Internal Acessors for AffectedObjectDetail + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesAffectedObjectDetails Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesInternal.AffectedObjectDetail { get => (this._affectedObjectDetail = this._affectedObjectDetail ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetails()); set { {_affectedObjectDetail = value;} } } + + /// Creates an new instance. + public WorkflowModelCustomProperties() + { + + } + } + /// Workflow model custom properties. + public partial interface IWorkflowModelCustomProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets any custom properties of the affected object. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets any custom properties of the affected object.", + SerializedName = @"affectedObjectDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesAffectedObjectDetails) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesAffectedObjectDetails AffectedObjectDetail { get; } + /// Gets or sets the instance type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets or sets the instance type.", + SerializedName = @"instanceType", + PossibleTypes = new [] { typeof(string) })] + string InstanceType { get; set; } + + } + /// Workflow model custom properties. + internal partial interface IWorkflowModelCustomPropertiesInternal + + { + /// Gets or sets any custom properties of the affected object. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesAffectedObjectDetails AffectedObjectDetail { get; set; } + /// Gets or sets the instance type. + string InstanceType { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelCustomProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelCustomProperties.json.cs new file mode 100644 index 000000000000..453160520975 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelCustomProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Workflow model custom properties. + public partial class WorkflowModelCustomProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomProperties. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomProperties 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.Migrate.Models.Api20210216Preview.IWorkflowModelCustomProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("instanceType") ) + { + case "FailoverWorkflowDetails": + { + return new FailoverWorkflowModelCustomProperties(json); + } + case "TestFailoverCleanupWorkflowDetails": + { + return new TestFailoverCleanupWorkflowModelCustomProperties(json); + } + case "TestFailoverWorkflowDetails": + { + return new TestFailoverWorkflowModelCustomProperties(json); + } + } + return new WorkflowModelCustomProperties(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._instanceType.ToString()) : null, "instanceType" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._affectedObjectDetail ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._affectedObjectDetail.ToJson(null,serializationMode) : null, "affectedObjectDetails" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal WorkflowModelCustomProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetails.FromJson(__jsonAffectedObjectDetails) : AffectedObjectDetail;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelCustomPropertiesAffectedObjectDetails.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelCustomPropertiesAffectedObjectDetails.PowerShell.cs new file mode 100644 index 000000000000..1f6dde13893d --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelCustomPropertiesAffectedObjectDetails.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Gets or sets any custom properties of the affected object. + [System.ComponentModel.TypeConverter(typeof(WorkflowModelCustomPropertiesAffectedObjectDetailsTypeConverter))] + public partial class WorkflowModelCustomPropertiesAffectedObjectDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesAffectedObjectDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new WorkflowModelCustomPropertiesAffectedObjectDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesAffectedObjectDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new WorkflowModelCustomPropertiesAffectedObjectDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content + /// from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// + /// an instance of the model class. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesAffectedObjectDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal WorkflowModelCustomPropertiesAffectedObjectDetails(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 WorkflowModelCustomPropertiesAffectedObjectDetails(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); + } + } + /// Gets or sets any custom properties of the affected object. + [System.ComponentModel.TypeConverter(typeof(WorkflowModelCustomPropertiesAffectedObjectDetailsTypeConverter))] + public partial interface IWorkflowModelCustomPropertiesAffectedObjectDetails + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelCustomPropertiesAffectedObjectDetails.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelCustomPropertiesAffectedObjectDetails.TypeConverter.cs new file mode 100644 index 000000000000..46ab3edcded8 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelCustomPropertiesAffectedObjectDetails.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class WorkflowModelCustomPropertiesAffectedObjectDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a + /// type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable + /// conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesAffectedObjectDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesAffectedObjectDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return WorkflowModelCustomPropertiesAffectedObjectDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return WorkflowModelCustomPropertiesAffectedObjectDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return WorkflowModelCustomPropertiesAffectedObjectDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelCustomPropertiesAffectedObjectDetails.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelCustomPropertiesAffectedObjectDetails.cs new file mode 100644 index 000000000000..29083d3804e3 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelCustomPropertiesAffectedObjectDetails.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Gets or sets any custom properties of the affected object. + public partial class WorkflowModelCustomPropertiesAffectedObjectDetails : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesAffectedObjectDetails, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesAffectedObjectDetailsInternal + { + + /// + /// Creates an new instance. + /// + public WorkflowModelCustomPropertiesAffectedObjectDetails() + { + + } + } + /// Gets or sets any custom properties of the affected object. + public partial interface IWorkflowModelCustomPropertiesAffectedObjectDetails : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IAssociativeArray + { + + } + /// Gets or sets any custom properties of the affected object. + internal partial interface IWorkflowModelCustomPropertiesAffectedObjectDetailsInternal + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelCustomPropertiesAffectedObjectDetails.dictionary.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelCustomPropertiesAffectedObjectDetails.dictionary.cs new file mode 100644 index 000000000000..59740079c3cf --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelCustomPropertiesAffectedObjectDetails.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + public partial class WorkflowModelCustomPropertiesAffectedObjectDetails : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.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.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetails source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelCustomPropertiesAffectedObjectDetails.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelCustomPropertiesAffectedObjectDetails.json.cs new file mode 100644 index 000000000000..aa06b635d72e --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelCustomPropertiesAffectedObjectDetails.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Gets or sets any custom properties of the affected object. + public partial class WorkflowModelCustomPropertiesAffectedObjectDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesAffectedObjectDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesAffectedObjectDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomPropertiesAffectedObjectDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new WorkflowModelCustomPropertiesAffectedObjectDetails(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + /// + internal WorkflowModelCustomPropertiesAffectedObjectDetails(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelProperties.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelProperties.PowerShell.cs new file mode 100644 index 000000000000..4f15e43ac2f1 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelProperties.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Workflow model properties. + [System.ComponentModel.TypeConverter(typeof(WorkflowModelPropertiesTypeConverter))] + public partial class WorkflowModelProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new WorkflowModelProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new WorkflowModelProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal WorkflowModelProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).DisplayName, global::System.Convert.ToString); + } + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).State = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowState?) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).State, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowState.CreateFrom); + } + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).StartTime = (global::System.DateTime?) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)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.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).EndTime = (global::System.DateTime?) content.GetValueForProperty("EndTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)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("ObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).ObjectId = (string) content.GetValueForProperty("ObjectId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).ObjectId, global::System.Convert.ToString); + } + if (content.Contains("ObjectName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).ObjectName = (string) content.GetValueForProperty("ObjectName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).ObjectName, global::System.Convert.ToString); + } + if (content.Contains("ObjectInternalId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).ObjectInternalId = (string) content.GetValueForProperty("ObjectInternalId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).ObjectInternalId, global::System.Convert.ToString); + } + if (content.Contains("ObjectInternalName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).ObjectInternalName = (string) content.GetValueForProperty("ObjectInternalName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).ObjectInternalName, global::System.Convert.ToString); + } + if (content.Contains("ObjectType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).ObjectType = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowObjectType?) content.GetValueForProperty("ObjectType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).ObjectType, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowObjectType.CreateFrom); + } + if (content.Contains("ReplicationProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).ReplicationProviderId = (string) content.GetValueForProperty("ReplicationProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).ReplicationProviderId, global::System.Convert.ToString); + } + if (content.Contains("SourceFabricProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).SourceFabricProviderId = (string) content.GetValueForProperty("SourceFabricProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).SourceFabricProviderId, global::System.Convert.ToString); + } + if (content.Contains("TargetFabricProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).TargetFabricProviderId = (string) content.GetValueForProperty("TargetFabricProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).TargetFabricProviderId, global::System.Convert.ToString); + } + if (content.Contains("AllowedAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).AllowedAction = (string[]) content.GetValueForProperty("AllowedAction",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).AllowedAction, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("ActivityId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).ActivityId = (string) content.GetValueForProperty("ActivityId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).ActivityId, global::System.Convert.ToString); + } + if (content.Contains("Task")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).Task = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModel[]) content.GetValueForProperty("Task",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).Task, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.TaskModelTypeConverter.ConvertFrom)); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModel[]) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).Error, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ErrorModelTypeConverter.ConvertFrom)); + } + if (content.Contains("CustomProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).CustomProperty = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomProperties) content.GetValueForProperty("CustomProperty",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).CustomProperty, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal WorkflowModelProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("DisplayName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).DisplayName, global::System.Convert.ToString); + } + if (content.Contains("State")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).State = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowState?) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).State, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowState.CreateFrom); + } + if (content.Contains("StartTime")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).StartTime = (global::System.DateTime?) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)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.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).EndTime = (global::System.DateTime?) content.GetValueForProperty("EndTime",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)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("ObjectId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).ObjectId = (string) content.GetValueForProperty("ObjectId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).ObjectId, global::System.Convert.ToString); + } + if (content.Contains("ObjectName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).ObjectName = (string) content.GetValueForProperty("ObjectName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).ObjectName, global::System.Convert.ToString); + } + if (content.Contains("ObjectInternalId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).ObjectInternalId = (string) content.GetValueForProperty("ObjectInternalId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).ObjectInternalId, global::System.Convert.ToString); + } + if (content.Contains("ObjectInternalName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).ObjectInternalName = (string) content.GetValueForProperty("ObjectInternalName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).ObjectInternalName, global::System.Convert.ToString); + } + if (content.Contains("ObjectType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).ObjectType = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowObjectType?) content.GetValueForProperty("ObjectType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).ObjectType, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowObjectType.CreateFrom); + } + if (content.Contains("ReplicationProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).ReplicationProviderId = (string) content.GetValueForProperty("ReplicationProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).ReplicationProviderId, global::System.Convert.ToString); + } + if (content.Contains("SourceFabricProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).SourceFabricProviderId = (string) content.GetValueForProperty("SourceFabricProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).SourceFabricProviderId, global::System.Convert.ToString); + } + if (content.Contains("TargetFabricProviderId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).TargetFabricProviderId = (string) content.GetValueForProperty("TargetFabricProviderId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).TargetFabricProviderId, global::System.Convert.ToString); + } + if (content.Contains("AllowedAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).AllowedAction = (string[]) content.GetValueForProperty("AllowedAction",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).AllowedAction, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + } + if (content.Contains("ActivityId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).ActivityId = (string) content.GetValueForProperty("ActivityId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).ActivityId, global::System.Convert.ToString); + } + if (content.Contains("Task")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).Task = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModel[]) content.GetValueForProperty("Task",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).Task, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.TaskModelTypeConverter.ConvertFrom)); + } + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModel[]) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).Error, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ErrorModelTypeConverter.ConvertFrom)); + } + if (content.Contains("CustomProperty")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).CustomProperty = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomProperties) content.GetValueForProperty("CustomProperty",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal)this).CustomProperty, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesTypeConverter.ConvertFrom); + } + AfterDeserializePSObject(content); + } + } + /// Workflow model properties. + [System.ComponentModel.TypeConverter(typeof(WorkflowModelPropertiesTypeConverter))] + public partial interface IWorkflowModelProperties + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelProperties.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelProperties.TypeConverter.cs new file mode 100644 index 000000000000..0ac511b80a33 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelProperties.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class WorkflowModelPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return WorkflowModelProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return WorkflowModelProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return WorkflowModelProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelProperties.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelProperties.cs new file mode 100644 index 000000000000..a6e4d89b0352 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelProperties.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Workflow model properties. + public partial class WorkflowModelProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelProperties, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal + { + + /// Backing field for property. + private string _activityId; + + /// Gets or sets the workflow activity id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string ActivityId { get => this._activityId; } + + /// Backing field for property. + private string[] _allowedAction; + + /// Gets or sets the list of allowed actions on the workflow. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string[] AllowedAction { get => this._allowedAction; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomProperties _customProperty; + + /// Workflow model custom properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomProperties CustomProperty { get => (this._customProperty = this._customProperty ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomProperties()); set => this._customProperty = value; } + + /// Backing field for property. + private string _displayName; + + /// Gets or sets the friendly display name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string DisplayName { get => this._displayName; } + + /// Backing field for property. + private global::System.DateTime? _endTime; + + /// Gets or sets the end time. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public global::System.DateTime? EndTime { get => this._endTime; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModel[] _error; + + /// Gets or sets the list of errors. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModel[] Error { get => this._error; } + + /// Internal Acessors for ActivityId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal.ActivityId { get => this._activityId; set { {_activityId = value;} } } + + /// Internal Acessors for AllowedAction + string[] Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal.AllowedAction { get => this._allowedAction; set { {_allowedAction = value;} } } + + /// Internal Acessors for DisplayName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal.DisplayName { get => this._displayName; set { {_displayName = value;} } } + + /// Internal Acessors for EndTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal.EndTime { get => this._endTime; set { {_endTime = value;} } } + + /// Internal Acessors for Error + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModel[] Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal.Error { get => this._error; set { {_error = value;} } } + + /// Internal Acessors for ObjectId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal.ObjectId { get => this._objectId; set { {_objectId = value;} } } + + /// Internal Acessors for ObjectInternalId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal.ObjectInternalId { get => this._objectInternalId; set { {_objectInternalId = value;} } } + + /// Internal Acessors for ObjectInternalName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal.ObjectInternalName { get => this._objectInternalName; set { {_objectInternalName = value;} } } + + /// Internal Acessors for ObjectName + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal.ObjectName { get => this._objectName; set { {_objectName = value;} } } + + /// Internal Acessors for ObjectType + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowObjectType? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal.ObjectType { get => this._objectType; set { {_objectType = value;} } } + + /// Internal Acessors for ReplicationProviderId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal.ReplicationProviderId { get => this._replicationProviderId; set { {_replicationProviderId = value;} } } + + /// Internal Acessors for SourceFabricProviderId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal.SourceFabricProviderId { get => this._sourceFabricProviderId; set { {_sourceFabricProviderId = value;} } } + + /// Internal Acessors for StartTime + global::System.DateTime? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal.StartTime { get => this._startTime; set { {_startTime = value;} } } + + /// Internal Acessors for State + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowState? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal.State { get => this._state; set { {_state = value;} } } + + /// Internal Acessors for TargetFabricProviderId + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal.TargetFabricProviderId { get => this._targetFabricProviderId; set { {_targetFabricProviderId = value;} } } + + /// Internal Acessors for Task + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModel[] Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelPropertiesInternal.Task { get => this._task; set { {_task = value;} } } + + /// Backing field for property. + private string _objectId; + + /// Gets or sets the affected object Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string ObjectId { get => this._objectId; } + + /// Backing field for property. + private string _objectInternalId; + + /// Gets or sets the affected object internal Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string ObjectInternalId { get => this._objectInternalId; } + + /// Backing field for property. + private string _objectInternalName; + + /// Gets or sets the affected object internal name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string ObjectInternalName { get => this._objectInternalName; } + + /// Backing field for property. + private string _objectName; + + /// Gets or sets the affected object name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string ObjectName { get => this._objectName; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowObjectType? _objectType; + + /// Gets or sets the object type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowObjectType? ObjectType { get => this._objectType; } + + /// Backing field for property. + private string _replicationProviderId; + + /// Gets or sets the replication provider. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string ReplicationProviderId { get => this._replicationProviderId; } + + /// Backing field for property. + private string _sourceFabricProviderId; + + /// Gets or sets the source fabric provider. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string SourceFabricProviderId { get => this._sourceFabricProviderId; } + + /// Backing field for property. + private global::System.DateTime? _startTime; + + /// Gets or sets the start time. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public global::System.DateTime? StartTime { get => this._startTime; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowState? _state; + + /// Gets or sets the workflow state. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowState? State { get => this._state; } + + /// Backing field for property. + private string _targetFabricProviderId; + + /// Gets or sets the target fabric provider. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string TargetFabricProviderId { get => this._targetFabricProviderId; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModel[] _task; + + /// Gets or sets the list of tasks. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModel[] Task { get => this._task; } + + /// Creates an new instance. + public WorkflowModelProperties() + { + + } + } + /// Workflow model properties. + public partial interface IWorkflowModelProperties : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// Gets or sets the workflow activity id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the workflow activity id.", + SerializedName = @"activityId", + PossibleTypes = new [] { typeof(string) })] + string ActivityId { get; } + /// Gets or sets the list of allowed actions on the workflow. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the list of allowed actions on the workflow.", + SerializedName = @"allowedActions", + PossibleTypes = new [] { typeof(string) })] + string[] AllowedAction { get; } + /// Workflow model custom properties. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Workflow model custom properties.", + SerializedName = @"customProperties", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomProperties) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomProperties CustomProperty { get; set; } + /// Gets or sets the friendly display name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the friendly display name.", + SerializedName = @"displayName", + PossibleTypes = new [] { typeof(string) })] + string DisplayName { get; } + /// Gets or sets the end time. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the end time.", + SerializedName = @"endTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? EndTime { get; } + /// Gets or sets the list of errors. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the list of errors.", + SerializedName = @"errors", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModel) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModel[] Error { get; } + /// Gets or sets the affected object Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the affected object Id.", + SerializedName = @"objectId", + PossibleTypes = new [] { typeof(string) })] + string ObjectId { get; } + /// Gets or sets the affected object internal Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the affected object internal Id.", + SerializedName = @"objectInternalId", + PossibleTypes = new [] { typeof(string) })] + string ObjectInternalId { get; } + /// Gets or sets the affected object internal name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the affected object internal name.", + SerializedName = @"objectInternalName", + PossibleTypes = new [] { typeof(string) })] + string ObjectInternalName { get; } + /// Gets or sets the affected object name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the affected object name.", + SerializedName = @"objectName", + PossibleTypes = new [] { typeof(string) })] + string ObjectName { get; } + /// Gets or sets the object type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the object type.", + SerializedName = @"objectType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowObjectType) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowObjectType? ObjectType { get; } + /// Gets or sets the replication provider. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the replication provider.", + SerializedName = @"replicationProviderId", + PossibleTypes = new [] { typeof(string) })] + string ReplicationProviderId { get; } + /// Gets or sets the source fabric provider. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the source fabric provider.", + SerializedName = @"sourceFabricProviderId", + PossibleTypes = new [] { typeof(string) })] + string SourceFabricProviderId { get; } + /// Gets or sets the start time. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the start time.", + SerializedName = @"startTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? StartTime { get; } + /// Gets or sets the workflow state. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the workflow state.", + SerializedName = @"state", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowState) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowState? State { get; } + /// Gets or sets the target fabric provider. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the target fabric provider.", + SerializedName = @"targetFabricProviderId", + PossibleTypes = new [] { typeof(string) })] + string TargetFabricProviderId { get; } + /// Gets or sets the list of tasks. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the list of tasks.", + SerializedName = @"tasks", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModel) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModel[] Task { get; } + + } + /// Workflow model properties. + internal partial interface IWorkflowModelPropertiesInternal + + { + /// Gets or sets the workflow activity id. + string ActivityId { get; set; } + /// Gets or sets the list of allowed actions on the workflow. + string[] AllowedAction { get; set; } + /// Workflow model custom properties. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelCustomProperties CustomProperty { get; set; } + /// Gets or sets the friendly display name. + string DisplayName { get; set; } + /// Gets or sets the end time. + global::System.DateTime? EndTime { get; set; } + /// Gets or sets the list of errors. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IErrorModel[] Error { get; set; } + /// Gets or sets the affected object Id. + string ObjectId { get; set; } + /// Gets or sets the affected object internal Id. + string ObjectInternalId { get; set; } + /// Gets or sets the affected object internal name. + string ObjectInternalName { get; set; } + /// Gets or sets the affected object name. + string ObjectName { get; set; } + /// Gets or sets the object type. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowObjectType? ObjectType { get; set; } + /// Gets or sets the replication provider. + string ReplicationProviderId { get; set; } + /// Gets or sets the source fabric provider. + string SourceFabricProviderId { get; set; } + /// Gets or sets the start time. + global::System.DateTime? StartTime { get; set; } + /// Gets or sets the workflow state. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowState? State { get; set; } + /// Gets or sets the target fabric provider. + string TargetFabricProviderId { get; set; } + /// Gets or sets the list of tasks. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ITaskModel[] Task { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelProperties.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelProperties.json.cs new file mode 100644 index 000000000000..48623bbd729b --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelProperties.json.cs @@ -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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Workflow model properties. + public partial class WorkflowModelProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new WorkflowModelProperties(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._displayName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._displayName.ToString()) : null, "displayName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._state)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._state.ToString()) : null, "state" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._startTime ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._endTime ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._endTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "endTime" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._objectId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._objectId.ToString()) : null, "objectId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._objectName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._objectName.ToString()) : null, "objectName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._objectInternalId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._objectInternalId.ToString()) : null, "objectInternalId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._objectInternalName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._objectInternalName.ToString()) : null, "objectInternalName" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._objectType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._objectType.ToString()) : null, "objectType" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._replicationProviderId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._replicationProviderId.ToString()) : null, "replicationProviderId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._sourceFabricProviderId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._sourceFabricProviderId.ToString()) : null, "sourceFabricProviderId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._targetFabricProviderId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._targetFabricProviderId.ToString()) : null, "targetFabricProviderId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._allowedAction) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.XNodeArray(); + foreach( var __x in this._allowedAction ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("allowedActions",__w); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._activityId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._activityId.ToString()) : null, "activityId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._task) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.XNodeArray(); + foreach( var __s in this._task ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("tasks",__r); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._error) + { + var __m = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.XNodeArray(); + foreach( var __n in this._error ) + { + AddIf(__n?.ToJson(null, serializationMode) ,__m.Add); + } + container.Add("errors",__m); + } + } + AddIf( null != this._customProperty ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._customProperty.ToJson(null,serializationMode) : null, "customProperties" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal WorkflowModelProperties(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_displayName = If( json?.PropertyT("displayName"), out var __jsonDisplayName) ? (string)__jsonDisplayName : (string)DisplayName;} + {_state = If( json?.PropertyT("state"), out var __jsonState) ? (string)__jsonState : (string)State;} + {_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;} + {_objectId = If( json?.PropertyT("objectId"), out var __jsonObjectId) ? (string)__jsonObjectId : (string)ObjectId;} + {_objectName = If( json?.PropertyT("objectName"), out var __jsonObjectName) ? (string)__jsonObjectName : (string)ObjectName;} + {_objectInternalId = If( json?.PropertyT("objectInternalId"), out var __jsonObjectInternalId) ? (string)__jsonObjectInternalId : (string)ObjectInternalId;} + {_objectInternalName = If( json?.PropertyT("objectInternalName"), out var __jsonObjectInternalName) ? (string)__jsonObjectInternalName : (string)ObjectInternalName;} + {_objectType = If( json?.PropertyT("objectType"), out var __jsonObjectType) ? (string)__jsonObjectType : (string)ObjectType;} + {_replicationProviderId = If( json?.PropertyT("replicationProviderId"), out var __jsonReplicationProviderId) ? (string)__jsonReplicationProviderId : (string)ReplicationProviderId;} + {_sourceFabricProviderId = If( json?.PropertyT("sourceFabricProviderId"), out var __jsonSourceFabricProviderId) ? (string)__jsonSourceFabricProviderId : (string)SourceFabricProviderId;} + {_targetFabricProviderId = If( json?.PropertyT("targetFabricProviderId"), out var __jsonTargetFabricProviderId) ? (string)__jsonTargetFabricProviderId : (string)TargetFabricProviderId;} + {_allowedAction = If( json?.PropertyT("allowedActions"), out var __jsonAllowedActions) ? If( __jsonAllowedActions as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : AllowedAction;} + {_activityId = If( json?.PropertyT("activityId"), out var __jsonActivityId) ? (string)__jsonActivityId : (string)ActivityId;} + {_task = If( json?.PropertyT("tasks"), out var __jsonTasks) ? If( __jsonTasks as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api20210216Preview.ITaskModel) (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.TaskModel.FromJson(__p) )) ))() : null : Task;} + {_error = If( json?.PropertyT("errors"), out var __jsonErrors) ? If( __jsonErrors as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api20210216Preview.IErrorModel) (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ErrorModel.FromJson(__k) )) ))() : null : Error;} + {_customProperty = If( json?.PropertyT("customProperties"), out var __jsonCustomProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomProperties.FromJson(__jsonCustomProperties) : CustomProperty;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelSystemData.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelSystemData.PowerShell.cs new file mode 100644 index 000000000000..f6cc9bd1214a --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelSystemData.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.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(WorkflowModelSystemDataTypeConverter))] + public partial class WorkflowModelSystemData + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelSystemData DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new WorkflowModelSystemData(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelSystemData DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new WorkflowModelSystemData(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelSystemData FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal WorkflowModelSystemData(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy, global::System.Convert.ToString); + } + if (content.Contains("CreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType = (string) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType, global::System.Convert.ToString); + } + if (content.Contains("CreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType = (string) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt, (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 WorkflowModelSystemData(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("CreatedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy = (string) content.GetValueForProperty("CreatedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedBy, global::System.Convert.ToString); + } + if (content.Contains("CreatedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType = (string) content.GetValueForProperty("CreatedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedByType, global::System.Convert.ToString); + } + if (content.Contains("CreatedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt = (global::System.DateTime?) content.GetValueForProperty("CreatedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).CreatedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + if (content.Contains("LastModifiedBy")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy = (string) content.GetValueForProperty("LastModifiedBy",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedBy, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedByType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType = (string) content.GetValueForProperty("LastModifiedByType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedByType, global::System.Convert.ToString); + } + if (content.Contains("LastModifiedAt")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt = (global::System.DateTime?) content.GetValueForProperty("LastModifiedAt",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)this).LastModifiedAt, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + } + AfterDeserializePSObject(content); + } + } + [System.ComponentModel.TypeConverter(typeof(WorkflowModelSystemDataTypeConverter))] + public partial interface IWorkflowModelSystemData + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelSystemData.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelSystemData.TypeConverter.cs new file mode 100644 index 000000000000..1d7cbbc442f5 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelSystemData.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class WorkflowModelSystemDataTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelSystemData ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelSystemData).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return WorkflowModelSystemData.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return WorkflowModelSystemData.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return WorkflowModelSystemData.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelSystemData.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelSystemData.cs new file mode 100644 index 000000000000..9f92fc894a0e --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelSystemData.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + public partial class WorkflowModelSystemData : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelSystemData, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelSystemDataInternal, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel __systemDataModel = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel(); + + /// Gets or sets the timestamp of resource creation (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public global::System.DateTime? CreatedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets identity that created the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string CreatedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that created the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string CreatedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).CreatedByType = value ?? null; } + + /// Gets or sets the timestamp of resource last modification (UTC). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public global::System.DateTime? LastModifiedAt { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedAt; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedAt = value ?? default(global::System.DateTime); } + + /// Gets or sets the identity that last modified the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string LastModifiedBy { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedBy; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedBy = value ?? null; } + + /// + /// Gets or sets the type of identity that last modified the resource: user, application, + /// managedIdentity. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inherited)] + public string LastModifiedByType { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedByType; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal)__systemDataModel).LastModifiedByType = 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.Migrate.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__systemDataModel), __systemDataModel); + await eventListener.AssertObjectIsValid(nameof(__systemDataModel), __systemDataModel); + } + + /// Creates an new instance. + public WorkflowModelSystemData() + { + + } + } + public partial interface IWorkflowModelSystemData : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModel + { + + } + internal partial interface IWorkflowModelSystemDataInternal : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ISystemDataModelInternal + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelSystemData.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelSystemData.json.cs new file mode 100644 index 000000000000..8f7d620bf879 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api20210216Preview/WorkflowModelSystemData.json.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.Migrate.Models.Api20210216Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + public partial class WorkflowModelSystemData + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelSystemData. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelSystemData. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModelSystemData FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new WorkflowModelSystemData(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __systemDataModel?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal WorkflowModelSystemData(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __systemDataModel = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.SystemDataModel(json); + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/ErrorAdditionalInfo.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/ErrorAdditionalInfo.PowerShell.cs new file mode 100644 index 000000000000..63676b048e3a --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/ErrorAdditionalInfo.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.Migrate.Models.Api40 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// The resource management error additional info. + [System.ComponentModel.TypeConverter(typeof(ErrorAdditionalInfoTypeConverter))] + public partial class ErrorAdditionalInfo + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorAdditionalInfo DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ErrorAdditionalInfo(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorAdditionalInfo DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ErrorAdditionalInfo(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ErrorAdditionalInfo(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorAdditionalInfoInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorAdditionalInfoInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Info")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorAdditionalInfoInternal)this).Info = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IAny) content.GetValueForProperty("Info",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorAdditionalInfoInternal)this).Info, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.AnyTypeConverter.ConvertFrom); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ErrorAdditionalInfo(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Type")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorAdditionalInfoInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorAdditionalInfoInternal)this).Type, global::System.Convert.ToString); + } + if (content.Contains("Info")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorAdditionalInfoInternal)this).Info = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IAny) content.GetValueForProperty("Info",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorAdditionalInfoInternal)this).Info, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.AnyTypeConverter.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.Migrate.Models.Api40.IErrorAdditionalInfo FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The resource management error additional info. + [System.ComponentModel.TypeConverter(typeof(ErrorAdditionalInfoTypeConverter))] + public partial interface IErrorAdditionalInfo + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/ErrorAdditionalInfo.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/ErrorAdditionalInfo.TypeConverter.cs new file mode 100644 index 000000000000..cf54bb3b47cb --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/ErrorAdditionalInfo.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ErrorAdditionalInfoTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorAdditionalInfo ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorAdditionalInfo).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ErrorAdditionalInfo.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ErrorAdditionalInfo.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ErrorAdditionalInfo.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/ErrorAdditionalInfo.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/ErrorAdditionalInfo.cs new file mode 100644 index 000000000000..5aea6a6a19ed --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/ErrorAdditionalInfo.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.Migrate.Models.Api40 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// The resource management error additional info. + public partial class ErrorAdditionalInfo : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorAdditionalInfo, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorAdditionalInfoInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IAny _info; + + /// The additional info. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IAny Info { get => (this._info = this._info ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Any()); } + + /// Internal Acessors for Info + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IAny Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorAdditionalInfoInternal.Info { get => (this._info = this._info ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Any()); set { {_info = value;} } } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorAdditionalInfoInternal.Type { get => this._type; set { {_type = value;} } } + + /// Backing field for property. + private string _type; + + /// The additional info type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Type { get => this._type; } + + /// Creates an new instance. + public ErrorAdditionalInfo() + { + + } + } + /// The resource management error additional info. + public partial interface IErrorAdditionalInfo : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// The additional info. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The additional info.", + SerializedName = @"info", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IAny) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IAny Info { get; } + /// The additional info type. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The additional info type.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; } + + } + /// The resource management error additional info. + internal partial interface IErrorAdditionalInfoInternal + + { + /// The additional info. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IAny Info { get; set; } + /// The additional info type. + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/ErrorAdditionalInfo.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/ErrorAdditionalInfo.json.cs new file mode 100644 index 000000000000..b488b6da7a70 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/ErrorAdditionalInfo.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.Migrate.Models.Api40 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// The resource management error additional info. + public partial class ErrorAdditionalInfo + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal ErrorAdditionalInfo(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)Type;} + {_info = If( json?.PropertyT("info"), out var __jsonInfo) ? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Any.FromJson(__jsonInfo) : Info;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorAdditionalInfo. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorAdditionalInfo. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorAdditionalInfo FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new ErrorAdditionalInfo(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._info ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._info.ToJson(null,serializationMode) : null, "info" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/ErrorDetail.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/ErrorDetail.PowerShell.cs new file mode 100644 index 000000000000..99a6d15e0aee --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/ErrorDetail.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.Migrate.Models.Api40 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// The error detail. + [System.ComponentModel.TypeConverter(typeof(ErrorDetailTypeConverter))] + public partial class ErrorDetail + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetail DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ErrorDetail(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetail DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ErrorDetail(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ErrorDetail(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.Migrate.Models.Api40.IErrorDetailInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetailInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetailInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetailInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetailInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetailInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetailInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetail[]) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetailInternal)this).Detail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorDetailTypeConverter.ConvertFrom)); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetailInternal)this).AdditionalInfo = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorAdditionalInfo[]) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetailInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorAdditionalInfoTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ErrorDetail(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.Migrate.Models.Api40.IErrorDetailInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetailInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetailInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetailInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetailInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetailInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetailInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetail[]) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetailInternal)this).Detail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorDetailTypeConverter.ConvertFrom)); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetailInternal)this).AdditionalInfo = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorAdditionalInfo[]) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetailInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorAdditionalInfoTypeConverter.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.Migrate.Models.Api40.IErrorDetail FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The error detail. + [System.ComponentModel.TypeConverter(typeof(ErrorDetailTypeConverter))] + public partial interface IErrorDetail + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/ErrorDetail.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/ErrorDetail.TypeConverter.cs new file mode 100644 index 000000000000..e5ca2a0d7b1f --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/ErrorDetail.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ErrorDetailTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetail ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetail).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ErrorDetail.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ErrorDetail.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ErrorDetail.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/ErrorDetail.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/ErrorDetail.cs new file mode 100644 index 000000000000..7441feafbc4c --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/ErrorDetail.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.Migrate.Models.Api40 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// The error detail. + public partial class ErrorDetail : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetail, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetailInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorAdditionalInfo[] _additionalInfo; + + /// The error additional info. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorAdditionalInfo[] AdditionalInfo { get => this._additionalInfo; } + + /// Backing field for property. + private string _code; + + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Code { get => this._code; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetail[] _detail; + + /// The error details. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetail[] Detail { get => this._detail; } + + /// Backing field for property. + private string _message; + + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Message { get => this._message; } + + /// Internal Acessors for AdditionalInfo + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorAdditionalInfo[] Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetailInternal.AdditionalInfo { get => this._additionalInfo; set { {_additionalInfo = value;} } } + + /// Internal Acessors for Code + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetailInternal.Code { get => this._code; set { {_code = value;} } } + + /// Internal Acessors for Detail + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetail[] Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetailInternal.Detail { get => this._detail; set { {_detail = value;} } } + + /// Internal Acessors for Message + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetailInternal.Message { get => this._message; set { {_message = value;} } } + + /// Internal Acessors for Target + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetailInternal.Target { get => this._target; set { {_target = value;} } } + + /// Backing field for property. + private string _target; + + /// The error target. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Target { get => this._target; } + + /// Creates an new instance. + public ErrorDetail() + { + + } + } + /// The error detail. + public partial interface IErrorDetail : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// The error additional info. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error additional info.", + SerializedName = @"additionalInfo", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorAdditionalInfo) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorAdditionalInfo[] AdditionalInfo { get; } + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string Code { get; } + /// The error details. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error details.", + SerializedName = @"details", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetail) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetail[] Detail { get; } + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error message.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; } + /// The error target. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error target.", + SerializedName = @"target", + PossibleTypes = new [] { typeof(string) })] + string Target { get; } + + } + /// The error detail. + internal partial interface IErrorDetailInternal + + { + /// The error additional info. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorAdditionalInfo[] AdditionalInfo { get; set; } + /// The error code. + string Code { get; set; } + /// The error details. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetail[] Detail { get; set; } + /// The error message. + string Message { get; set; } + /// The error target. + string Target { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/ErrorDetail.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/ErrorDetail.json.cs new file mode 100644 index 000000000000..04d8b145400a --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/ErrorDetail.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.Migrate.Models.Api40 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// The error detail. + public partial class ErrorDetail + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal ErrorDetail(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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;} + {_target = If( json?.PropertyT("target"), out var __jsonTarget) ? (string)__jsonTarget : (string)Target;} + {_detail = If( json?.PropertyT("details"), out var __jsonDetails) ? If( __jsonDetails as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api40.IErrorDetail) (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorDetail.FromJson(__u) )) ))() : null : Detail;} + {_additionalInfo = If( json?.PropertyT("additionalInfo"), out var __jsonAdditionalInfo) ? If( __jsonAdditionalInfo as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api40.IErrorAdditionalInfo) (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorAdditionalInfo.FromJson(__p) )) ))() : null : AdditionalInfo;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetail. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetail. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetail FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new ErrorDetail(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._code)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._code.ToString()) : null, "code" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._message)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._message.ToString()) : null, "message" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._target)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._target.ToString()) : null, "target" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._detail) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.XNodeArray(); + foreach( var __x in this._detail ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("details",__w); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._additionalInfo) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.XNodeArray(); + foreach( var __s in this._additionalInfo ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("additionalInfo",__r); + } + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/ErrorResponse.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/ErrorResponse.PowerShell.cs new file mode 100644 index 000000000000..55e1a0302a7a --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/ErrorResponse.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.Migrate.Models.Api40 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows + /// the OData error response format.). + /// + [System.ComponentModel.TypeConverter(typeof(ErrorResponseTypeConverter))] + public partial class ErrorResponse + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ErrorResponse(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ErrorResponse(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ErrorResponse(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponseInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetail) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponseInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorDetailTypeConverter.ConvertFrom); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponseInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponseInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponseInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponseInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponseInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetail[]) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponseInternal)this).Detail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorDetailTypeConverter.ConvertFrom)); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponseInternal)this).AdditionalInfo = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorAdditionalInfo[]) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponseInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorAdditionalInfoTypeConverter.ConvertFrom)); + } + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ErrorResponse(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + if (content.Contains("Error")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponseInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetail) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponseInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorDetailTypeConverter.ConvertFrom); + } + if (content.Contains("Code")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponseInternal)this).Code, global::System.Convert.ToString); + } + if (content.Contains("Message")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponseInternal)this).Message, global::System.Convert.ToString); + } + if (content.Contains("Target")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponseInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponseInternal)this).Target, global::System.Convert.ToString); + } + if (content.Contains("Detail")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponseInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetail[]) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponseInternal)this).Detail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorDetailTypeConverter.ConvertFrom)); + } + if (content.Contains("AdditionalInfo")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponseInternal)this).AdditionalInfo = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorAdditionalInfo[]) content.GetValueForProperty("AdditionalInfo",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponseInternal)this).AdditionalInfo, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorAdditionalInfoTypeConverter.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.Migrate.Models.Api40.IErrorResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows + /// the OData error response format.). + [System.ComponentModel.TypeConverter(typeof(ErrorResponseTypeConverter))] + public partial interface IErrorResponse + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/ErrorResponse.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/ErrorResponse.TypeConverter.cs new file mode 100644 index 000000000000..2a338f86ba82 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/ErrorResponse.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ErrorResponseTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ErrorResponse.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ErrorResponse.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ErrorResponse.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/ErrorResponse.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/ErrorResponse.cs new file mode 100644 index 000000000000..6c2f9c636539 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/ErrorResponse.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.Migrate.Models.Api40 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// + /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows + /// the OData error response format.). + /// + public partial class ErrorResponse : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponseInternal + { + + /// The error additional info. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorAdditionalInfo[] AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetailInternal)Error).AdditionalInfo; } + + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetailInternal)Error).Code; } + + /// The error details. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetail[] Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetailInternal)Error).Detail; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetail _error; + + /// The error object. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetail Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorDetail()); set => this._error = value; } + + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetailInternal)Error).Message; } + + /// Internal Acessors for AdditionalInfo + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorAdditionalInfo[] Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponseInternal.AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetailInternal)Error).AdditionalInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetailInternal)Error).AdditionalInfo = value; } + + /// Internal Acessors for Code + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponseInternal.Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetailInternal)Error).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetailInternal)Error).Code = value; } + + /// Internal Acessors for Detail + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetail[] Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponseInternal.Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetailInternal)Error).Detail; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetailInternal)Error).Detail = value; } + + /// Internal Acessors for Error + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetail Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponseInternal.Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorDetail()); set { {_error = value;} } } + + /// Internal Acessors for Message + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponseInternal.Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetailInternal)Error).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetailInternal)Error).Message = value; } + + /// Internal Acessors for Target + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponseInternal.Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetailInternal)Error).Target; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetailInternal)Error).Target = value; } + + /// The error target. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetailInternal)Error).Target; } + + /// Creates an new instance. + public ErrorResponse() + { + + } + } + /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows + /// the OData error response format.). + public partial interface IErrorResponse : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// The error additional info. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error additional info.", + SerializedName = @"additionalInfo", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorAdditionalInfo) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorAdditionalInfo[] AdditionalInfo { get; } + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string Code { get; } + /// The error details. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error details.", + SerializedName = @"details", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetail) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetail[] Detail { get; } + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error message.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; } + /// The error target. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The error target.", + SerializedName = @"target", + PossibleTypes = new [] { typeof(string) })] + string Target { get; } + + } + /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows + /// the OData error response format.). + internal partial interface IErrorResponseInternal + + { + /// The error additional info. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorAdditionalInfo[] AdditionalInfo { get; set; } + /// The error code. + string Code { get; set; } + /// The error details. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetail[] Detail { get; set; } + /// The error object. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorDetail Error { get; set; } + /// The error message. + string Message { get; set; } + /// The error target. + string Target { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/ErrorResponse.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/ErrorResponse.json.cs new file mode 100644 index 000000000000..79c9e13f8f3f --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/ErrorResponse.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.Migrate.Models.Api40 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// + /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows + /// the OData error response format.). + /// + public partial class ErrorResponse + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal ErrorResponse(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_error = If( json?.PropertyT("error"), out var __jsonError) ? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.ErrorDetail.FromJson(__jsonError) : Error;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new ErrorResponse(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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._error ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._error.ToJson(null,serializationMode) : null, "error" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/OperationAutoGenerated.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/OperationAutoGenerated.PowerShell.cs new file mode 100644 index 000000000000..b345d478f2f3 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/OperationAutoGenerated.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.Migrate.Models.Api40 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// Details of a REST API operation, returned from the Resource Provider Operations API + /// + [System.ComponentModel.TypeConverter(typeof(OperationAutoGeneratedTypeConverter))] + public partial class OperationAutoGenerated + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGenerated DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new OperationAutoGenerated(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGenerated DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new OperationAutoGenerated(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGenerated FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal OperationAutoGenerated(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.Migrate.Models.Api40.IOperationAutoGeneratedInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGenerated) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGeneratedInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.OperationDisplayAutoGeneratedTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGeneratedInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGeneratedInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("IsDataAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGeneratedInternal)this).IsDataAction = (bool?) content.GetValueForProperty("IsDataAction",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGeneratedInternal)this).IsDataAction, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("Origin")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGeneratedInternal)this).Origin = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.Origin?) content.GetValueForProperty("Origin",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGeneratedInternal)this).Origin, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.Origin.CreateFrom); + } + if (content.Contains("ActionType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGeneratedInternal)this).ActionType = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ActionType?) content.GetValueForProperty("ActionType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGeneratedInternal)this).ActionType, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ActionType.CreateFrom); + } + if (content.Contains("DisplayProvider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGeneratedInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGeneratedInternal)this).DisplayProvider, global::System.Convert.ToString); + } + if (content.Contains("DisplayResource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGeneratedInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGeneratedInternal)this).DisplayResource, global::System.Convert.ToString); + } + if (content.Contains("DisplayOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGeneratedInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGeneratedInternal)this).DisplayOperation, global::System.Convert.ToString); + } + if (content.Contains("DisplayDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGeneratedInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGeneratedInternal)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 OperationAutoGenerated(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.Migrate.Models.Api40.IOperationAutoGeneratedInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGenerated) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGeneratedInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.OperationDisplayAutoGeneratedTypeConverter.ConvertFrom); + } + if (content.Contains("Name")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGeneratedInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGeneratedInternal)this).Name, global::System.Convert.ToString); + } + if (content.Contains("IsDataAction")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGeneratedInternal)this).IsDataAction = (bool?) content.GetValueForProperty("IsDataAction",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGeneratedInternal)this).IsDataAction, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + } + if (content.Contains("Origin")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGeneratedInternal)this).Origin = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.Origin?) content.GetValueForProperty("Origin",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGeneratedInternal)this).Origin, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.Origin.CreateFrom); + } + if (content.Contains("ActionType")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGeneratedInternal)this).ActionType = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ActionType?) content.GetValueForProperty("ActionType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGeneratedInternal)this).ActionType, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ActionType.CreateFrom); + } + if (content.Contains("DisplayProvider")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGeneratedInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGeneratedInternal)this).DisplayProvider, global::System.Convert.ToString); + } + if (content.Contains("DisplayResource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGeneratedInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGeneratedInternal)this).DisplayResource, global::System.Convert.ToString); + } + if (content.Contains("DisplayOperation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGeneratedInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGeneratedInternal)this).DisplayOperation, global::System.Convert.ToString); + } + if (content.Contains("DisplayDescription")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGeneratedInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGeneratedInternal)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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Details of a REST API operation, returned from the Resource Provider Operations API + [System.ComponentModel.TypeConverter(typeof(OperationAutoGeneratedTypeConverter))] + public partial interface IOperationAutoGenerated + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/OperationAutoGenerated.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/OperationAutoGenerated.TypeConverter.cs new file mode 100644 index 000000000000..d2aa4ac4ca6d --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/OperationAutoGenerated.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class OperationAutoGeneratedTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGenerated ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGenerated).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return OperationAutoGenerated.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return OperationAutoGenerated.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return OperationAutoGenerated.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/OperationAutoGenerated.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/OperationAutoGenerated.cs new file mode 100644 index 000000000000..5720b21373ed --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/OperationAutoGenerated.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.Migrate.Models.Api40 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// + /// Details of a REST API operation, returned from the Resource Provider Operations API + /// + public partial class OperationAutoGenerated : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGenerated, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGeneratedInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ActionType? _actionType; + + /// + /// Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ActionType? ActionType { get => this._actionType; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGenerated _display; + + /// Localized display information for this particular operation. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGenerated Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.OperationDisplayAutoGenerated()); set => this._display = value; } + + /// + /// The short, localized friendly description of the operation; suitable for tool tips and detailed views. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string DisplayDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGeneratedInternal)Display).Description; } + + /// + /// The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", + /// "Restart Virtual Machine". + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string DisplayOperation { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGeneratedInternal)Display).Operation; } + + /// + /// The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string DisplayProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGeneratedInternal)Display).Provider; } + + /// + /// The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Inlined)] + public string DisplayResource { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGeneratedInternal)Display).Resource; } + + /// Backing field for property. + private bool? _isDataAction; + + /// + /// Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane + /// operations. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public bool? IsDataAction { get => this._isDataAction; } + + /// Internal Acessors for ActionType + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ActionType? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGeneratedInternal.ActionType { get => this._actionType; set { {_actionType = value;} } } + + /// Internal Acessors for Display + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGenerated Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGeneratedInternal.Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.OperationDisplayAutoGenerated()); set { {_display = value;} } } + + /// Internal Acessors for DisplayDescription + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGeneratedInternal.DisplayDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGeneratedInternal)Display).Description; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGeneratedInternal)Display).Description = value; } + + /// Internal Acessors for DisplayOperation + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGeneratedInternal.DisplayOperation { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGeneratedInternal)Display).Operation; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGeneratedInternal)Display).Operation = value; } + + /// Internal Acessors for DisplayProvider + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGeneratedInternal.DisplayProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGeneratedInternal)Display).Provider; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGeneratedInternal)Display).Provider = value; } + + /// Internal Acessors for DisplayResource + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGeneratedInternal.DisplayResource { get => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGeneratedInternal)Display).Resource; set => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGeneratedInternal)Display).Resource = value; } + + /// Internal Acessors for IsDataAction + bool? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGeneratedInternal.IsDataAction { get => this._isDataAction; set { {_isDataAction = value;} } } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGeneratedInternal.Name { get => this._name; set { {_name = value;} } } + + /// Internal Acessors for Origin + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.Origin? Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGeneratedInternal.Origin { get => this._origin; set { {_origin = value;} } } + + /// Backing field for property. + private string _name; + + /// + /// The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", + /// "Microsoft.Compute/virtualMachines/capture/action" + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Name { get => this._name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.Origin? _origin; + + /// + /// The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is + /// "user,system" + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.Origin? Origin { get => this._origin; } + + /// Creates an new instance. + public OperationAutoGenerated() + { + + } + } + /// Details of a REST API operation, returned from the Resource Provider Operations API + public partial interface IOperationAutoGenerated : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// + /// Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Enum. Indicates the action type. ""Internal"" refers to actions that are for internal only APIs.", + SerializedName = @"actionType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ActionType) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ActionType? ActionType { get; } + /// + /// The short, localized friendly description of the operation; suitable for tool tips and detailed views. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The short, localized friendly description of the operation; suitable for tool tips and detailed views.", + SerializedName = @"description", + PossibleTypes = new [] { typeof(string) })] + string DisplayDescription { get; } + /// + /// The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", + /// "Restart Virtual Machine". + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The concise, localized friendly name for the operation; suitable for dropdowns. E.g. ""Create or Update Virtual Machine"", ""Restart Virtual Machine"".", + SerializedName = @"operation", + PossibleTypes = new [] { typeof(string) })] + string DisplayOperation { get; } + /// + /// The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The localized friendly form of the resource provider name, e.g. ""Microsoft Monitoring Insights"" or ""Microsoft Compute"".", + SerializedName = @"provider", + PossibleTypes = new [] { typeof(string) })] + string DisplayProvider { get; } + /// + /// The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The localized friendly name of the resource type related to this operation. E.g. ""Virtual Machines"" or ""Job Schedule Collections"".", + SerializedName = @"resource", + PossibleTypes = new [] { typeof(string) })] + string DisplayResource { get; } + /// + /// Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane + /// operations. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Whether the operation applies to data-plane. This is ""true"" for data-plane operations and ""false"" for ARM/control-plane operations.", + SerializedName = @"isDataAction", + PossibleTypes = new [] { typeof(bool) })] + bool? IsDataAction { get; } + /// + /// The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", + /// "Microsoft.Compute/virtualMachines/capture/action" + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The name of the operation, as per Resource-Based Access Control (RBAC). Examples: ""Microsoft.Compute/virtualMachines/write"", ""Microsoft.Compute/virtualMachines/capture/action""", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; } + /// + /// The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is + /// "user,system" + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is ""user,system""", + SerializedName = @"origin", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.Origin) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.Origin? Origin { get; } + + } + /// Details of a REST API operation, returned from the Resource Provider Operations API + internal partial interface IOperationAutoGeneratedInternal + + { + /// + /// Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + /// + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ActionType? ActionType { get; set; } + /// Localized display information for this particular operation. + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGenerated Display { get; set; } + /// + /// The short, localized friendly description of the operation; suitable for tool tips and detailed views. + /// + string DisplayDescription { get; set; } + /// + /// The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", + /// "Restart Virtual Machine". + /// + string DisplayOperation { get; set; } + /// + /// The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". + /// + string DisplayProvider { get; set; } + /// + /// The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". + /// + string DisplayResource { get; set; } + /// + /// Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane + /// operations. + /// + bool? IsDataAction { get; set; } + /// + /// The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", + /// "Microsoft.Compute/virtualMachines/capture/action" + /// + string Name { get; set; } + /// + /// The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is + /// "user,system" + /// + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.Origin? Origin { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/OperationAutoGenerated.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/OperationAutoGenerated.json.cs new file mode 100644 index 000000000000..5a13db22a11b --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/OperationAutoGenerated.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.Migrate.Models.Api40 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// + /// Details of a REST API operation, returned from the Resource Provider Operations API + /// + public partial class OperationAutoGenerated + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGenerated. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGenerated. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGenerated FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new OperationAutoGenerated(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal OperationAutoGenerated(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api40.OperationDisplayAutoGenerated.FromJson(__jsonDisplay) : Display;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_isDataAction = If( json?.PropertyT("isDataAction"), out var __jsonIsDataAction) ? (bool?)__jsonIsDataAction : IsDataAction;} + {_origin = If( json?.PropertyT("origin"), out var __jsonOrigin) ? (string)__jsonOrigin : (string)Origin;} + {_actionType = If( json?.PropertyT("actionType"), out var __jsonActionType) ? (string)__jsonActionType : (string)ActionType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._display ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) this._display.ToJson(null,serializationMode) : null, "display" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._isDataAction ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonBoolean((bool)this._isDataAction) : null, "isDataAction" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._origin)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._origin.ToString()) : null, "origin" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._actionType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._actionType.ToString()) : null, "actionType" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/OperationDisplayAutoGenerated.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/OperationDisplayAutoGenerated.PowerShell.cs new file mode 100644 index 000000000000..fd06225192d7 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/OperationDisplayAutoGenerated.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.Migrate.Models.Api40 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// Localized display information for this particular operation. + [System.ComponentModel.TypeConverter(typeof(OperationDisplayAutoGeneratedTypeConverter))] + public partial class OperationDisplayAutoGenerated + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGenerated DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new OperationDisplayAutoGenerated(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGenerated DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new OperationDisplayAutoGenerated(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGenerated FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal OperationDisplayAutoGenerated(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.Migrate.Models.Api40.IOperationDisplayAutoGeneratedInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGeneratedInternal)this).Provider, global::System.Convert.ToString); + } + if (content.Contains("Resource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGeneratedInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGeneratedInternal)this).Resource, global::System.Convert.ToString); + } + if (content.Contains("Operation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGeneratedInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGeneratedInternal)this).Operation, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGeneratedInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGeneratedInternal)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 OperationDisplayAutoGenerated(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.Migrate.Models.Api40.IOperationDisplayAutoGeneratedInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGeneratedInternal)this).Provider, global::System.Convert.ToString); + } + if (content.Contains("Resource")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGeneratedInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGeneratedInternal)this).Resource, global::System.Convert.ToString); + } + if (content.Contains("Operation")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGeneratedInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGeneratedInternal)this).Operation, global::System.Convert.ToString); + } + if (content.Contains("Description")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGeneratedInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGeneratedInternal)this).Description, 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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Localized display information for this particular operation. + [System.ComponentModel.TypeConverter(typeof(OperationDisplayAutoGeneratedTypeConverter))] + public partial interface IOperationDisplayAutoGenerated + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/OperationDisplayAutoGenerated.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/OperationDisplayAutoGenerated.TypeConverter.cs new file mode 100644 index 000000000000..73991dca2314 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/OperationDisplayAutoGenerated.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class OperationDisplayAutoGeneratedTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGenerated ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGenerated).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return OperationDisplayAutoGenerated.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return OperationDisplayAutoGenerated.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return OperationDisplayAutoGenerated.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/OperationDisplayAutoGenerated.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/OperationDisplayAutoGenerated.cs new file mode 100644 index 000000000000..2971201da6d2 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/OperationDisplayAutoGenerated.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.Migrate.Models.Api40 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Localized display information for this particular operation. + public partial class OperationDisplayAutoGenerated : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGenerated, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGeneratedInternal + { + + /// Backing field for property. + private string _description; + + /// + /// The short, localized friendly description of the operation; suitable for tool tips and detailed views. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Description { get => this._description; } + + /// Internal Acessors for Description + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGeneratedInternal.Description { get => this._description; set { {_description = value;} } } + + /// Internal Acessors for Operation + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGeneratedInternal.Operation { get => this._operation; set { {_operation = value;} } } + + /// Internal Acessors for Provider + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGeneratedInternal.Provider { get => this._provider; set { {_provider = value;} } } + + /// Internal Acessors for Resource + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGeneratedInternal.Resource { get => this._resource; set { {_resource = value;} } } + + /// Backing field for property. + private string _operation; + + /// + /// The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", + /// "Restart Virtual Machine". + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Operation { get => this._operation; } + + /// Backing field for property. + private string _provider; + + /// + /// The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Provider { get => this._provider; } + + /// Backing field for property. + private string _resource; + + /// + /// The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Resource { get => this._resource; } + + /// Creates an new instance. + public OperationDisplayAutoGenerated() + { + + } + } + /// Localized display information for this particular operation. + public partial interface IOperationDisplayAutoGenerated : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// + /// The short, localized friendly description of the operation; suitable for tool tips and detailed views. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The short, localized friendly description of the operation; suitable for tool tips and detailed views.", + SerializedName = @"description", + PossibleTypes = new [] { typeof(string) })] + string Description { get; } + /// + /// The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", + /// "Restart Virtual Machine". + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The concise, localized friendly name for the operation; suitable for dropdowns. E.g. ""Create or Update Virtual Machine"", ""Restart Virtual Machine"".", + SerializedName = @"operation", + PossibleTypes = new [] { typeof(string) })] + string Operation { get; } + /// + /// The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The localized friendly form of the resource provider name, e.g. ""Microsoft Monitoring Insights"" or ""Microsoft Compute"".", + SerializedName = @"provider", + PossibleTypes = new [] { typeof(string) })] + string Provider { get; } + /// + /// The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". + /// + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The localized friendly name of the resource type related to this operation. E.g. ""Virtual Machines"" or ""Job Schedule Collections"".", + SerializedName = @"resource", + PossibleTypes = new [] { typeof(string) })] + string Resource { get; } + + } + /// Localized display information for this particular operation. + internal partial interface IOperationDisplayAutoGeneratedInternal + + { + /// + /// The short, localized friendly description of the operation; suitable for tool tips and detailed views. + /// + string Description { get; set; } + /// + /// The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", + /// "Restart Virtual Machine". + /// + string Operation { get; set; } + /// + /// The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". + /// + string Provider { get; set; } + /// + /// The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". + /// + string Resource { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/OperationDisplayAutoGenerated.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/OperationDisplayAutoGenerated.json.cs new file mode 100644 index 000000000000..9b2c64e7874d --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/OperationDisplayAutoGenerated.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.Migrate.Models.Api40 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// Localized display information for this particular operation. + public partial class OperationDisplayAutoGenerated + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGenerated. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGenerated. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationDisplayAutoGenerated FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new OperationDisplayAutoGenerated(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal OperationDisplayAutoGenerated(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._provider)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._provider.ToString()) : null, "provider" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._resource)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._resource.ToString()) : null, "resource" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._operation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._operation.ToString()) : null, "operation" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._description)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._description.ToString()) : null, "description" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/OperationListResult.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/OperationListResult.PowerShell.cs new file mode 100644 index 000000000000..206f5b239781 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/OperationListResult.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.Migrate.Models.Api40 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + /// results. + /// + [System.ComponentModel.TypeConverter(typeof(OperationListResultTypeConverter))] + public partial class OperationListResult + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new OperationListResult(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new OperationListResult(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal OperationListResult(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.Migrate.Models.Api40.IOperationListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGenerated[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.OperationAutoGeneratedTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationListResultInternal)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 OperationListResult(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.Migrate.Models.Api40.IOperationListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGenerated[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.OperationAutoGeneratedTypeConverter.ConvertFrom)); + } + if (content.Contains("NextLink")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationListResultInternal)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.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + /// results. + [System.ComponentModel.TypeConverter(typeof(OperationListResultTypeConverter))] + public partial interface IOperationListResult + + { + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/OperationListResult.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/OperationListResult.TypeConverter.cs new file mode 100644 index 000000000000..c693f2ce2489 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/OperationListResult.TypeConverter.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40 +{ + using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class OperationListResultTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// type. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the + /// parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter into an instance of + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationListResult ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationListResult).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return OperationListResult.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return OperationListResult.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return OperationListResult.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/OperationListResult.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/OperationListResult.cs new file mode 100644 index 000000000000..67d356cc4c35 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/OperationListResult.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.Migrate.Models.Api40 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// + /// A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + /// results. + /// + public partial class OperationListResult : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationListResult, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationListResultInternal + { + + /// Internal Acessors for NextLink + string Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationListResultInternal.NextLink { get => this._nextLink; set { {_nextLink = value;} } } + + /// Internal Acessors for Value + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGenerated[] Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationListResultInternal.Value { get => this._value; set { {_value = value;} } } + + /// Backing field for property. + private string _nextLink; + + /// URL to get the next set of operation list results (if there are any). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGenerated[] _value; + + /// List of operations supported by the resource provider + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGenerated[] Value { get => this._value; } + + /// Creates an new instance. + public OperationListResult() + { + + } + } + /// A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + /// results. + public partial interface IOperationListResult : + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IJsonSerializable + { + /// URL to get the next set of operation list results (if there are any). + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"URL to get the next set of operation list results (if there are any).", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; } + /// List of operations supported by the resource provider + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"List of operations supported by the resource provider", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGenerated) })] + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGenerated[] Value { get; } + + } + /// A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + /// results. + internal partial interface IOperationListResultInternal + + { + /// URL to get the next set of operation list results (if there are any). + string NextLink { get; set; } + /// List of operations supported by the resource provider + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGenerated[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/OperationListResult.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/OperationListResult.json.cs new file mode 100644 index 000000000000..50555bbe3ff7 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/Api40/OperationListResult.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.Migrate.Models.Api40 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + + /// + /// A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + /// results. + /// + public partial class OperationListResult + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json serialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the + /// output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output + /// parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationListResult. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationListResult. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new OperationListResult(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from. + internal OperationListResult(Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Models.Api40.IOperationAutoGenerated) (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.OperationAutoGenerated.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.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/MigrateIdentity.PowerShell.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/MigrateIdentity.PowerShell.cs index 7edf21b59f6c..aa50451532d7 100644 --- a/src/Migrate/Migrate.Autorest/generated/api/Models/MigrateIdentity.PowerShell.cs +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/MigrateIdentity.PowerShell.cs @@ -212,6 +212,14 @@ internal MigrateIdentity(global::System.Collections.IDictionary content) { ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).RecoveryPointName = (string) content.GetValueForProperty("RecoveryPointName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).RecoveryPointName, global::System.Convert.ToString); } + if (content.Contains("VaultName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).VaultName = (string) content.GetValueForProperty("VaultName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).VaultName, global::System.Convert.ToString); + } + if (content.Contains("ProtectedItemName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).ProtectedItemName = (string) content.GetValueForProperty("ProtectedItemName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).ProtectedItemName, global::System.Convert.ToString); + } if (content.Contains("MappingName")) { ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).MappingName = (string) content.GetValueForProperty("MappingName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).MappingName, global::System.Convert.ToString); @@ -244,6 +252,30 @@ internal MigrateIdentity(global::System.Collections.IDictionary content) { ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).VaultSettingName = (string) content.GetValueForProperty("VaultSettingName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).VaultSettingName, global::System.Convert.ToString); } + if (content.Contains("FabricAgentName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).FabricAgentName = (string) content.GetValueForProperty("FabricAgentName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).FabricAgentName, global::System.Convert.ToString); + } + if (content.Contains("OperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).OperationId = (string) content.GetValueForProperty("OperationId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).OperationId, global::System.Convert.ToString); + } + if (content.Contains("EmailConfigurationName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).EmailConfigurationName = (string) content.GetValueForProperty("EmailConfigurationName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).EmailConfigurationName, global::System.Convert.ToString); + } + if (content.Contains("ReplicationExtensionName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).ReplicationExtensionName = (string) content.GetValueForProperty("ReplicationExtensionName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).ReplicationExtensionName, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("DeploymentId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).DeploymentId = (string) content.GetValueForProperty("DeploymentId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).DeploymentId, global::System.Convert.ToString); + } if (content.Contains("Id")) { ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).Id, global::System.Convert.ToString); @@ -377,6 +409,14 @@ internal MigrateIdentity(global::System.Management.Automation.PSObject content) { ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).RecoveryPointName = (string) content.GetValueForProperty("RecoveryPointName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).RecoveryPointName, global::System.Convert.ToString); } + if (content.Contains("VaultName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).VaultName = (string) content.GetValueForProperty("VaultName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).VaultName, global::System.Convert.ToString); + } + if (content.Contains("ProtectedItemName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).ProtectedItemName = (string) content.GetValueForProperty("ProtectedItemName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).ProtectedItemName, global::System.Convert.ToString); + } if (content.Contains("MappingName")) { ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).MappingName = (string) content.GetValueForProperty("MappingName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).MappingName, global::System.Convert.ToString); @@ -409,6 +449,30 @@ internal MigrateIdentity(global::System.Management.Automation.PSObject content) { ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).VaultSettingName = (string) content.GetValueForProperty("VaultSettingName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).VaultSettingName, global::System.Convert.ToString); } + if (content.Contains("FabricAgentName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).FabricAgentName = (string) content.GetValueForProperty("FabricAgentName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).FabricAgentName, global::System.Convert.ToString); + } + if (content.Contains("OperationId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).OperationId = (string) content.GetValueForProperty("OperationId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).OperationId, global::System.Convert.ToString); + } + if (content.Contains("EmailConfigurationName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).EmailConfigurationName = (string) content.GetValueForProperty("EmailConfigurationName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).EmailConfigurationName, global::System.Convert.ToString); + } + if (content.Contains("ReplicationExtensionName")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).ReplicationExtensionName = (string) content.GetValueForProperty("ReplicationExtensionName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).ReplicationExtensionName, global::System.Convert.ToString); + } + if (content.Contains("Location")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).Location, global::System.Convert.ToString); + } + if (content.Contains("DeploymentId")) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).DeploymentId = (string) content.GetValueForProperty("DeploymentId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).DeploymentId, global::System.Convert.ToString); + } if (content.Contains("Id")) { ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentityInternal)this).Id, global::System.Convert.ToString); diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/MigrateIdentity.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/MigrateIdentity.cs index a8bbd22eea62..0845bdf0f96f 100644 --- a/src/Migrate/Migrate.Autorest/generated/api/Models/MigrateIdentity.cs +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/MigrateIdentity.cs @@ -47,6 +47,20 @@ public partial class MigrateIdentity : [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] public string DatabaseName { get => this._databaseName; set => this._databaseName = value; } + /// Backing field for property. + private string _deploymentId; + + /// Deployment Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string DeploymentId { get => this._deploymentId; set => this._deploymentId = value; } + + /// Backing field for property. + private string _emailConfigurationName; + + /// The email configuration name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string EmailConfigurationName { get => this._emailConfigurationName; set => this._emailConfigurationName = value; } + /// Backing field for property. private string _eventName; @@ -54,6 +68,13 @@ public partial class MigrateIdentity : [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] public string EventName { get => this._eventName; set => this._eventName = value; } + /// Backing field for property. + private string _fabricAgentName; + + /// The fabric agent (Dra) name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string FabricAgentName { get => this._fabricAgentName; set => this._fabricAgentName = value; } + /// Backing field for property. private string _fabricName; @@ -89,6 +110,13 @@ public partial class MigrateIdentity : [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] public string JobName { get => this._jobName; set => this._jobName = value; } + /// Backing field for property. + private string _location; + + /// The name of the Azure region. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string Location { get => this._location; set => this._location = value; } + /// Backing field for property. private string _logicalNetworkName; @@ -145,6 +173,13 @@ public partial class MigrateIdentity : [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] public string NetworkName { get => this._networkName; set => this._networkName = value; } + /// Backing field for property. + private string _operationId; + + /// The ID of an ongoing async operation. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string OperationId { get => this._operationId; set => this._operationId = value; } + /// Backing field for property. private string _operationStatusName; @@ -166,6 +201,13 @@ public partial class MigrateIdentity : [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] public string ProtectableItemName { get => this._protectableItemName; set => this._protectableItemName = value; } + /// Backing field for property. + private string _protectedItemName; + + /// The protected item name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string ProtectedItemName { get => this._protectedItemName; set => this._protectedItemName = value; } + /// Backing field for property. private string _protectionContainerName; @@ -201,6 +243,13 @@ public partial class MigrateIdentity : [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] public string ReplicatedProtectedItemName { get => this._replicatedProtectedItemName; set => this._replicatedProtectedItemName = value; } + /// Backing field for property. + private string _replicationExtensionName; + + /// The replication extension name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string ReplicationExtensionName { get => this._replicationExtensionName; set => this._replicationExtensionName = value; } + /// Backing field for property. private string _resourceGroupName; @@ -250,6 +299,13 @@ public partial class MigrateIdentity : [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + /// Backing field for property. + private string _vaultName; + + /// The vault name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Origin(Microsoft.Azure.PowerShell.Cmdlets.Migrate.PropertyOrigin.Owned)] + public string VaultName { get => this._vaultName; set => this._vaultName = value; } + /// Backing field for property. private string _vaultSettingName; @@ -320,6 +376,22 @@ public partial interface IMigrateIdentity : SerializedName = @"databaseName", PossibleTypes = new [] { typeof(string) })] string DatabaseName { get; set; } + /// Deployment Id. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Deployment Id.", + SerializedName = @"deploymentId", + PossibleTypes = new [] { typeof(string) })] + string DeploymentId { get; set; } + /// The email configuration name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The email configuration name.", + SerializedName = @"emailConfigurationName", + PossibleTypes = new [] { typeof(string) })] + string EmailConfigurationName { get; set; } /// Unique name of an event within a migrate project. [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( Required = false, @@ -328,6 +400,14 @@ public partial interface IMigrateIdentity : SerializedName = @"eventName", PossibleTypes = new [] { typeof(string) })] string EventName { get; set; } + /// The fabric agent (Dra) name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The fabric agent (Dra) name.", + SerializedName = @"fabricAgentName", + PossibleTypes = new [] { typeof(string) })] + string FabricAgentName { get; set; } /// Fabric name. [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( Required = false, @@ -368,6 +448,14 @@ public partial interface IMigrateIdentity : SerializedName = @"jobName", PossibleTypes = new [] { typeof(string) })] string JobName { get; set; } + /// The name of the Azure region. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the Azure region.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + string Location { get; set; } /// Logical network name. [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( Required = false, @@ -432,6 +520,14 @@ public partial interface IMigrateIdentity : SerializedName = @"networkName", PossibleTypes = new [] { typeof(string) })] string NetworkName { get; set; } + /// The ID of an ongoing async operation. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The ID of an ongoing async operation.", + SerializedName = @"operationId", + PossibleTypes = new [] { typeof(string) })] + string OperationId { get; set; } /// Operation status ARM name. [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( Required = false, @@ -456,6 +552,14 @@ public partial interface IMigrateIdentity : SerializedName = @"protectableItemName", PossibleTypes = new [] { typeof(string) })] string ProtectableItemName { get; set; } + /// The protected item name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The protected item name.", + SerializedName = @"protectedItemName", + PossibleTypes = new [] { typeof(string) })] + string ProtectedItemName { get; set; } /// Protection container name. [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( Required = false, @@ -496,6 +600,14 @@ public partial interface IMigrateIdentity : SerializedName = @"replicatedProtectedItemName", PossibleTypes = new [] { typeof(string) })] string ReplicatedProtectedItemName { get; set; } + /// The replication extension name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The replication extension name.", + SerializedName = @"replicationExtensionName", + PossibleTypes = new [] { typeof(string) })] + string ReplicationExtensionName { get; set; } /// The name of the resource group. The name is case insensitive. [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( Required = false, @@ -552,6 +664,14 @@ public partial interface IMigrateIdentity : SerializedName = @"subscriptionId", PossibleTypes = new [] { typeof(string) })] string SubscriptionId { get; set; } + /// The vault name. + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The vault name.", + SerializedName = @"vaultName", + PossibleTypes = new [] { typeof(string) })] + string VaultName { get; set; } /// Vault setting name. [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( Required = false, @@ -591,8 +711,14 @@ internal partial interface IMigrateIdentityInternal string DatabaseInstanceName { get; set; } /// Unique name of a database in Azure migration hub. string DatabaseName { get; set; } + /// Deployment Id. + string DeploymentId { get; set; } + /// The email configuration name. + string EmailConfigurationName { get; set; } /// Unique name of an event within a migrate project. string EventName { get; set; } + /// The fabric agent (Dra) name. + string FabricAgentName { get; set; } /// Fabric name. string FabricName { get; set; } /// Host ARM name. @@ -603,6 +729,8 @@ internal partial interface IMigrateIdentityInternal string IntentObjectName { get; set; } /// Job ARM name. string JobName { get; set; } + /// The name of the Azure region. + string Location { get; set; } /// Logical network name. string LogicalNetworkName { get; set; } /// Machine ARM name. @@ -619,12 +747,16 @@ internal partial interface IMigrateIdentityInternal string NetworkMappingName { get; set; } /// Primary network name. string NetworkName { get; set; } + /// The ID of an ongoing async operation. + string OperationId { get; set; } /// Operation status ARM name. string OperationStatusName { get; set; } /// Replication policy name. string PolicyName { get; set; } /// Protectable item name. string ProtectableItemName { get; set; } + /// The protected item name. + string ProtectedItemName { get; set; } /// Protection container name. string ProtectionContainerName { get; set; } /// Recovery services provider name. @@ -635,6 +767,8 @@ internal partial interface IMigrateIdentityInternal string RecoveryPointName { get; set; } /// Replication protected item name. string ReplicatedProtectedItemName { get; set; } + /// The replication extension name. + string ReplicationExtensionName { get; set; } /// The name of the resource group. The name is case insensitive. string ResourceGroupName { get; set; } /// The name of the recovery services vault. @@ -649,6 +783,8 @@ internal partial interface IMigrateIdentityInternal string StorageClassificationName { get; set; } /// The ID of the target subscription. string SubscriptionId { get; set; } + /// The vault name. + string VaultName { get; set; } /// Vault setting name. string VaultSettingName { get; set; } /// VCenter ARM name. diff --git a/src/Migrate/Migrate.Autorest/generated/api/Models/MigrateIdentity.json.cs b/src/Migrate/Migrate.Autorest/generated/api/Models/MigrateIdentity.json.cs index a2da5235e62a..484035e8d1f7 100644 --- a/src/Migrate/Migrate.Autorest/generated/api/Models/MigrateIdentity.json.cs +++ b/src/Migrate/Migrate.Autorest/generated/api/Models/MigrateIdentity.json.cs @@ -104,6 +104,8 @@ internal MigrateIdentity(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json {_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;} + {_vaultName = If( json?.PropertyT("vaultName"), out var __jsonVaultName) ? (string)__jsonVaultName : (string)VaultName;} + {_protectedItemName = If( json?.PropertyT("protectedItemName"), out var __jsonProtectedItemName) ? (string)__jsonProtectedItemName : (string)ProtectedItemName;} {_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;} @@ -112,6 +114,12 @@ internal MigrateIdentity(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json {_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;} + {_fabricAgentName = If( json?.PropertyT("fabricAgentName"), out var __jsonFabricAgentName) ? (string)__jsonFabricAgentName : (string)FabricAgentName;} + {_operationId = If( json?.PropertyT("operationId"), out var __jsonOperationId) ? (string)__jsonOperationId : (string)OperationId;} + {_emailConfigurationName = If( json?.PropertyT("emailConfigurationName"), out var __jsonEmailConfigurationName) ? (string)__jsonEmailConfigurationName : (string)EmailConfigurationName;} + {_replicationExtensionName = If( json?.PropertyT("replicationExtensionName"), out var __jsonReplicationExtensionName) ? (string)__jsonReplicationExtensionName : (string)ReplicationExtensionName;} + {_location = If( json?.PropertyT("location"), out var __jsonLocation) ? (string)__jsonLocation : (string)Location;} + {_deploymentId = If( json?.PropertyT("deploymentId"), out var __jsonDeploymentId) ? (string)__jsonDeploymentId : (string)DeploymentId;} {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} AfterFromJson(json); } @@ -163,6 +171,8 @@ public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode ToJson(M AddIf( null != (((object)this._protectableItemName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._protectableItemName.ToString()) : null, "protectableItemName" ,container.Add ); AddIf( null != (((object)this._replicatedProtectedItemName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._replicatedProtectedItemName.ToString()) : null, "replicatedProtectedItemName" ,container.Add ); AddIf( null != (((object)this._recoveryPointName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._recoveryPointName.ToString()) : null, "recoveryPointName" ,container.Add ); + AddIf( null != (((object)this._vaultName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._vaultName.ToString()) : null, "vaultName" ,container.Add ); + AddIf( null != (((object)this._protectedItemName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._protectedItemName.ToString()) : null, "protectedItemName" ,container.Add ); AddIf( null != (((object)this._mappingName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._mappingName.ToString()) : null, "mappingName" ,container.Add ); AddIf( null != (((object)this._providerName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._providerName.ToString()) : null, "providerName" ,container.Add ); AddIf( null != (((object)this._storageClassificationName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._storageClassificationName.ToString()) : null, "storageClassificationName" ,container.Add ); @@ -171,6 +181,12 @@ public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode ToJson(M AddIf( null != (((object)this._intentObjectName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._intentObjectName.ToString()) : null, "intentObjectName" ,container.Add ); AddIf( null != (((object)this._recoveryPlanName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._recoveryPlanName.ToString()) : null, "recoveryPlanName" ,container.Add ); AddIf( null != (((object)this._vaultSettingName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._vaultSettingName.ToString()) : null, "vaultSettingName" ,container.Add ); + AddIf( null != (((object)this._fabricAgentName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._fabricAgentName.ToString()) : null, "fabricAgentName" ,container.Add ); + AddIf( null != (((object)this._operationId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._operationId.ToString()) : null, "operationId" ,container.Add ); + AddIf( null != (((object)this._emailConfigurationName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._emailConfigurationName.ToString()) : null, "emailConfigurationName" ,container.Add ); + AddIf( null != (((object)this._replicationExtensionName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._replicationExtensionName.ToString()) : null, "replicationExtensionName" ,container.Add ); + AddIf( null != (((object)this._location)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._location.ToString()) : null, "location" ,container.Add ); + AddIf( null != (((object)this._deploymentId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._deploymentId.ToString()) : null, "deploymentId" ,container.Add ); AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); AfterToJson(ref container); return container; diff --git a/src/Migrate/Migrate.Autorest/generated/api/Support/ActionType.Completer.cs b/src/Migrate/Migrate.Autorest/generated/api/Support/ActionType.Completer.cs new file mode 100644 index 000000000000..99c7e2db2f97 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Support/ActionType.Completer.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.Migrate.Support +{ + + /// + /// Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + /// + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ActionTypeTypeConverter))] + public partial struct ActionType : + 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) || "Internal".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Internal'", "Internal", global::System.Management.Automation.CompletionResultType.ParameterValue, "Internal"); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Support/ActionType.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Support/ActionType.TypeConverter.cs new file mode 100644 index 000000000000..d7ab923b20ee --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Support/ActionType.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.Migrate.Support +{ + + /// + /// Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + /// + public partial class ActionTypeTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert 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) => ActionType.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/src/Migrate/Migrate.Autorest/generated/api/Support/ActionType.cs b/src/Migrate/Migrate.Autorest/generated/api/Support/ActionType.cs new file mode 100644 index 000000000000..1d247f7d2d1b --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Support/ActionType.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.Migrate.Support +{ + + /// + /// Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + /// + public partial struct ActionType : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ActionType Internal = @"Internal"; + + /// 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 ActionType(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Conversion from arbitrary object to ActionType + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new ActionType(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type ActionType + /// 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.Migrate.Support.ActionType e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type ActionType (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 ActionType && Equals((ActionType)obj); + } + + /// Returns hashCode for enum ActionType + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Returns string representation for ActionType + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to ActionType + /// the value to convert to an instance of . + + public static implicit operator ActionType(string value) + { + return new ActionType(value); + } + + /// Implicit operator to convert ActionType to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ActionType e) + { + return e._value; + } + + /// Overriding != operator for enum ActionType + /// 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.Migrate.Support.ActionType e1, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ActionType e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum ActionType + /// 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.Migrate.Support.ActionType e1, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ActionType e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Support/HealthStatus.Completer.cs b/src/Migrate/Migrate.Autorest/generated/api/Support/HealthStatus.Completer.cs new file mode 100644 index 000000000000..77ec8ec6890a --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Support/HealthStatus.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.Migrate.Support +{ + + /// Gets or sets the fabric health. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.HealthStatusTypeConverter))] + public partial struct HealthStatus : + 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) || "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/src/Migrate/Migrate.Autorest/generated/api/Support/HealthStatus.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Support/HealthStatus.TypeConverter.cs new file mode 100644 index 000000000000..daa2962fab9c --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Support/HealthStatus.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.Migrate.Support +{ + + /// Gets or sets the fabric health. + public partial class HealthStatusTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert 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) => HealthStatus.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/src/Migrate/Migrate.Autorest/generated/api/Support/HealthStatus.cs b/src/Migrate/Migrate.Autorest/generated/api/Support/HealthStatus.cs new file mode 100644 index 000000000000..bdbe69a750fa --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Support/HealthStatus.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.Migrate.Support +{ + + /// Gets or sets the fabric health. + public partial struct HealthStatus : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.HealthStatus Critical = @"Critical"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.HealthStatus Normal = @"Normal"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.HealthStatus Warning = @"Warning"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to HealthStatus + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new HealthStatus(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type HealthStatus + /// 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.Migrate.Support.HealthStatus e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type HealthStatus (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 HealthStatus && Equals((HealthStatus)obj); + } + + /// Returns hashCode for enum HealthStatus + /// 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 HealthStatus(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for HealthStatus + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to HealthStatus + /// the value to convert to an instance of . + + public static implicit operator HealthStatus(string value) + { + return new HealthStatus(value); + } + + /// Implicit operator to convert HealthStatus to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.HealthStatus e) + { + return e._value; + } + + /// Overriding != operator for enum HealthStatus + /// 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.Migrate.Support.HealthStatus e1, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.HealthStatus e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum HealthStatus + /// 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.Migrate.Support.HealthStatus e1, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.HealthStatus e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Support/Origin.Completer.cs b/src/Migrate/Migrate.Autorest/generated/api/Support/Origin.Completer.cs new file mode 100644 index 000000000000..04ac02ecdf2e --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Support/Origin.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.Migrate.Support +{ + + /// + /// The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is + /// "user,system" + /// + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.OriginTypeConverter))] + public partial struct Origin : + 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) || "user".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'user'", "user", global::System.Management.Automation.CompletionResultType.ParameterValue, "user"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "system".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'system'", "system", global::System.Management.Automation.CompletionResultType.ParameterValue, "system"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "user,system".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'user,system'", "user,system", global::System.Management.Automation.CompletionResultType.ParameterValue, "user,system"); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Support/Origin.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Support/Origin.TypeConverter.cs new file mode 100644 index 000000000000..36e947825005 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Support/Origin.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.Migrate.Support +{ + + /// + /// The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is + /// "user,system" + /// + public partial class OriginTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert 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) => Origin.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/src/Migrate/Migrate.Autorest/generated/api/Support/Origin.cs b/src/Migrate/Migrate.Autorest/generated/api/Support/Origin.cs new file mode 100644 index 000000000000..3a1cb3629b24 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Support/Origin.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.Migrate.Support +{ + + /// + /// The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is + /// "user,system" + /// + public partial struct Origin : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.Origin System = @"system"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.Origin User = @"user"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.Origin UserSystem = @"user,system"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to Origin + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new Origin(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type Origin + /// 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.Migrate.Support.Origin e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type Origin (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 Origin && Equals((Origin)obj); + } + + /// Returns hashCode for enum Origin + /// 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 Origin(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for Origin + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to Origin + /// the value to convert to an instance of . + + public static implicit operator Origin(string value) + { + return new Origin(value); + } + + /// Implicit operator to convert Origin to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.Origin e) + { + return e._value; + } + + /// Overriding != operator for enum Origin + /// 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.Migrate.Support.Origin e1, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.Origin e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum Origin + /// 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.Migrate.Support.Origin e1, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.Origin e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Support/ProtectedItemActiveLocation.Completer.cs b/src/Migrate/Migrate.Autorest/generated/api/Support/ProtectedItemActiveLocation.Completer.cs new file mode 100644 index 000000000000..9a432b6305ac --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Support/ProtectedItemActiveLocation.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.Migrate.Support +{ + + /// Gets or sets the location of the protected item. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectedItemActiveLocationTypeConverter))] + public partial struct ProtectedItemActiveLocation : + 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/src/Migrate/Migrate.Autorest/generated/api/Support/ProtectedItemActiveLocation.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Support/ProtectedItemActiveLocation.TypeConverter.cs new file mode 100644 index 000000000000..e07a2de25248 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Support/ProtectedItemActiveLocation.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.Migrate.Support +{ + + /// Gets or sets the location of the protected item. + public partial class ProtectedItemActiveLocationTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert 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) => ProtectedItemActiveLocation.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/src/Migrate/Migrate.Autorest/generated/api/Support/ProtectedItemActiveLocation.cs b/src/Migrate/Migrate.Autorest/generated/api/Support/ProtectedItemActiveLocation.cs new file mode 100644 index 000000000000..1bdc69b5e54e --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Support/ProtectedItemActiveLocation.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.Migrate.Support +{ + + /// Gets or sets the location of the protected item. + public partial struct ProtectedItemActiveLocation : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectedItemActiveLocation Primary = @"Primary"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectedItemActiveLocation Recovery = @"Recovery"; + + /// + /// the value for an instance of the Enum. + /// + private string _value { get; set; } + + /// Conversion from arbitrary object to ProtectedItemActiveLocation + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new ProtectedItemActiveLocation(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type ProtectedItemActiveLocation + /// 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.Migrate.Support.ProtectedItemActiveLocation e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type ProtectedItemActiveLocation (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 ProtectedItemActiveLocation && Equals((ProtectedItemActiveLocation)obj); + } + + /// Returns hashCode for enum ProtectedItemActiveLocation + /// 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 ProtectedItemActiveLocation(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for ProtectedItemActiveLocation + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to ProtectedItemActiveLocation + /// the value to convert to an instance of . + + public static implicit operator ProtectedItemActiveLocation(string value) + { + return new ProtectedItemActiveLocation(value); + } + + /// Implicit operator to convert ProtectedItemActiveLocation to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectedItemActiveLocation e) + { + return e._value; + } + + /// Overriding != operator for enum ProtectedItemActiveLocation + /// 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.Migrate.Support.ProtectedItemActiveLocation e1, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectedItemActiveLocation e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum ProtectedItemActiveLocation + /// 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.Migrate.Support.ProtectedItemActiveLocation e1, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectedItemActiveLocation e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Support/ProtectionState.Completer.cs b/src/Migrate/Migrate.Autorest/generated/api/Support/ProtectionState.Completer.cs new file mode 100644 index 000000000000..5979d688f436 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Support/ProtectionState.Completer.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.Migrate.Support +{ + + /// Gets or sets the protection state. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionStateTypeConverter))] + public partial struct ProtectionState : + 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) || "UnprotectedStatesBegin".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'UnprotectedStatesBegin'", "UnprotectedStatesBegin", global::System.Management.Automation.CompletionResultType.ParameterValue, "UnprotectedStatesBegin"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "EnablingProtection".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'EnablingProtection'", "EnablingProtection", global::System.Management.Automation.CompletionResultType.ParameterValue, "EnablingProtection"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "EnablingFailed".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'EnablingFailed'", "EnablingFailed", global::System.Management.Automation.CompletionResultType.ParameterValue, "EnablingFailed"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "DisablingProtection".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'DisablingProtection'", "DisablingProtection", global::System.Management.Automation.CompletionResultType.ParameterValue, "DisablingProtection"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "MarkedForDeletion".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'MarkedForDeletion'", "MarkedForDeletion", global::System.Management.Automation.CompletionResultType.ParameterValue, "MarkedForDeletion"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "DisablingFailed".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'DisablingFailed'", "DisablingFailed", global::System.Management.Automation.CompletionResultType.ParameterValue, "DisablingFailed"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "UnprotectedStatesEnd".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'UnprotectedStatesEnd'", "UnprotectedStatesEnd", global::System.Management.Automation.CompletionResultType.ParameterValue, "UnprotectedStatesEnd"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "InitialReplicationStatesBegin".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'InitialReplicationStatesBegin'", "InitialReplicationStatesBegin", global::System.Management.Automation.CompletionResultType.ParameterValue, "InitialReplicationStatesBegin"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "InitialReplicationInProgress".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'InitialReplicationInProgress'", "InitialReplicationInProgress", global::System.Management.Automation.CompletionResultType.ParameterValue, "InitialReplicationInProgress"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "InitialReplicationCompletedOnPrimary".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'InitialReplicationCompletedOnPrimary'", "InitialReplicationCompletedOnPrimary", global::System.Management.Automation.CompletionResultType.ParameterValue, "InitialReplicationCompletedOnPrimary"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "InitialReplicationCompletedOnRecovery".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'InitialReplicationCompletedOnRecovery'", "InitialReplicationCompletedOnRecovery", global::System.Management.Automation.CompletionResultType.ParameterValue, "InitialReplicationCompletedOnRecovery"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "InitialReplicationFailed".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'InitialReplicationFailed'", "InitialReplicationFailed", global::System.Management.Automation.CompletionResultType.ParameterValue, "InitialReplicationFailed"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "InitialReplicationStatesEnd".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'InitialReplicationStatesEnd'", "InitialReplicationStatesEnd", global::System.Management.Automation.CompletionResultType.ParameterValue, "InitialReplicationStatesEnd"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "ProtectedStatesBegin".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'ProtectedStatesBegin'", "ProtectedStatesBegin", global::System.Management.Automation.CompletionResultType.ParameterValue, "ProtectedStatesBegin"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Protected".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Protected'", "Protected", global::System.Management.Automation.CompletionResultType.ParameterValue, "Protected"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "ProtectedStatesEnd".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'ProtectedStatesEnd'", "ProtectedStatesEnd", global::System.Management.Automation.CompletionResultType.ParameterValue, "ProtectedStatesEnd"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "PlannedFailoverTransitionStatesBegin".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'PlannedFailoverTransitionStatesBegin'", "PlannedFailoverTransitionStatesBegin", global::System.Management.Automation.CompletionResultType.ParameterValue, "PlannedFailoverTransitionStatesBegin"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "PlannedFailoverInitiated".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'PlannedFailoverInitiated'", "PlannedFailoverInitiated", global::System.Management.Automation.CompletionResultType.ParameterValue, "PlannedFailoverInitiated"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "PlannedFailoverCompleting".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'PlannedFailoverCompleting'", "PlannedFailoverCompleting", global::System.Management.Automation.CompletionResultType.ParameterValue, "PlannedFailoverCompleting"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "PlannedFailoverCompleted".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'PlannedFailoverCompleted'", "PlannedFailoverCompleted", global::System.Management.Automation.CompletionResultType.ParameterValue, "PlannedFailoverCompleted"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "PlannedFailoverFailed".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'PlannedFailoverFailed'", "PlannedFailoverFailed", global::System.Management.Automation.CompletionResultType.ParameterValue, "PlannedFailoverFailed"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "PlannedFailoverCompletionFailed".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'PlannedFailoverCompletionFailed'", "PlannedFailoverCompletionFailed", global::System.Management.Automation.CompletionResultType.ParameterValue, "PlannedFailoverCompletionFailed"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "PlannedFailoverTransitionStatesEnd".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'PlannedFailoverTransitionStatesEnd'", "PlannedFailoverTransitionStatesEnd", global::System.Management.Automation.CompletionResultType.ParameterValue, "PlannedFailoverTransitionStatesEnd"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "UnplannedFailoverTransitionStatesBegin".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'UnplannedFailoverTransitionStatesBegin'", "UnplannedFailoverTransitionStatesBegin", global::System.Management.Automation.CompletionResultType.ParameterValue, "UnplannedFailoverTransitionStatesBegin"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "UnplannedFailoverInitiated".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'UnplannedFailoverInitiated'", "UnplannedFailoverInitiated", global::System.Management.Automation.CompletionResultType.ParameterValue, "UnplannedFailoverInitiated"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "UnplannedFailoverCompleting".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'UnplannedFailoverCompleting'", "UnplannedFailoverCompleting", global::System.Management.Automation.CompletionResultType.ParameterValue, "UnplannedFailoverCompleting"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "UnplannedFailoverCompleted".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'UnplannedFailoverCompleted'", "UnplannedFailoverCompleted", global::System.Management.Automation.CompletionResultType.ParameterValue, "UnplannedFailoverCompleted"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "UnplannedFailoverFailed".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'UnplannedFailoverFailed'", "UnplannedFailoverFailed", global::System.Management.Automation.CompletionResultType.ParameterValue, "UnplannedFailoverFailed"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "UnplannedFailoverCompletionFailed".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'UnplannedFailoverCompletionFailed'", "UnplannedFailoverCompletionFailed", global::System.Management.Automation.CompletionResultType.ParameterValue, "UnplannedFailoverCompletionFailed"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "UnplannedFailoverTransitionStatesEnd".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'UnplannedFailoverTransitionStatesEnd'", "UnplannedFailoverTransitionStatesEnd", global::System.Management.Automation.CompletionResultType.ParameterValue, "UnplannedFailoverTransitionStatesEnd"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "CommitFailoverStatesBegin".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'CommitFailoverStatesBegin'", "CommitFailoverStatesBegin", global::System.Management.Automation.CompletionResultType.ParameterValue, "CommitFailoverStatesBegin"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "CommitFailoverInProgressOnPrimary".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'CommitFailoverInProgressOnPrimary'", "CommitFailoverInProgressOnPrimary", global::System.Management.Automation.CompletionResultType.ParameterValue, "CommitFailoverInProgressOnPrimary"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "CommitFailoverInProgressOnRecovery".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'CommitFailoverInProgressOnRecovery'", "CommitFailoverInProgressOnRecovery", global::System.Management.Automation.CompletionResultType.ParameterValue, "CommitFailoverInProgressOnRecovery"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "CommitFailoverCompleted".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'CommitFailoverCompleted'", "CommitFailoverCompleted", global::System.Management.Automation.CompletionResultType.ParameterValue, "CommitFailoverCompleted"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "CommitFailoverFailedOnPrimary".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'CommitFailoverFailedOnPrimary'", "CommitFailoverFailedOnPrimary", global::System.Management.Automation.CompletionResultType.ParameterValue, "CommitFailoverFailedOnPrimary"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "CommitFailoverFailedOnRecovery".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'CommitFailoverFailedOnRecovery'", "CommitFailoverFailedOnRecovery", global::System.Management.Automation.CompletionResultType.ParameterValue, "CommitFailoverFailedOnRecovery"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "CommitFailoverStatesEnd".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'CommitFailoverStatesEnd'", "CommitFailoverStatesEnd", global::System.Management.Automation.CompletionResultType.ParameterValue, "CommitFailoverStatesEnd"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "CancelFailoverStatesBegin".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'CancelFailoverStatesBegin'", "CancelFailoverStatesBegin", global::System.Management.Automation.CompletionResultType.ParameterValue, "CancelFailoverStatesBegin"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "CancelFailoverInProgressOnPrimary".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'CancelFailoverInProgressOnPrimary'", "CancelFailoverInProgressOnPrimary", global::System.Management.Automation.CompletionResultType.ParameterValue, "CancelFailoverInProgressOnPrimary"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "CancelFailoverInProgressOnRecovery".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'CancelFailoverInProgressOnRecovery'", "CancelFailoverInProgressOnRecovery", global::System.Management.Automation.CompletionResultType.ParameterValue, "CancelFailoverInProgressOnRecovery"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "CancelFailoverFailedOnPrimary".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'CancelFailoverFailedOnPrimary'", "CancelFailoverFailedOnPrimary", global::System.Management.Automation.CompletionResultType.ParameterValue, "CancelFailoverFailedOnPrimary"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "CancelFailoverFailedOnRecovery".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'CancelFailoverFailedOnRecovery'", "CancelFailoverFailedOnRecovery", global::System.Management.Automation.CompletionResultType.ParameterValue, "CancelFailoverFailedOnRecovery"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "CancelFailoverStatesEnd".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'CancelFailoverStatesEnd'", "CancelFailoverStatesEnd", global::System.Management.Automation.CompletionResultType.ParameterValue, "CancelFailoverStatesEnd"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "ChangeRecoveryPointStatesBegin".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'ChangeRecoveryPointStatesBegin'", "ChangeRecoveryPointStatesBegin", global::System.Management.Automation.CompletionResultType.ParameterValue, "ChangeRecoveryPointStatesBegin"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "ChangeRecoveryPointInitiated".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'ChangeRecoveryPointInitiated'", "ChangeRecoveryPointInitiated", global::System.Management.Automation.CompletionResultType.ParameterValue, "ChangeRecoveryPointInitiated"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "ChangeRecoveryPointCompleted".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'ChangeRecoveryPointCompleted'", "ChangeRecoveryPointCompleted", global::System.Management.Automation.CompletionResultType.ParameterValue, "ChangeRecoveryPointCompleted"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "ChangeRecoveryPointFailed".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'ChangeRecoveryPointFailed'", "ChangeRecoveryPointFailed", global::System.Management.Automation.CompletionResultType.ParameterValue, "ChangeRecoveryPointFailed"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "ChangeRecoveryPointStatesEnd".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'ChangeRecoveryPointStatesEnd'", "ChangeRecoveryPointStatesEnd", global::System.Management.Automation.CompletionResultType.ParameterValue, "ChangeRecoveryPointStatesEnd"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "ReprotectStatesBegin".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'ReprotectStatesBegin'", "ReprotectStatesBegin", global::System.Management.Automation.CompletionResultType.ParameterValue, "ReprotectStatesBegin"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "ReprotectInitiated".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'ReprotectInitiated'", "ReprotectInitiated", global::System.Management.Automation.CompletionResultType.ParameterValue, "ReprotectInitiated"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "ReprotectFailed".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'ReprotectFailed'", "ReprotectFailed", global::System.Management.Automation.CompletionResultType.ParameterValue, "ReprotectFailed"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "ReprotectStatesEnd".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'ReprotectStatesEnd'", "ReprotectStatesEnd", global::System.Management.Automation.CompletionResultType.ParameterValue, "ReprotectStatesEnd"); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Support/ProtectionState.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Support/ProtectionState.TypeConverter.cs new file mode 100644 index 000000000000..da8a63dd13cd --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Support/ProtectionState.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.Migrate.Support +{ + + /// Gets or sets the protection state. + public partial class ProtectionStateTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert 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) => ProtectionState.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/src/Migrate/Migrate.Autorest/generated/api/Support/ProtectionState.cs b/src/Migrate/Migrate.Autorest/generated/api/Support/ProtectionState.cs new file mode 100644 index 000000000000..1b3ec304fc84 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Support/ProtectionState.cs @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support +{ + + /// Gets or sets the protection state. + public partial struct ProtectionState : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState CancelFailoverFailedOnPrimary = @"CancelFailoverFailedOnPrimary"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState CancelFailoverFailedOnRecovery = @"CancelFailoverFailedOnRecovery"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState CancelFailoverInProgressOnPrimary = @"CancelFailoverInProgressOnPrimary"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState CancelFailoverInProgressOnRecovery = @"CancelFailoverInProgressOnRecovery"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState CancelFailoverStatesBegin = @"CancelFailoverStatesBegin"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState CancelFailoverStatesEnd = @"CancelFailoverStatesEnd"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState ChangeRecoveryPointCompleted = @"ChangeRecoveryPointCompleted"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState ChangeRecoveryPointFailed = @"ChangeRecoveryPointFailed"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState ChangeRecoveryPointInitiated = @"ChangeRecoveryPointInitiated"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState ChangeRecoveryPointStatesBegin = @"ChangeRecoveryPointStatesBegin"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState ChangeRecoveryPointStatesEnd = @"ChangeRecoveryPointStatesEnd"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState CommitFailoverCompleted = @"CommitFailoverCompleted"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState CommitFailoverFailedOnPrimary = @"CommitFailoverFailedOnPrimary"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState CommitFailoverFailedOnRecovery = @"CommitFailoverFailedOnRecovery"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState CommitFailoverInProgressOnPrimary = @"CommitFailoverInProgressOnPrimary"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState CommitFailoverInProgressOnRecovery = @"CommitFailoverInProgressOnRecovery"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState CommitFailoverStatesBegin = @"CommitFailoverStatesBegin"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState CommitFailoverStatesEnd = @"CommitFailoverStatesEnd"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState DisablingFailed = @"DisablingFailed"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState DisablingProtection = @"DisablingProtection"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState EnablingFailed = @"EnablingFailed"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState EnablingProtection = @"EnablingProtection"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState InitialReplicationCompletedOnPrimary = @"InitialReplicationCompletedOnPrimary"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState InitialReplicationCompletedOnRecovery = @"InitialReplicationCompletedOnRecovery"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState InitialReplicationFailed = @"InitialReplicationFailed"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState InitialReplicationInProgress = @"InitialReplicationInProgress"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState InitialReplicationStatesBegin = @"InitialReplicationStatesBegin"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState InitialReplicationStatesEnd = @"InitialReplicationStatesEnd"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState MarkedForDeletion = @"MarkedForDeletion"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState PlannedFailoverCompleted = @"PlannedFailoverCompleted"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState PlannedFailoverCompleting = @"PlannedFailoverCompleting"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState PlannedFailoverCompletionFailed = @"PlannedFailoverCompletionFailed"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState PlannedFailoverFailed = @"PlannedFailoverFailed"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState PlannedFailoverInitiated = @"PlannedFailoverInitiated"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState PlannedFailoverTransitionStatesBegin = @"PlannedFailoverTransitionStatesBegin"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState PlannedFailoverTransitionStatesEnd = @"PlannedFailoverTransitionStatesEnd"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState Protected = @"Protected"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState ProtectedStatesBegin = @"ProtectedStatesBegin"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState ProtectedStatesEnd = @"ProtectedStatesEnd"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState ReprotectFailed = @"ReprotectFailed"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState ReprotectInitiated = @"ReprotectInitiated"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState ReprotectStatesBegin = @"ReprotectStatesBegin"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState ReprotectStatesEnd = @"ReprotectStatesEnd"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState UnplannedFailoverCompleted = @"UnplannedFailoverCompleted"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState UnplannedFailoverCompleting = @"UnplannedFailoverCompleting"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState UnplannedFailoverCompletionFailed = @"UnplannedFailoverCompletionFailed"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState UnplannedFailoverFailed = @"UnplannedFailoverFailed"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState UnplannedFailoverInitiated = @"UnplannedFailoverInitiated"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState UnplannedFailoverTransitionStatesBegin = @"UnplannedFailoverTransitionStatesBegin"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState UnplannedFailoverTransitionStatesEnd = @"UnplannedFailoverTransitionStatesEnd"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState UnprotectedStatesBegin = @"UnprotectedStatesBegin"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState UnprotectedStatesEnd = @"UnprotectedStatesEnd"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to ProtectionState + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new ProtectionState(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type ProtectionState + /// 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.Migrate.Support.ProtectionState e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type ProtectionState (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 ProtectionState && Equals((ProtectionState)obj); + } + + /// Returns hashCode for enum ProtectionState + /// 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 ProtectionState(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for ProtectionState + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to ProtectionState + /// the value to convert to an instance of . + + public static implicit operator ProtectionState(string value) + { + return new ProtectionState(value); + } + + /// Implicit operator to convert ProtectionState to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState e) + { + return e._value; + } + + /// Overriding != operator for enum ProtectionState + /// 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.Migrate.Support.ProtectionState e1, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum ProtectionState + /// 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.Migrate.Support.ProtectionState e1, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProtectionState e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Support/ProvisioningState.Completer.cs b/src/Migrate/Migrate.Autorest/generated/api/Support/ProvisioningState.Completer.cs index fad76cd68540..ce1e1fd5dc2a 100644 --- a/src/Migrate/Migrate.Autorest/generated/api/Support/ProvisioningState.Completer.cs +++ b/src/Migrate/Migrate.Autorest/generated/api/Support/ProvisioningState.Completer.cs @@ -50,6 +50,18 @@ public partial struct ProvisioningState : { yield return new global::System.Management.Automation.CompletionResult("'Succeeded'", "Succeeded", global::System.Management.Automation.CompletionResultType.ParameterValue, "Succeeded"); } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Canceled".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Canceled'", "Canceled", global::System.Management.Automation.CompletionResultType.ParameterValue, "Canceled"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Deleted".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Deleted'", "Deleted", global::System.Management.Automation.CompletionResultType.ParameterValue, "Deleted"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Updating".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Updating'", "Updating", global::System.Management.Automation.CompletionResultType.ParameterValue, "Updating"); + } } } } \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Support/ProvisioningState.cs b/src/Migrate/Migrate.Autorest/generated/api/Support/ProvisioningState.cs index 660bfe38da4d..a7b6b9a3442d 100644 --- a/src/Migrate/Migrate.Autorest/generated/api/Support/ProvisioningState.cs +++ b/src/Migrate/Migrate.Autorest/generated/api/Support/ProvisioningState.cs @@ -12,8 +12,12 @@ public partial struct ProvisioningState : { public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState Accepted = @"Accepted"; + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState Canceled = @"Canceled"; + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState Creating = @"Creating"; + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState Deleted = @"Deleted"; + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState Deleting = @"Deleting"; public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState Failed = @"Failed"; @@ -22,6 +26,8 @@ public partial struct ProvisioningState : public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState Succeeded = @"Succeeded"; + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ProvisioningState Updating = @"Updating"; + /// the value for an instance of the Enum. private string _value { get; set; } diff --git a/src/Migrate/Migrate.Autorest/generated/api/Support/RecoveryPointType.Completer.cs b/src/Migrate/Migrate.Autorest/generated/api/Support/RecoveryPointType.Completer.cs index 4c4a9af0f5a8..0fb2977475c7 100644 --- a/src/Migrate/Migrate.Autorest/generated/api/Support/RecoveryPointType.Completer.cs +++ b/src/Migrate/Migrate.Autorest/generated/api/Support/RecoveryPointType.Completer.cs @@ -6,10 +6,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. - /// + /// Gets or sets the recovery point type. [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.RecoveryPointTypeTypeConverter))] public partial struct RecoveryPointType : System.Management.Automation.IArgumentCompleter @@ -29,6 +26,14 @@ public partial struct RecoveryPointType : /// 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"); + } 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"); diff --git a/src/Migrate/Migrate.Autorest/generated/api/Support/RecoveryPointType.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Support/RecoveryPointType.TypeConverter.cs index 817dbc71b753..bcaaec419273 100644 --- a/src/Migrate/Migrate.Autorest/generated/api/Support/RecoveryPointType.TypeConverter.cs +++ b/src/Migrate/Migrate.Autorest/generated/api/Support/RecoveryPointType.TypeConverter.cs @@ -6,10 +6,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. - /// + /// Gets or sets the recovery point type. public partial class RecoveryPointTypeTypeConverter : global::System.Management.Automation.PSTypeConverter { diff --git a/src/Migrate/Migrate.Autorest/generated/api/Support/RecoveryPointType.cs b/src/Migrate/Migrate.Autorest/generated/api/Support/RecoveryPointType.cs index ea188551e6f2..de9648607654 100644 --- a/src/Migrate/Migrate.Autorest/generated/api/Support/RecoveryPointType.cs +++ b/src/Migrate/Migrate.Autorest/generated/api/Support/RecoveryPointType.cs @@ -6,13 +6,14 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. - /// + /// Gets or sets the recovery point type. public partial struct RecoveryPointType : System.IEquatable { + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.RecoveryPointType ApplicationConsistent = @"ApplicationConsistent"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.RecoveryPointType CrashConsistent = @"CrashConsistent"; + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.RecoveryPointType Custom = @"Custom"; public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.RecoveryPointType LatestTag = @"LatestTag"; diff --git a/src/Migrate/Migrate.Autorest/generated/api/Support/ReplicationVaultType.Completer.cs b/src/Migrate/Migrate.Autorest/generated/api/Support/ReplicationVaultType.Completer.cs new file mode 100644 index 000000000000..477791535b6b --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Support/ReplicationVaultType.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.Migrate.Support +{ + + /// Gets or sets the type of vault. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ReplicationVaultTypeTypeConverter))] + public partial struct ReplicationVaultType : + 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) || "DisasterRecovery".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'DisasterRecovery'", "DisasterRecovery", global::System.Management.Automation.CompletionResultType.ParameterValue, "DisasterRecovery"); + } + 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"); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Support/ReplicationVaultType.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Support/ReplicationVaultType.TypeConverter.cs new file mode 100644 index 000000000000..283a433742f1 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Support/ReplicationVaultType.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.Migrate.Support +{ + + /// Gets or sets the type of vault. + public partial class ReplicationVaultTypeTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert 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) => ReplicationVaultType.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/src/Migrate/Migrate.Autorest/generated/api/Support/ReplicationVaultType.cs b/src/Migrate/Migrate.Autorest/generated/api/Support/ReplicationVaultType.cs new file mode 100644 index 000000000000..7dc46ce9d780 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Support/ReplicationVaultType.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.Migrate.Support +{ + + /// Gets or sets the type of vault. + public partial struct ReplicationVaultType : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ReplicationVaultType DisasterRecovery = @"DisasterRecovery"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ReplicationVaultType Migrate = @"Migrate"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to ReplicationVaultType + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new ReplicationVaultType(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type ReplicationVaultType + /// 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.Migrate.Support.ReplicationVaultType e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type ReplicationVaultType (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 ReplicationVaultType && Equals((ReplicationVaultType)obj); + } + + /// Returns hashCode for enum ReplicationVaultType + /// 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 ReplicationVaultType(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for ReplicationVaultType + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to ReplicationVaultType + /// the value to convert to an instance of . + + public static implicit operator ReplicationVaultType(string value) + { + return new ReplicationVaultType(value); + } + + /// Implicit operator to convert ReplicationVaultType to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ReplicationVaultType e) + { + return e._value; + } + + /// Overriding != operator for enum ReplicationVaultType + /// 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.Migrate.Support.ReplicationVaultType e1, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ReplicationVaultType e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum ReplicationVaultType + /// 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.Migrate.Support.ReplicationVaultType e1, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ReplicationVaultType e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Support/ResynchronizationState.Completer.cs b/src/Migrate/Migrate.Autorest/generated/api/Support/ResynchronizationState.Completer.cs new file mode 100644 index 000000000000..933ef7e8dbc5 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Support/ResynchronizationState.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.Migrate.Support +{ + + /// Gets or sets the resynchronization state. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ResynchronizationStateTypeConverter))] + public partial struct ResynchronizationState : + 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) || "ResynchronizationInitiated".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'ResynchronizationInitiated'", "ResynchronizationInitiated", global::System.Management.Automation.CompletionResultType.ParameterValue, "ResynchronizationInitiated"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "ResynchronizationCompleted".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'ResynchronizationCompleted'", "ResynchronizationCompleted", global::System.Management.Automation.CompletionResultType.ParameterValue, "ResynchronizationCompleted"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "ResynchronizationFailed".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'ResynchronizationFailed'", "ResynchronizationFailed", global::System.Management.Automation.CompletionResultType.ParameterValue, "ResynchronizationFailed"); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Support/ResynchronizationState.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Support/ResynchronizationState.TypeConverter.cs new file mode 100644 index 000000000000..8d805696d726 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Support/ResynchronizationState.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.Migrate.Support +{ + + /// Gets or sets the resynchronization state. + public partial class ResynchronizationStateTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert 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) => ResynchronizationState.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/src/Migrate/Migrate.Autorest/generated/api/Support/ResynchronizationState.cs b/src/Migrate/Migrate.Autorest/generated/api/Support/ResynchronizationState.cs new file mode 100644 index 000000000000..be7303a1f355 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Support/ResynchronizationState.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.Migrate.Support +{ + + /// Gets or sets the resynchronization state. + public partial struct ResynchronizationState : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ResynchronizationState None = @"None"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ResynchronizationState ResynchronizationCompleted = @"ResynchronizationCompleted"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ResynchronizationState ResynchronizationFailed = @"ResynchronizationFailed"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ResynchronizationState ResynchronizationInitiated = @"ResynchronizationInitiated"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to ResynchronizationState + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new ResynchronizationState(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type ResynchronizationState + /// 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.Migrate.Support.ResynchronizationState e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type ResynchronizationState (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 ResynchronizationState && Equals((ResynchronizationState)obj); + } + + /// Returns hashCode for enum ResynchronizationState + /// 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 ResynchronizationState(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for ResynchronizationState + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to ResynchronizationState + /// the value to convert to an instance of . + + public static implicit operator ResynchronizationState(string value) + { + return new ResynchronizationState(value); + } + + /// Implicit operator to convert ResynchronizationState to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ResynchronizationState e) + { + return e._value; + } + + /// Overriding != operator for enum ResynchronizationState + /// 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.Migrate.Support.ResynchronizationState e1, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ResynchronizationState e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum ResynchronizationState + /// 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.Migrate.Support.ResynchronizationState e1, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.ResynchronizationState e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Support/TaskState.Completer.cs b/src/Migrate/Migrate.Autorest/generated/api/Support/TaskState.Completer.cs new file mode 100644 index 000000000000..f222a95d0df5 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Support/TaskState.Completer.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support +{ + + /// Gets or sets the task state. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.TaskStateTypeConverter))] + public partial struct TaskState : + 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) || "Pending".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Pending'", "Pending", global::System.Management.Automation.CompletionResultType.ParameterValue, "Pending"); + } + 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) || "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) || "Skipped".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Skipped'", "Skipped", global::System.Management.Automation.CompletionResultType.ParameterValue, "Skipped"); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Support/TaskState.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Support/TaskState.TypeConverter.cs new file mode 100644 index 000000000000..15ac147bb489 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Support/TaskState.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.Migrate.Support +{ + + /// Gets or sets the task state. + public partial class TaskStateTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert 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) => TaskState.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/src/Migrate/Migrate.Autorest/generated/api/Support/TaskState.cs b/src/Migrate/Migrate.Autorest/generated/api/Support/TaskState.cs new file mode 100644 index 000000000000..4f3b5e98a41b --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Support/TaskState.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.Migrate.Support +{ + + /// Gets or sets the task state. + public partial struct TaskState : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.TaskState Cancelled = @"Cancelled"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.TaskState Failed = @"Failed"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.TaskState Pending = @"Pending"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.TaskState Skipped = @"Skipped"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.TaskState Started = @"Started"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.TaskState Succeeded = @"Succeeded"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to TaskState + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new TaskState(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type TaskState + /// 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.Migrate.Support.TaskState e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type TaskState (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 TaskState && Equals((TaskState)obj); + } + + /// Returns hashCode for enum TaskState + /// 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 TaskState(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for TaskState + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to TaskState + /// the value to convert to an instance of . + + public static implicit operator TaskState(string value) + { + return new TaskState(value); + } + + /// Implicit operator to convert TaskState to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.TaskState e) + { + return e._value; + } + + /// Overriding != operator for enum TaskState + /// 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.Migrate.Support.TaskState e1, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.TaskState e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum TaskState + /// 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.Migrate.Support.TaskState e1, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.TaskState e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Support/TestFailoverState.Completer.cs b/src/Migrate/Migrate.Autorest/generated/api/Support/TestFailoverState.Completer.cs new file mode 100644 index 000000000000..da38dab71a82 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Support/TestFailoverState.Completer.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.Migrate.Support +{ + + /// Gets or sets the test failover state. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.TestFailoverStateTypeConverter))] + public partial struct TestFailoverState : + 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) || "TestFailoverInitiated".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'TestFailoverInitiated'", "TestFailoverInitiated", global::System.Management.Automation.CompletionResultType.ParameterValue, "TestFailoverInitiated"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "TestFailoverCompleting".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'TestFailoverCompleting'", "TestFailoverCompleting", global::System.Management.Automation.CompletionResultType.ParameterValue, "TestFailoverCompleting"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "TestFailoverCompleted".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'TestFailoverCompleted'", "TestFailoverCompleted", global::System.Management.Automation.CompletionResultType.ParameterValue, "TestFailoverCompleted"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "TestFailoverFailed".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'TestFailoverFailed'", "TestFailoverFailed", global::System.Management.Automation.CompletionResultType.ParameterValue, "TestFailoverFailed"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "TestFailoverCompletionFailed".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'TestFailoverCompletionFailed'", "TestFailoverCompletionFailed", global::System.Management.Automation.CompletionResultType.ParameterValue, "TestFailoverCompletionFailed"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "TestFailoverCleanupInitiated".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'TestFailoverCleanupInitiated'", "TestFailoverCleanupInitiated", global::System.Management.Automation.CompletionResultType.ParameterValue, "TestFailoverCleanupInitiated"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "TestFailoverCleanupCompleting".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'TestFailoverCleanupCompleting'", "TestFailoverCleanupCompleting", global::System.Management.Automation.CompletionResultType.ParameterValue, "TestFailoverCleanupCompleting"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "MarkedForDeletion".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'MarkedForDeletion'", "MarkedForDeletion", global::System.Management.Automation.CompletionResultType.ParameterValue, "MarkedForDeletion"); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Support/TestFailoverState.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Support/TestFailoverState.TypeConverter.cs new file mode 100644 index 000000000000..d4d4542f46a7 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Support/TestFailoverState.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.Migrate.Support +{ + + /// Gets or sets the test failover state. + public partial class TestFailoverStateTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert 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) => TestFailoverState.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/src/Migrate/Migrate.Autorest/generated/api/Support/TestFailoverState.cs b/src/Migrate/Migrate.Autorest/generated/api/Support/TestFailoverState.cs new file mode 100644 index 000000000000..84f9d1d4b3b9 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Support/TestFailoverState.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.Migrate.Support +{ + + /// Gets or sets the test failover state. + public partial struct TestFailoverState : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.TestFailoverState MarkedForDeletion = @"MarkedForDeletion"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.TestFailoverState None = @"None"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.TestFailoverState TestFailoverCleanupCompleting = @"TestFailoverCleanupCompleting"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.TestFailoverState TestFailoverCleanupInitiated = @"TestFailoverCleanupInitiated"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.TestFailoverState TestFailoverCompleted = @"TestFailoverCompleted"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.TestFailoverState TestFailoverCompleting = @"TestFailoverCompleting"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.TestFailoverState TestFailoverCompletionFailed = @"TestFailoverCompletionFailed"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.TestFailoverState TestFailoverFailed = @"TestFailoverFailed"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.TestFailoverState TestFailoverInitiated = @"TestFailoverInitiated"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to TestFailoverState + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new TestFailoverState(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type TestFailoverState + /// 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.Migrate.Support.TestFailoverState e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type TestFailoverState (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 TestFailoverState && Equals((TestFailoverState)obj); + } + + /// Returns hashCode for enum TestFailoverState + /// 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 TestFailoverState(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for TestFailoverState + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to TestFailoverState + /// the value to convert to an instance of . + + public static implicit operator TestFailoverState(string value) + { + return new TestFailoverState(value); + } + + /// Implicit operator to convert TestFailoverState to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.TestFailoverState e) + { + return e._value; + } + + /// Overriding != operator for enum TestFailoverState + /// 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.Migrate.Support.TestFailoverState e1, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.TestFailoverState e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum TestFailoverState + /// 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.Migrate.Support.TestFailoverState e1, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.TestFailoverState e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Support/VMNicSelection.Completer.cs b/src/Migrate/Migrate.Autorest/generated/api/Support/VMNicSelection.Completer.cs new file mode 100644 index 000000000000..c5c9ea5c6e94 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Support/VMNicSelection.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.Migrate.Support +{ + + /// Gets or sets the selection type of the NIC. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelectionTypeConverter))] + public partial struct VMNicSelection : + 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) || "NotSelected".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'NotSelected'", "NotSelected", global::System.Management.Automation.CompletionResultType.ParameterValue, "NotSelected"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "SelectedByUser".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'SelectedByUser'", "SelectedByUser", global::System.Management.Automation.CompletionResultType.ParameterValue, "SelectedByUser"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "SelectedByDefault".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'SelectedByDefault'", "SelectedByDefault", global::System.Management.Automation.CompletionResultType.ParameterValue, "SelectedByDefault"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "SelectedByUserOverride".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'SelectedByUserOverride'", "SelectedByUserOverride", global::System.Management.Automation.CompletionResultType.ParameterValue, "SelectedByUserOverride"); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Support/VMNicSelection.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Support/VMNicSelection.TypeConverter.cs new file mode 100644 index 000000000000..24f4382520d9 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Support/VMNicSelection.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.Migrate.Support +{ + + /// Gets or sets the selection type of the NIC. + public partial class VMNicSelectionTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert 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) => VMNicSelection.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/src/Migrate/Migrate.Autorest/generated/api/Support/VMNicSelection.cs b/src/Migrate/Migrate.Autorest/generated/api/Support/VMNicSelection.cs new file mode 100644 index 000000000000..e9a1ed646451 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Support/VMNicSelection.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.Migrate.Support +{ + + /// Gets or sets the selection type of the NIC. + public partial struct VMNicSelection : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection NotSelected = @"NotSelected"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection SelectedByDefault = @"SelectedByDefault"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection SelectedByUser = @"SelectedByUser"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection SelectedByUserOverride = @"SelectedByUserOverride"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to VMNicSelection + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new VMNicSelection(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type VMNicSelection + /// 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.Migrate.Support.VMNicSelection e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type VMNicSelection (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 VMNicSelection && Equals((VMNicSelection)obj); + } + + /// Returns hashCode for enum VMNicSelection + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Returns string representation for VMNicSelection + /// 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 VMNicSelection(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Implicit operator to convert string to VMNicSelection + /// the value to convert to an instance of . + + public static implicit operator VMNicSelection(string value) + { + return new VMNicSelection(value); + } + + /// Implicit operator to convert VMNicSelection to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection e) + { + return e._value; + } + + /// Overriding != operator for enum VMNicSelection + /// 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.Migrate.Support.VMNicSelection e1, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum VMNicSelection + /// 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.Migrate.Support.VMNicSelection e1, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMNicSelection e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Support/VMwareToAzureMigrateResyncState.Completer.cs b/src/Migrate/Migrate.Autorest/generated/api/Support/VMwareToAzureMigrateResyncState.Completer.cs new file mode 100644 index 000000000000..639b8615b7b1 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Support/VMwareToAzureMigrateResyncState.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.Migrate.Support +{ + + /// Gets or sets the resync state. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMwareToAzureMigrateResyncStateTypeConverter))] + public partial struct VMwareToAzureMigrateResyncState : + 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/src/Migrate/Migrate.Autorest/generated/api/Support/VMwareToAzureMigrateResyncState.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Support/VMwareToAzureMigrateResyncState.TypeConverter.cs new file mode 100644 index 000000000000..b26584f19ec2 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Support/VMwareToAzureMigrateResyncState.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.Migrate.Support +{ + + /// Gets or sets the resync state. + public partial class VMwareToAzureMigrateResyncStateTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert 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) => VMwareToAzureMigrateResyncState.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/src/Migrate/Migrate.Autorest/generated/api/Support/VMwareToAzureMigrateResyncState.cs b/src/Migrate/Migrate.Autorest/generated/api/Support/VMwareToAzureMigrateResyncState.cs new file mode 100644 index 000000000000..845ae32a6abb --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Support/VMwareToAzureMigrateResyncState.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.Migrate.Support +{ + + /// Gets or sets the resync state. + public partial struct VMwareToAzureMigrateResyncState : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMwareToAzureMigrateResyncState None = @"None"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMwareToAzureMigrateResyncState PreparedForResynchronization = @"PreparedForResynchronization"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMwareToAzureMigrateResyncState StartedResynchronization = @"StartedResynchronization"; + + /// + /// the value for an instance of the Enum. + /// + private string _value { get; set; } + + /// Conversion from arbitrary object to VMwareToAzureMigrateResyncState + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new VMwareToAzureMigrateResyncState(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type VMwareToAzureMigrateResyncState + /// 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.Migrate.Support.VMwareToAzureMigrateResyncState e) + { + return _value.Equals(e._value); + } + + /// + /// Compares values of enum type VMwareToAzureMigrateResyncState (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 VMwareToAzureMigrateResyncState && Equals((VMwareToAzureMigrateResyncState)obj); + } + + /// Returns hashCode for enum VMwareToAzureMigrateResyncState + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Returns string representation for VMwareToAzureMigrateResyncState + /// 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 VMwareToAzureMigrateResyncState(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Implicit operator to convert string to VMwareToAzureMigrateResyncState + /// the value to convert to an instance of . + + public static implicit operator VMwareToAzureMigrateResyncState(string value) + { + return new VMwareToAzureMigrateResyncState(value); + } + + /// Implicit operator to convert VMwareToAzureMigrateResyncState to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMwareToAzureMigrateResyncState e) + { + return e._value; + } + + /// Overriding != operator for enum VMwareToAzureMigrateResyncState + /// 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.Migrate.Support.VMwareToAzureMigrateResyncState e1, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMwareToAzureMigrateResyncState e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum VMwareToAzureMigrateResyncState + /// 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.Migrate.Support.VMwareToAzureMigrateResyncState e1, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.VMwareToAzureMigrateResyncState e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Support/WorkflowObjectType.Completer.cs b/src/Migrate/Migrate.Autorest/generated/api/Support/WorkflowObjectType.Completer.cs new file mode 100644 index 000000000000..7f97baa06a67 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Support/WorkflowObjectType.Completer.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support +{ + + /// Gets or sets the object type. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowObjectTypeTypeConverter))] + public partial struct WorkflowObjectType : + 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) || "AvsDiskPool".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'AvsDiskPool'", "AvsDiskPool", global::System.Management.Automation.CompletionResultType.ParameterValue, "AvsDiskPool"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Dra".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Dra'", "Dra", global::System.Management.Automation.CompletionResultType.ParameterValue, "Dra"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Fabric".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Fabric'", "Fabric", global::System.Management.Automation.CompletionResultType.ParameterValue, "Fabric"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Policy".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Policy'", "Policy", global::System.Management.Automation.CompletionResultType.ParameterValue, "Policy"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "ProtectedItem".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'ProtectedItem'", "ProtectedItem", global::System.Management.Automation.CompletionResultType.ParameterValue, "ProtectedItem"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "RecoveryPlan".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'RecoveryPlan'", "RecoveryPlan", global::System.Management.Automation.CompletionResultType.ParameterValue, "RecoveryPlan"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "ReplicationExtension".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'ReplicationExtension'", "ReplicationExtension", global::System.Management.Automation.CompletionResultType.ParameterValue, "ReplicationExtension"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Vault".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Vault'", "Vault", global::System.Management.Automation.CompletionResultType.ParameterValue, "Vault"); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Support/WorkflowObjectType.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Support/WorkflowObjectType.TypeConverter.cs new file mode 100644 index 000000000000..651f09f9a4fd --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Support/WorkflowObjectType.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.Migrate.Support +{ + + /// Gets or sets the object type. + public partial class WorkflowObjectTypeTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert 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) => WorkflowObjectType.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/src/Migrate/Migrate.Autorest/generated/api/Support/WorkflowObjectType.cs b/src/Migrate/Migrate.Autorest/generated/api/Support/WorkflowObjectType.cs new file mode 100644 index 000000000000..c4392175abad --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Support/WorkflowObjectType.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.Migrate.Support +{ + + /// Gets or sets the object type. + public partial struct WorkflowObjectType : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowObjectType AvsDiskPool = @"AvsDiskPool"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowObjectType Dra = @"Dra"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowObjectType Fabric = @"Fabric"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowObjectType Policy = @"Policy"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowObjectType ProtectedItem = @"ProtectedItem"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowObjectType RecoveryPlan = @"RecoveryPlan"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowObjectType ReplicationExtension = @"ReplicationExtension"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowObjectType Vault = @"Vault"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to WorkflowObjectType + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new WorkflowObjectType(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type WorkflowObjectType + /// 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.Migrate.Support.WorkflowObjectType e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type WorkflowObjectType (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 WorkflowObjectType && Equals((WorkflowObjectType)obj); + } + + /// Returns hashCode for enum WorkflowObjectType + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Returns string representation for WorkflowObjectType + /// 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 WorkflowObjectType(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Implicit operator to convert string to WorkflowObjectType + /// the value to convert to an instance of . + + public static implicit operator WorkflowObjectType(string value) + { + return new WorkflowObjectType(value); + } + + /// Implicit operator to convert WorkflowObjectType to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowObjectType e) + { + return e._value; + } + + /// Overriding != operator for enum WorkflowObjectType + /// 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.Migrate.Support.WorkflowObjectType e1, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowObjectType e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum WorkflowObjectType + /// 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.Migrate.Support.WorkflowObjectType e1, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowObjectType e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Support/WorkflowState.Completer.cs b/src/Migrate/Migrate.Autorest/generated/api/Support/WorkflowState.Completer.cs new file mode 100644 index 000000000000..c96b0323b086 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Support/WorkflowState.Completer.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.Migrate.Support +{ + + /// Gets or sets the workflow state. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowStateTypeConverter))] + public partial struct WorkflowState : + 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) || "Pending".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Pending'", "Pending", global::System.Management.Automation.CompletionResultType.ParameterValue, "Pending"); + } + 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) || "Cancelling".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'Cancelling'", "Cancelling", global::System.Management.Automation.CompletionResultType.ParameterValue, "Cancelling"); + } + 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) || "CompletedWithInformation".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'CompletedWithInformation'", "CompletedWithInformation", global::System.Management.Automation.CompletionResultType.ParameterValue, "CompletedWithInformation"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "CompletedWithWarnings".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'CompletedWithWarnings'", "CompletedWithWarnings", global::System.Management.Automation.CompletionResultType.ParameterValue, "CompletedWithWarnings"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "CompletedWithErrors".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("'CompletedWithErrors'", "CompletedWithErrors", global::System.Management.Automation.CompletionResultType.ParameterValue, "CompletedWithErrors"); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/api/Support/WorkflowState.TypeConverter.cs b/src/Migrate/Migrate.Autorest/generated/api/Support/WorkflowState.TypeConverter.cs new file mode 100644 index 000000000000..a8522185ad8c --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Support/WorkflowState.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.Migrate.Support +{ + + /// Gets or sets the workflow state. + public partial class WorkflowStateTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the parameter. + /// + /// the to convert from + /// the to convert 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) => WorkflowState.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/src/Migrate/Migrate.Autorest/generated/api/Support/WorkflowState.cs b/src/Migrate/Migrate.Autorest/generated/api/Support/WorkflowState.cs new file mode 100644 index 000000000000..f339b5d2f50d --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/api/Support/WorkflowState.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.Migrate.Support +{ + + /// Gets or sets the workflow state. + public partial struct WorkflowState : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowState Cancelled = @"Cancelled"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowState Cancelling = @"Cancelling"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowState CompletedWithErrors = @"CompletedWithErrors"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowState CompletedWithInformation = @"CompletedWithInformation"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowState CompletedWithWarnings = @"CompletedWithWarnings"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowState Failed = @"Failed"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowState Pending = @"Pending"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowState Started = @"Started"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowState Succeeded = @"Succeeded"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to WorkflowState + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new WorkflowState(global::System.Convert.ToString(value)); + } + + /// Compares values of enum type WorkflowState + /// 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.Migrate.Support.WorkflowState e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type WorkflowState (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 WorkflowState && Equals((WorkflowState)obj); + } + + /// Returns hashCode for enum WorkflowState + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Returns string representation for WorkflowState + /// 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 WorkflowState(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Implicit operator to convert string to WorkflowState + /// the value to convert to an instance of . + + public static implicit operator WorkflowState(string value) + { + return new WorkflowState(value); + } + + /// Implicit operator to convert WorkflowState to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowState e) + { + return e._value; + } + + /// Overriding != operator for enum WorkflowState + /// 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.Migrate.Support.WorkflowState e1, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowState e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum WorkflowState + /// 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.Migrate.Support.WorkflowState e1, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Support.WorkflowState e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateDra_Get.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateDra_Get.cs new file mode 100644 index 000000000000..a0bd0c80af5a --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateDra_Get.cs @@ -0,0 +1,420 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Gets the details of the fabric agent. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMigrateDra_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModel))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Gets the details of the fabric agent.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}", ApiVersion = "2021-02-16-preview")] + public partial class GetAzMigrateDra_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricAgentName; + + /// The fabric agent (Dra) name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The fabric agent (Dra) name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The fabric agent (Dra) name.", + SerializedName = @"fabricAgentName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string FabricAgentName { get => this._fabricAgentName; set => this._fabricAgentName = value; } + + /// 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.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure Subscription Id in which migrate project was created. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure Subscription Id in which migrate project was created.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure Subscription Id in which migrate project was created.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20210216Preview.IDraModel + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 GetAzMigrateDra_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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.DraGet(SubscriptionId, ResourceGroupName, FabricName, FabricAgentName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,FabricName=FabricName,FabricAgentName=FabricAgentName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, FabricName=FabricName, FabricAgentName=FabricAgentName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, FabricName=FabricName, FabricAgentName=FabricAgentName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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.Migrate.Models.Api20210216Preview.IDraModel + /// 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.Migrate.Models.Api20210216Preview.IDraModel + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateDra_GetViaIdentity.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateDra_GetViaIdentity.cs new file mode 100644 index 000000000000..0ef20b84d9de --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateDra_GetViaIdentity.cs @@ -0,0 +1,389 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Gets the details of the fabric agent. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMigrateDra_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModel))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Gets the details of the fabric agent.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}", ApiVersion = "2021-02-16-preview")] + public partial class GetAzMigrateDra_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity 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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20210216Preview.IDraModel + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 GetAzMigrateDra_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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.DraGetViaIdentity(InputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + 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.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.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.FabricAgentName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricAgentName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.DraGet(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.FabricName ?? null, InputObject.FabricAgentName ?? null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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.Migrate.Models.Api20210216Preview.IDraModel + /// 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.Migrate.Models.Api20210216Preview.IDraModel + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateDra_List.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateDra_List.cs new file mode 100644 index 000000000000..3e896203e777 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateDra_List.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.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Gets the list of fabric agents in the given fabric. + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMigrateDra_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModel))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Gets the list of fabric agents in the given fabric.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents", ApiVersion = "2021-02-16-preview")] + public partial class GetAzMigrateDra_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure Subscription Id in which migrate project was created. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure Subscription Id in which migrate project was created.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure Subscription Id in which migrate project was created.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20210216Preview.IDraModelCollection + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 GetAzMigrateDra_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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.DraList(SubscriptionId, ResourceGroupName, FabricName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,FabricName=FabricName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, FabricName=FabricName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, FabricName=FabricName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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.Migrate.Models.Api20210216Preview.IDraModelCollection + /// 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.Migrate.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.DraList_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateHCIReplicationFabric_Get.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateHCIReplicationFabric_Get.cs new file mode 100644 index 000000000000..e2ccf3d4f35c --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateHCIReplicationFabric_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.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Gets the details of the fabric. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMigrateHCIReplicationFabric_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModel))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Gets the details of the fabric.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}", ApiVersion = "2021-02-16-preview")] + public partial class GetAzMigrateHCIReplicationFabric_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The fabric name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The fabric name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("FabricName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure Subscription Id in which migrate project was created. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure Subscription Id in which migrate project was created.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure Subscription Id in which migrate project was created.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20210216Preview.IFabricModel + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 GetAzMigrateHCIReplicationFabric_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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.FabricGet(SubscriptionId, ResourceGroupName, Name, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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.Migrate.Models.Api20210216Preview.IFabricModel + /// 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.Migrate.Models.Api20210216Preview.IFabricModel + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateHCIReplicationFabric_GetViaIdentity.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateHCIReplicationFabric_GetViaIdentity.cs new file mode 100644 index 000000000000..794ed1f29ea0 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateHCIReplicationFabric_GetViaIdentity.cs @@ -0,0 +1,384 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Gets the details of the fabric. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMigrateHCIReplicationFabric_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModel))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Gets the details of the fabric.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}", ApiVersion = "2021-02-16-preview")] + public partial class GetAzMigrateHCIReplicationFabric_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity 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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20210216Preview.IFabricModel + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 GetAzMigrateHCIReplicationFabric_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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.FabricGetViaIdentity(InputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + 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.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.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.FabricGet(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.FabricName ?? null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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.Migrate.Models.Api20210216Preview.IFabricModel + /// 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.Migrate.Models.Api20210216Preview.IFabricModel + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateHCIReplicationFabric_List.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateHCIReplicationFabric_List.cs new file mode 100644 index 000000000000..51bc6ebd899c --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateHCIReplicationFabric_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.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Gets the list of fabrics in the given subscription. + /// + /// [OpenAPI] ListBySubscription=>GET:"/subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/replicationFabrics" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMigrateHCIReplicationFabric_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModel))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Gets the list of fabrics in the given subscription.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/replicationFabrics", ApiVersion = "2021-02-16-preview")] + public partial class GetAzMigrateHCIReplicationFabric_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// Backing field for property. + private string _continuationToken; + + /// Continuation token from the previous call. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Continuation token from the previous call.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Continuation token from the previous call.", + SerializedName = @"continuationToken", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Query)] + public string ContinuationToken { get => this._continuationToken; set => this._continuationToken = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure Subscription Id in which migrate project was created. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure Subscription Id in which migrate project was created.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure Subscription Id in which migrate project was created.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20210216Preview.IFabricModelCollection + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 GetAzMigrateHCIReplicationFabric_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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.FabricListBySubscription(SubscriptionId, this.InvocationInformation.BoundParameters.ContainsKey("ContinuationToken") ? ContinuationToken : null, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ContinuationToken=this.InvocationInformation.BoundParameters.ContainsKey("ContinuationToken") ? ContinuationToken : null}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ContinuationToken=this.InvocationInformation.BoundParameters.ContainsKey("ContinuationToken") ? ContinuationToken : null }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ContinuationToken=this.InvocationInformation.BoundParameters.ContainsKey("ContinuationToken") ? ContinuationToken : null }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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.Migrate.Models.Api20210216Preview.IFabricModelCollection + /// 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.Migrate.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.FabricListBySubscription_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateHCIReplicationFabric_List1.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateHCIReplicationFabric_List1.cs new file mode 100644 index 000000000000..87a6b315fa8f --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateHCIReplicationFabric_List1.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.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Gets the list of fabrics in the given subscription and resource group. + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMigrateHCIReplicationFabric_List1")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModel))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Gets the list of fabrics in the given subscription and resource group.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics", ApiVersion = "2021-02-16-preview")] + public partial class GetAzMigrateHCIReplicationFabric_List1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// Backing field for property. + private string _continuationToken; + + /// Continuation token from the previous call. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Continuation token from the previous call.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Continuation token from the previous call.", + SerializedName = @"continuationToken", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Query)] + public string ContinuationToken { get => this._continuationToken; set => this._continuationToken = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure Subscription Id in which migrate project was created. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure Subscription Id in which migrate project was created.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure Subscription Id in which migrate project was created.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20210216Preview.IFabricModelCollection + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 GetAzMigrateHCIReplicationFabric_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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.FabricList(SubscriptionId, ResourceGroupName, this.InvocationInformation.BoundParameters.ContainsKey("ContinuationToken") ? ContinuationToken : null, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,ContinuationToken=this.InvocationInformation.BoundParameters.ContainsKey("ContinuationToken") ? ContinuationToken : null}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, ContinuationToken=this.InvocationInformation.BoundParameters.ContainsKey("ContinuationToken") ? ContinuationToken : null }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, ContinuationToken=this.InvocationInformation.BoundParameters.ContainsKey("ContinuationToken") ? ContinuationToken : null }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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.Migrate.Models.Api20210216Preview.IFabricModelCollection + /// 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.Migrate.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.FabricList_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateHyperVMachine_Get.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateHyperVMachine_Get.cs new file mode 100644 index 000000000000..e35a590ab1c2 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateHyperVMachine_Get.cs @@ -0,0 +1,366 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Method to get machine. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/HyperVSites/{siteName}/machines/{machineName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMigrateHyperVMachine_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVMachine))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Method to get machine.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/HyperVSites/{siteName}/machines/{machineName}", ApiVersion = "2020-01-01")] + public partial class GetAzMigrateHyperVMachine_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 _machineName; + + /// Machine ARM name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Machine ARM name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Machine ARM name.", + SerializedName = @"machineName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string MachineName { get => this._machineName; set => this._machineName = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _siteName; + + /// Site name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Site name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Site name.", + SerializedName = @"siteName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string SiteName { get => this._siteName; set => this._siteName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api202001.IHyperVMachine + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 GetAzMigrateHyperVMachine_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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.HyperVMachinesGet(SubscriptionId, ResourceGroupName, SiteName, MachineName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,SiteName=SiteName,MachineName=MachineName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api202001.IHyperVMachine + /// 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.Migrate.Models.Api202001.IHyperVMachine + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateHyperVMachine_List.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateHyperVMachine_List.cs new file mode 100644 index 000000000000..d06775be59fa --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateHyperVMachine_List.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.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Method to get machine. + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/HyperVSites/{siteName}/machines" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMigrateHyperVMachine_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVMachine))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Method to get machine.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/HyperVSites/{siteName}/machines", ApiVersion = "2020-01-01")] + public partial class GetAzMigrateHyperVMachine_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// Backing field for property. + private string _continuationToken; + + /// Optional parameter for continuation token. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Optional parameter for continuation token.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Optional parameter for continuation token.", + SerializedName = @"continuationToken", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Query)] + public string ContinuationToken { get => this._continuationToken; set => this._continuationToken = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _filter; + + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = ".")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"$filter", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _siteName; + + /// Site name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Site name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Site name.", + SerializedName = @"siteName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string SiteName { get => this._siteName; set => this._siteName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private int _top; + + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = ".")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"", + SerializedName = @"$top", + PossibleTypes = new [] { typeof(int) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Query)] + public int Top { get => this._top; set => this._top = value; } + + /// Backing field for property. + private int _totalRecordCount; + + /// Total count of machines in the given site. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Total count of machines in the given site.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Total count of machines in the given site.", + SerializedName = @"totalRecordCount", + PossibleTypes = new [] { typeof(int) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Query)] + public int TotalRecordCount { get => this._totalRecordCount; set => this._totalRecordCount = 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.Migrate.Models.Api202001.IHyperVMachineCollection + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 GetAzMigrateHyperVMachine_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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.HyperVMachinesList(SubscriptionId, ResourceGroupName, SiteName, this.InvocationInformation.BoundParameters.ContainsKey("Filter") ? Filter : null, this.InvocationInformation.BoundParameters.ContainsKey("Top") ? Top : default(int?), this.InvocationInformation.BoundParameters.ContainsKey("ContinuationToken") ? ContinuationToken : null, this.InvocationInformation.BoundParameters.ContainsKey("TotalRecordCount") ? TotalRecordCount : default(int?), onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,SiteName=SiteName,Filter=this.InvocationInformation.BoundParameters.ContainsKey("Filter") ? Filter : null,Top=this.InvocationInformation.BoundParameters.ContainsKey("Top") ? Top : default(int?),ContinuationToken=this.InvocationInformation.BoundParameters.ContainsKey("ContinuationToken") ? ContinuationToken : null,TotalRecordCount=this.InvocationInformation.BoundParameters.ContainsKey("TotalRecordCount") ? TotalRecordCount : default(int?)}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api202001.IHyperVMachineCollection + /// 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.Migrate.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.HyperVMachinesList_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateHyperVRunAsAccount_Get.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateHyperVRunAsAccount_Get.cs new file mode 100644 index 000000000000..1d1a75341d81 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateHyperVRunAsAccount_Get.cs @@ -0,0 +1,366 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Method to get run as account. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/HyperVSites/{siteName}/runAsAccounts/{accountName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMigrateHyperVRunAsAccount_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVRunAsAccount))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Method to get run as account.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/HyperVSites/{siteName}/runAsAccounts/{accountName}", ApiVersion = "2020-01-01")] + public partial class GetAzMigrateHyperVRunAsAccount_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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 _accountName; + + /// Run as account ARM name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Run as account ARM name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Run as account ARM name.", + SerializedName = @"accountName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string AccountName { get => this._accountName; set => this._accountName = 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _siteName; + + /// Site name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Site name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Site name.", + SerializedName = @"siteName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string SiteName { get => this._siteName; set => this._siteName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api202001.IHyperVRunAsAccount + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 GetAzMigrateHyperVRunAsAccount_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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.HyperVRunAsAccountsGet(SubscriptionId, ResourceGroupName, SiteName, AccountName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,SiteName=SiteName,AccountName=AccountName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api202001.IHyperVRunAsAccount + /// 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.Migrate.Models.Api202001.IHyperVRunAsAccount + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateHyperVRunAsAccount_List.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateHyperVRunAsAccount_List.cs new file mode 100644 index 000000000000..456acb983b62 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateHyperVRunAsAccount_List.cs @@ -0,0 +1,374 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Method to get run as accounts. + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/HyperVSites/{siteName}/runAsAccounts" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMigrateHyperVRunAsAccount_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVRunAsAccount))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Method to get run as accounts.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/HyperVSites/{siteName}/runAsAccounts", ApiVersion = "2020-01-01")] + public partial class GetAzMigrateHyperVRunAsAccount_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _siteName; + + /// Site name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Site name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Site name.", + SerializedName = @"siteName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string SiteName { get => this._siteName; set => this._siteName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api202001.IHyperVRunAsAccountCollection + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 GetAzMigrateHyperVRunAsAccount_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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.HyperVRunAsAccountsList(SubscriptionId, ResourceGroupName, SiteName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,SiteName=SiteName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api202001.IHyperVRunAsAccountCollection + /// 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.Migrate.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.HyperVRunAsAccountsList_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateHyperVSite_Get.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateHyperVSite_Get.cs new file mode 100644 index 000000000000..49c08a792ed0 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateHyperVSite_Get.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.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Method to get a site. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/HyperVSites/{siteName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMigrateHyperVSite_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVSite))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Method to get a site.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/HyperVSites/{siteName}", ApiVersion = "2020-01-01")] + public partial class GetAzMigrateHyperVSite_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _siteName; + + /// Site name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Site name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Site name.", + SerializedName = @"siteName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string SiteName { get => this._siteName; set => this._siteName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api202001.IHyperVSite + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 GetAzMigrateHyperVSite_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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.HyperVSitesGet(SubscriptionId, ResourceGroupName, SiteName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,SiteName=SiteName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api202001.IHyperVSite + /// 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.Migrate.Models.Api202001.IHyperVSite + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateHyperVSite_Get1.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateHyperVSite_Get1.cs new file mode 100644 index 000000000000..15071762a844 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateHyperVSite_Get1.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.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Method to get site health summary. + /// + /// [OpenAPI] Get=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/HyperVSites/{siteName}/healthSummary" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMigrateHyperVSite_Get1", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.ISiteHealthSummary))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Method to get site health summary.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/HyperVSites/{siteName}/healthSummary", ApiVersion = "2020-01-01")] + public partial class GetAzMigrateHyperVSite_Get1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _siteName; + + /// Site name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Site name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Site name.", + SerializedName = @"siteName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string SiteName { get => this._siteName; set => this._siteName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api202001.ISiteHealthSummaryCollection + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 GetAzMigrateHyperVSite_Get1() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'HyperVSitesGet1' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.HyperVSitesGet1(SubscriptionId, ResourceGroupName, SiteName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,SiteName=SiteName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api202001.ISiteHealthSummaryCollection + /// 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.Migrate.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.HyperVSitesGet1_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateHyperVSite_Get2.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateHyperVSite_Get2.cs new file mode 100644 index 000000000000..e68bcb24be46 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateHyperVSite_Get2.cs @@ -0,0 +1,355 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Method to get site usage. + /// + /// [OpenAPI] Get=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/HyperVSites/{siteName}/summary" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMigrateHyperVSite_Get2", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVSiteUsage))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Method to get site usage.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/HyperVSites/{siteName}/summary", ApiVersion = "2020-01-01")] + public partial class GetAzMigrateHyperVSite_Get2 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _siteName; + + /// Site name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Site name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Site name.", + SerializedName = @"siteName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string SiteName { get => this._siteName; set => this._siteName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api202001.IHyperVSiteUsage + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 GetAzMigrateHyperVSite_Get2() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'HyperVSitesGet2' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.HyperVSitesGet2(SubscriptionId, ResourceGroupName, SiteName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,SiteName=SiteName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api202001.IHyperVSiteUsage + /// 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.Migrate.Models.Api202001.IHyperVSiteUsage + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateHyperVSite_GetViaIdentity1.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateHyperVSite_GetViaIdentity1.cs new file mode 100644 index 000000000000..ba60e88dd3cf --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateHyperVSite_GetViaIdentity1.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.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Method to get site health summary. + /// + /// [OpenAPI] Get=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/HyperVSites/{siteName}/healthSummary" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMigrateHyperVSite_GetViaIdentity1", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.ISiteHealthSummary))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Method to get site health summary.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/HyperVSites/{siteName}/healthSummary", ApiVersion = "2020-01-01")] + public partial class GetAzMigrateHyperVSite_GetViaIdentity1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity 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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api202001.ISiteHealthSummaryCollection + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 GetAzMigrateHyperVSite_GetViaIdentity1() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'HyperVSitesGet1' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.HyperVSitesGet1ViaIdentity(InputObject.Id, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + 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.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.SiteName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SiteName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.HyperVSitesGet1(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.SiteName ?? null, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api202001.ISiteHealthSummaryCollection + /// 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.Migrate.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.HyperVSitesGet1_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateHyperVSite_GetViaIdentity2.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateHyperVSite_GetViaIdentity2.cs new file mode 100644 index 000000000000..6c0aaba6854a --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateHyperVSite_GetViaIdentity2.cs @@ -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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Method to get site usage. + /// + /// [OpenAPI] Get=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/HyperVSites/{siteName}/summary" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMigrateHyperVSite_GetViaIdentity2", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVSiteUsage))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Method to get site usage.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/HyperVSites/{siteName}/summary", ApiVersion = "2020-01-01")] + public partial class GetAzMigrateHyperVSite_GetViaIdentity2 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity 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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api202001.IHyperVSiteUsage + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 GetAzMigrateHyperVSite_GetViaIdentity2() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'HyperVSitesGet2' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.HyperVSitesGet2ViaIdentity(InputObject.Id, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + 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.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.SiteName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SiteName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.HyperVSitesGet2(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.SiteName ?? null, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Models.Api202001.IHyperVSiteUsage + /// 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.Migrate.Models.Api202001.IHyperVSiteUsage + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateMachine_Get.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateMachine_Get.cs index 3b998695e978..0095257ceb67 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateMachine_Get.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateMachine_Get.cs @@ -17,6 +17,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVMwareMachine))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Method to get machine.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/VMwareSites/{siteName}/machines/{machineName}", ApiVersion = "2020-01-01")] public partial class GetAzMigrateMachine_Get : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateMachine_List.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateMachine_List.cs index eacd3c3960c6..280dbe5c2c6a 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateMachine_List.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateMachine_List.cs @@ -17,6 +17,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVMwareMachine))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Method to get machine.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/VMwareSites/{siteName}/machines", ApiVersion = "2020-01-01")] public partial class GetAzMigrateMachine_List : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateOperation_List.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateOperation_List.cs index 05aebc6def80..4518c067506d 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateOperation_List.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateOperation_List.cs @@ -17,6 +17,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IOperation))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Get list of operations supported in the API.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/providers/Microsoft.OffAzure/operations", ApiVersion = "2020-01-01")] public partial class GetAzMigrateOperation_List : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateOperation_List1.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateOperation_List1.cs index 7b9c7da09d86..9a7ac752ca0e 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateOperation_List1.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateOperation_List1.cs @@ -17,6 +17,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IOperation))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Get a list of REST API supported by Microsoft.Migrate provider.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/providers/Microsoft.Migrate/operations", ApiVersion = "2018-09-01-preview")] public partial class GetAzMigrateOperation_List1 : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateOperation_List2.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateOperation_List2.cs index e8c1beae8c21..0753c7812b42 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateOperation_List2.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateOperation_List2.cs @@ -17,6 +17,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IOperationsDiscovery))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Operation to return the list of available operations.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/operations", ApiVersion = "2023-01-01")] public partial class GetAzMigrateOperation_List2 : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateOperation_List3.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateOperation_List3.cs new file mode 100644 index 000000000000..2e9e1fb30c04 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateOperation_List3.cs @@ -0,0 +1,379 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Gets the operations. + /// + /// [OpenAPI] List=>GET:"/providers/Microsoft.DataReplication/operations" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMigrateOperation_List3")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGenerated))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Gets the operations.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/providers/Microsoft.DataReplication/operations", ApiVersion = "2021-02-16-preview")] + public partial class GetAzMigrateOperation_List3 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api40.IOperationListResult + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 GetAzMigrateOperation_List3() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.OperationsList3(onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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.Migrate.Models.Api40.IOperationListResult + /// 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.Migrate.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.OperationsList3_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigratePolicyOperationStatus_Get.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigratePolicyOperationStatus_Get.cs new file mode 100644 index 000000000000..531c5584dc3e --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigratePolicyOperationStatus_Get.cs @@ -0,0 +1,434 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Tracks the results of an asynchronous operation on the policy. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}/operations/{operationId}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMigratePolicyOperationStatus_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationStatusAutoGenerated))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Tracks the results of an asynchronous operation on the policy.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}/operations/{operationId}", ApiVersion = "2021-02-16-preview")] + public partial class GetAzMigratePolicyOperationStatus_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _operationId; + + /// The ID of an ongoing async operation. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of an ongoing async operation.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of an ongoing async operation.", + SerializedName = @"operationId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string OperationId { get => this._operationId; set => this._operationId = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _policyName; + + /// The policy name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The policy name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The policy name.", + SerializedName = @"policyName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure Subscription Id in which migrate project was created. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure Subscription Id in which migrate project was created.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure Subscription Id in which migrate project was created.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private string _vaultName; + + /// The vault name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The vault name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The vault name.", + SerializedName = @"vaultName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string VaultName { get => this._vaultName; set => this._vaultName = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20210216Preview.IOperationStatusAutoGenerated + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 GetAzMigratePolicyOperationStatus_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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PolicyOperationStatusGet(SubscriptionId, ResourceGroupName, VaultName, PolicyName, OperationId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,VaultName=VaultName,PolicyName=PolicyName,OperationId=OperationId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, VaultName=VaultName, PolicyName=PolicyName, OperationId=OperationId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, VaultName=VaultName, PolicyName=PolicyName, OperationId=OperationId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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.Migrate.Models.Api20210216Preview.IOperationStatusAutoGenerated + /// 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.Migrate.Models.Api20210216Preview.IOperationStatusAutoGenerated + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigratePolicyOperationStatus_GetViaIdentity.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigratePolicyOperationStatus_GetViaIdentity.cs new file mode 100644 index 000000000000..8faa26ed3e45 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigratePolicyOperationStatus_GetViaIdentity.cs @@ -0,0 +1,393 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Tracks the results of an asynchronous operation on the policy. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}/operations/{operationId}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMigratePolicyOperationStatus_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationStatusAutoGenerated))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Tracks the results of an asynchronous operation on the policy.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}/operations/{operationId}", ApiVersion = "2021-02-16-preview")] + public partial class GetAzMigratePolicyOperationStatus_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity 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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20210216Preview.IOperationStatusAutoGenerated + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 GetAzMigratePolicyOperationStatus_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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.PolicyOperationStatusGetViaIdentity(InputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + 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.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.VaultName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.VaultName"),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) ); + } + if (null == InputObject.OperationId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.OperationId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.PolicyOperationStatusGet(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.VaultName ?? null, InputObject.PolicyName ?? null, InputObject.OperationId ?? null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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.Migrate.Models.Api20210216Preview.IOperationStatusAutoGenerated + /// 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.Migrate.Models.Api20210216Preview.IOperationStatusAutoGenerated + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigratePolicy_Get.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigratePolicy_Get.cs new file mode 100644 index 000000000000..d8a109d0c282 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigratePolicy_Get.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.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Gets the details of the policy. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMigratePolicy_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Gets the details of the policy.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}", ApiVersion = "2021-02-16-preview")] + public partial class GetAzMigratePolicy_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The policy name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The policy name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The policy name.", + SerializedName = @"policyName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("PolicyName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure Subscription Id in which migrate project was created. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure Subscription Id in which migrate project was created.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure Subscription Id in which migrate project was created.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private string _vaultName; + + /// The vault name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The vault name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The vault name.", + SerializedName = @"vaultName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string VaultName { get => this._vaultName; set => this._vaultName = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20210216Preview.IPolicyModel + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 GetAzMigratePolicy_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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PolicyGet(SubscriptionId, ResourceGroupName, VaultName, Name, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,VaultName=VaultName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, VaultName=VaultName, Name=Name }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, VaultName=VaultName, Name=Name }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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.Migrate.Models.Api20210216Preview.IPolicyModel + /// 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.Migrate.Models.Api20210216Preview.IPolicyModel + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigratePolicy_GetViaIdentity.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigratePolicy_GetViaIdentity.cs new file mode 100644 index 000000000000..9f605a494119 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigratePolicy_GetViaIdentity.cs @@ -0,0 +1,389 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Gets the details of the policy. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMigratePolicy_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Gets the details of the policy.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}", ApiVersion = "2021-02-16-preview")] + public partial class GetAzMigratePolicy_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity 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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20210216Preview.IPolicyModel + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 GetAzMigratePolicy_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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.PolicyGetViaIdentity(InputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + 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.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.VaultName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.VaultName"),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.PolicyGet(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.VaultName ?? null, InputObject.PolicyName ?? null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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.Migrate.Models.Api20210216Preview.IPolicyModel + /// 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.Migrate.Models.Api20210216Preview.IPolicyModel + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigratePolicy_List.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigratePolicy_List.cs new file mode 100644 index 000000000000..6f0cc69b5ee8 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigratePolicy_List.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.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Gets the list of policies in the given vault. + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMigratePolicy_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Gets the list of policies in the given vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies", ApiVersion = "2021-02-16-preview")] + public partial class GetAzMigratePolicy_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure Subscription Id in which migrate project was created. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure Subscription Id in which migrate project was created.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure Subscription Id in which migrate project was created.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private string _vaultName; + + /// The vault name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The vault name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The vault name.", + SerializedName = @"vaultName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string VaultName { get => this._vaultName; set => this._vaultName = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20210216Preview.IPolicyModelCollection + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 GetAzMigratePolicy_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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PolicyList(SubscriptionId, ResourceGroupName, VaultName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,VaultName=VaultName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, VaultName=VaultName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, VaultName=VaultName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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.Migrate.Models.Api20210216Preview.IPolicyModelCollection + /// 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.Migrate.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PolicyList_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateProject_Get.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateProject_Get.cs index d3ec0c7f1010..5c74b65cb016 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateProject_Get.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateProject_Get.cs @@ -16,6 +16,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IMigrateProject))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Method to get a migrate project.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/migrateProjects/{migrateProjectName}", ApiVersion = "2018-09-01-preview")] public partial class GetAzMigrateProject_Get : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateProtectedItem_Get.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateProtectedItem_Get.cs new file mode 100644 index 000000000000..fd37133fe2fa --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateProtectedItem_Get.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.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Gets the details of the protected item. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMigrateProtectedItem_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Gets the details of the protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}", ApiVersion = "2021-02-16-preview")] + public partial class GetAzMigrateProtectedItem_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The protected item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The protected item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The protected item name.", + SerializedName = @"protectedItemName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("ProtectedItemName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure Subscription Id in which migrate project was created. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure Subscription Id in which migrate project was created.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure Subscription Id in which migrate project was created.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private string _vaultName; + + /// The vault name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The vault name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The vault name.", + SerializedName = @"vaultName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string VaultName { get => this._vaultName; set => this._vaultName = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20210216Preview.IProtectedItemModel + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 GetAzMigrateProtectedItem_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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ProtectedItemGet(SubscriptionId, ResourceGroupName, VaultName, Name, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,VaultName=VaultName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, VaultName=VaultName, Name=Name }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, VaultName=VaultName, Name=Name }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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.Migrate.Models.Api20210216Preview.IProtectedItemModel + /// 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.Migrate.Models.Api20210216Preview.IProtectedItemModel + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateProtectedItem_GetViaIdentity.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateProtectedItem_GetViaIdentity.cs new file mode 100644 index 000000000000..4adeaaccdfc7 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateProtectedItem_GetViaIdentity.cs @@ -0,0 +1,389 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Gets the details of the protected item. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMigrateProtectedItem_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Gets the details of the protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}", ApiVersion = "2021-02-16-preview")] + public partial class GetAzMigrateProtectedItem_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity 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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20210216Preview.IProtectedItemModel + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 GetAzMigrateProtectedItem_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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ProtectedItemGetViaIdentity(InputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + 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.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.VaultName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.VaultName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectedItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectedItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ProtectedItemGet(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.VaultName ?? null, InputObject.ProtectedItemName ?? null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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.Migrate.Models.Api20210216Preview.IProtectedItemModel + /// 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.Migrate.Models.Api20210216Preview.IProtectedItemModel + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateProtectedItem_List.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateProtectedItem_List.cs new file mode 100644 index 000000000000..0a7d5cd0fc12 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateProtectedItem_List.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.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Gets the list of protected items in the given vault. + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMigrateProtectedItem_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Gets the list of protected items in the given vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems", ApiVersion = "2021-02-16-preview")] + public partial class GetAzMigrateProtectedItem_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure Subscription Id in which migrate project was created. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure Subscription Id in which migrate project was created.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure Subscription Id in which migrate project was created.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private string _vaultName; + + /// The vault name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The vault name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The vault name.", + SerializedName = @"vaultName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string VaultName { get => this._vaultName; set => this._vaultName = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20210216Preview.IProtectedItemModelCollection + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 GetAzMigrateProtectedItem_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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ProtectedItemList(SubscriptionId, ResourceGroupName, VaultName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,VaultName=VaultName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, VaultName=VaultName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, VaultName=VaultName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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.Migrate.Models.Api20210216Preview.IProtectedItemModelCollection + /// 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.Migrate.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ProtectedItemList_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationExtensionOperationStatus_Get.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationExtensionOperationStatus_Get.cs new file mode 100644 index 000000000000..bf5abb72059b --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationExtensionOperationStatus_Get.cs @@ -0,0 +1,434 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Tracks the results of an asynchronous operation on the replication extension. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}/operations/{operationId}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMigrateReplicationExtensionOperationStatus_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationStatusAutoGenerated))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Tracks the results of an asynchronous operation on the replication extension.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}/operations/{operationId}", ApiVersion = "2021-02-16-preview")] + public partial class GetAzMigrateReplicationExtensionOperationStatus_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _operationId; + + /// The ID of an ongoing async operation. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of an ongoing async operation.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of an ongoing async operation.", + SerializedName = @"operationId", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string OperationId { get => this._operationId; set => this._operationId = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _replicationExtensionName; + + /// The replication extension name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The replication extension name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The replication extension name.", + SerializedName = @"replicationExtensionName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string ReplicationExtensionName { get => this._replicationExtensionName; set => this._replicationExtensionName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure Subscription Id in which migrate project was created. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure Subscription Id in which migrate project was created.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure Subscription Id in which migrate project was created.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private string _vaultName; + + /// The vault name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The vault name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The vault name.", + SerializedName = @"vaultName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string VaultName { get => this._vaultName; set => this._vaultName = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20210216Preview.IOperationStatusAutoGenerated + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 GetAzMigrateReplicationExtensionOperationStatus_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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationExtensionOperationStatusGet(SubscriptionId, ResourceGroupName, VaultName, ReplicationExtensionName, OperationId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,VaultName=VaultName,ReplicationExtensionName=ReplicationExtensionName,OperationId=OperationId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, VaultName=VaultName, ReplicationExtensionName=ReplicationExtensionName, OperationId=OperationId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, VaultName=VaultName, ReplicationExtensionName=ReplicationExtensionName, OperationId=OperationId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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.Migrate.Models.Api20210216Preview.IOperationStatusAutoGenerated + /// 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.Migrate.Models.Api20210216Preview.IOperationStatusAutoGenerated + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationExtensionOperationStatus_GetViaIdentity.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationExtensionOperationStatus_GetViaIdentity.cs new file mode 100644 index 000000000000..19ddf957686b --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationExtensionOperationStatus_GetViaIdentity.cs @@ -0,0 +1,394 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Tracks the results of an asynchronous operation on the replication extension. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}/operations/{operationId}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMigrateReplicationExtensionOperationStatus_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationStatusAutoGenerated))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Tracks the results of an asynchronous operation on the replication extension.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}/operations/{operationId}", ApiVersion = "2021-02-16-preview")] + public partial class GetAzMigrateReplicationExtensionOperationStatus_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity 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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20210216Preview.IOperationStatusAutoGenerated + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 GetAzMigrateReplicationExtensionOperationStatus_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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationExtensionOperationStatusGetViaIdentity(InputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + 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.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.VaultName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.VaultName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ReplicationExtensionName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ReplicationExtensionName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.OperationId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.OperationId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationExtensionOperationStatusGet(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.VaultName ?? null, InputObject.ReplicationExtensionName ?? null, InputObject.OperationId ?? null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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.Migrate.Models.Api20210216Preview.IOperationStatusAutoGenerated + /// 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.Migrate.Models.Api20210216Preview.IOperationStatusAutoGenerated + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationExtension_Get.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationExtension_Get.cs new file mode 100644 index 000000000000..439b84b521cf --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationExtension_Get.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.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Gets the details of the replication extension. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMigrateReplicationExtension_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Gets the details of the replication extension.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}", ApiVersion = "2021-02-16-preview")] + public partial class GetAzMigrateReplicationExtension_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The replication extension name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The replication extension name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The replication extension name.", + SerializedName = @"replicationExtensionName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("ReplicationExtensionName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure Subscription Id in which migrate project was created. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure Subscription Id in which migrate project was created.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure Subscription Id in which migrate project was created.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private string _vaultName; + + /// The vault name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The vault name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The vault name.", + SerializedName = @"vaultName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string VaultName { get => this._vaultName; set => this._vaultName = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20210216Preview.IReplicationExtensionModel + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 GetAzMigrateReplicationExtension_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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationExtensionGet(SubscriptionId, ResourceGroupName, VaultName, Name, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,VaultName=VaultName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, VaultName=VaultName, Name=Name }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, VaultName=VaultName, Name=Name }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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.Migrate.Models.Api20210216Preview.IReplicationExtensionModel + /// 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.Migrate.Models.Api20210216Preview.IReplicationExtensionModel + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationExtension_GetViaIdentity.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationExtension_GetViaIdentity.cs new file mode 100644 index 000000000000..d9e3ce39a956 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationExtension_GetViaIdentity.cs @@ -0,0 +1,389 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Gets the details of the replication extension. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMigrateReplicationExtension_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Gets the details of the replication extension.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}", ApiVersion = "2021-02-16-preview")] + public partial class GetAzMigrateReplicationExtension_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity 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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20210216Preview.IReplicationExtensionModel + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 GetAzMigrateReplicationExtension_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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationExtensionGetViaIdentity(InputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + 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.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.VaultName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.VaultName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ReplicationExtensionName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ReplicationExtensionName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationExtensionGet(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.VaultName ?? null, InputObject.ReplicationExtensionName ?? null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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.Migrate.Models.Api20210216Preview.IReplicationExtensionModel + /// 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.Migrate.Models.Api20210216Preview.IReplicationExtensionModel + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationExtension_List.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationExtension_List.cs new file mode 100644 index 000000000000..f58bde1bc5dc --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationExtension_List.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.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Gets the list of replication extensions in the given vault. + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMigrateReplicationExtension_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Gets the list of replication extensions in the given vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions", ApiVersion = "2021-02-16-preview")] + public partial class GetAzMigrateReplicationExtension_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure Subscription Id in which migrate project was created. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure Subscription Id in which migrate project was created.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure Subscription Id in which migrate project was created.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private string _vaultName; + + /// The vault name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The vault name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The vault name.", + SerializedName = @"vaultName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string VaultName { get => this._vaultName; set => this._vaultName = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCollection + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 GetAzMigrateReplicationExtension_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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationExtensionList(SubscriptionId, ResourceGroupName, VaultName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,VaultName=VaultName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, VaultName=VaultName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, VaultName=VaultName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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.Migrate.Models.Api20210216Preview.IReplicationExtensionModelCollection + /// 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.Migrate.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationExtensionList_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationFabric_Get.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationFabric_Get.cs index 9537d11af1db..6942364cff56 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationFabric_Get.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationFabric_Get.cs @@ -16,6 +16,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IFabric))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Gets the details of an Azure Site Recovery fabric.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}", ApiVersion = "2023-01-01")] public partial class GetAzMigrateReplicationFabric_Get : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationFabric_List.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationFabric_List.cs index 815f3b5370fb..971ffd56a677 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationFabric_List.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationFabric_List.cs @@ -16,6 +16,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IFabric))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Gets a list of the Azure Site Recovery fabrics in the vault.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics", ApiVersion = "2023-01-01")] public partial class GetAzMigrateReplicationFabric_List : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationJob_Get.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationJob_Get.cs index e6bdd443bc87..6166a7d981cb 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationJob_Get.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationJob_Get.cs @@ -17,6 +17,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IJob))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Get the details of an Azure Site Recovery job.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}", ApiVersion = "2023-01-01")] public partial class GetAzMigrateReplicationJob_Get : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationJob_List.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationJob_List.cs index 5e2c2f63af07..3f1fc3420436 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationJob_List.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationJob_List.cs @@ -17,6 +17,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IJob))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Gets the list of Azure Site Recovery Jobs for the vault.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs", ApiVersion = "2023-01-01")] public partial class GetAzMigrateReplicationJob_List : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationMigrationItem_Get.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationMigrationItem_Get.cs index c9f4572c29dc..3949dc70f4b8 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationMigrationItem_Get.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationMigrationItem_Get.cs @@ -17,6 +17,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Gets the details of a migration item.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}", ApiVersion = "2023-01-01")] public partial class GetAzMigrateReplicationMigrationItem_Get : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationMigrationItem_List.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationMigrationItem_List.cs index 32f76167074c..6839ca8577d9 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationMigrationItem_List.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationMigrationItem_List.cs @@ -17,6 +17,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Gets the list of ASR migration items in the protection container.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems", ApiVersion = "2023-01-01")] public partial class GetAzMigrateReplicationMigrationItem_List : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationMigrationItem_List1.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationMigrationItem_List1.cs index 70f5a24401ea..a7fa47ed7219 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationMigrationItem_List1.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationMigrationItem_List1.cs @@ -17,6 +17,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Gets the list of migration items in the vault.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationMigrationItems", ApiVersion = "2023-01-01")] public partial class GetAzMigrateReplicationMigrationItem_List1 : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationPolicy_Get.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationPolicy_Get.cs index 7ecde1e28dd2..d277ea84f788 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationPolicy_Get.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationPolicy_Get.cs @@ -16,6 +16,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IPolicy))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Gets the details of a replication policy.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}", ApiVersion = "2023-01-01")] public partial class GetAzMigrateReplicationPolicy_Get : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationPolicy_List.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationPolicy_List.cs index 08035055c2d3..1b000449eca0 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationPolicy_List.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationPolicy_List.cs @@ -16,6 +16,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IPolicy))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Lists the replication policies for a vault.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies", ApiVersion = "2023-01-01")] public partial class GetAzMigrateReplicationPolicy_List : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationProtectionContainerMapping_Get.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationProtectionContainerMapping_Get.cs index b109c93ce6b3..5258be803d7b 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationProtectionContainerMapping_Get.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationProtectionContainerMapping_Get.cs @@ -16,6 +16,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IProtectionContainerMapping))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Gets the details of a protection container mapping.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}", ApiVersion = "2023-01-01")] public partial class GetAzMigrateReplicationProtectionContainerMapping_Get : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationProtectionContainerMapping_List.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationProtectionContainerMapping_List.cs index e8fae6b324b6..d0eea6299424 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationProtectionContainerMapping_List.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationProtectionContainerMapping_List.cs @@ -16,6 +16,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IProtectionContainerMapping))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Lists the protection container mappings for a protection container.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings", ApiVersion = "2023-01-01")] public partial class GetAzMigrateReplicationProtectionContainerMapping_List : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationProtectionContainerMapping_List1.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationProtectionContainerMapping_List1.cs index 6b830782c7e2..3b95e2a58d93 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationProtectionContainerMapping_List1.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationProtectionContainerMapping_List1.cs @@ -16,6 +16,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IProtectionContainerMapping))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Lists the protection container mappings in the vault.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionContainerMappings", ApiVersion = "2023-01-01")] public partial class GetAzMigrateReplicationProtectionContainerMapping_List1 : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationProtectionContainer_Get.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationProtectionContainer_Get.cs index 92c7103e402f..3d494799eaef 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationProtectionContainer_Get.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationProtectionContainer_Get.cs @@ -16,6 +16,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IProtectionContainer))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Gets the details of a protection container.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}", ApiVersion = "2023-01-01")] public partial class GetAzMigrateReplicationProtectionContainer_Get : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationProtectionContainer_List.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationProtectionContainer_List.cs index 86b6b5b7d472..4d905ef23bf4 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationProtectionContainer_List.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationProtectionContainer_List.cs @@ -16,6 +16,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IProtectionContainer))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Lists the protection containers in the specified fabric.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers", ApiVersion = "2023-01-01")] public partial class GetAzMigrateReplicationProtectionContainer_List : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationProtectionContainer_List1.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationProtectionContainer_List1.cs index 7fbc8ad30a6f..1a1018a49896 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationProtectionContainer_List1.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationProtectionContainer_List1.cs @@ -16,6 +16,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IProtectionContainer))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Lists the protection containers in a vault.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionContainers", ApiVersion = "2023-01-01")] public partial class GetAzMigrateReplicationProtectionContainer_List1 : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationRecoveryServicesProvider_Get.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationRecoveryServicesProvider_Get.cs index 89e35fdf6be7..c671890bb3d9 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationRecoveryServicesProvider_Get.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationRecoveryServicesProvider_Get.cs @@ -16,6 +16,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IRecoveryServicesProvider))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Gets the details of registered recovery services provider.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}", ApiVersion = "2023-01-01")] public partial class GetAzMigrateReplicationRecoveryServicesProvider_Get : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationRecoveryServicesProvider_List.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationRecoveryServicesProvider_List.cs index 0b81ef92b45e..67e837ab1302 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationRecoveryServicesProvider_List.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateReplicationRecoveryServicesProvider_List.cs @@ -16,6 +16,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IRecoveryServicesProvider))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Lists the registered recovery services providers in the vault.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryServicesProviders", ApiVersion = "2023-01-01")] public partial class GetAzMigrateReplicationRecoveryServicesProvider_List : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateRunAsAccount_Get.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateRunAsAccount_Get.cs index 603c0750ceb5..eccb32cb3ff8 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateRunAsAccount_Get.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateRunAsAccount_Get.cs @@ -16,6 +16,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVMwareRunAsAccount))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Method to get run as account.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/VMwareSites/{siteName}/runAsAccounts/{accountName}", ApiVersion = "2020-01-01")] public partial class GetAzMigrateRunAsAccount_Get : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateRunAsAccount_List.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateRunAsAccount_List.cs index ed8eae3781ab..73ac0bc70876 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateRunAsAccount_List.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateRunAsAccount_List.cs @@ -16,6 +16,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVMwareRunAsAccount))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Method to get run as accounts.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/VMwareSites/{siteName}/runAsAccounts", ApiVersion = "2020-01-01")] public partial class GetAzMigrateRunAsAccount_List : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateSite_Get.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateSite_Get.cs index a7896b1d800d..5b6188212b45 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateSite_Get.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateSite_Get.cs @@ -16,6 +16,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVMwareSite))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Method to get a site.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/VMwareSites/{siteName}", ApiVersion = "2020-01-01")] public partial class GetAzMigrateSite_Get : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateSolution_Get.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateSolution_Get.cs index 16c2d2798675..766061dafa64 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateSolution_Get.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateSolution_Get.cs @@ -16,6 +16,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.ISolution))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Gets a solution in the migrate project.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/migrateProjects/{migrateProjectName}/solutions/{solutionName}", ApiVersion = "2018-09-01-preview")] public partial class GetAzMigrateSolution_Get : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateVCenter_Get.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateVCenter_Get.cs index 176a751d0206..3a429f3440c0 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateVCenter_Get.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateVCenter_Get.cs @@ -17,6 +17,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVCenter))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Method to get a vCenter.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/VMwareSites/{siteName}/vCenters/{vcenterName}", ApiVersion = "2020-01-01")] public partial class GetAzMigrateVCenter_Get : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateVCenter_GetViaIdentity.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateVCenter_GetViaIdentity.cs index d052d66f2a9b..bbd3ecd064fb 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateVCenter_GetViaIdentity.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateVCenter_GetViaIdentity.cs @@ -17,6 +17,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVCenter))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Method to get a vCenter.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/VMwareSites/{siteName}/vCenters/{vcenterName}", ApiVersion = "2020-01-01")] public partial class GetAzMigrateVCenter_GetViaIdentity : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateVCenter_List.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateVCenter_List.cs index 4d7853414883..f01ce8e0bf1d 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateVCenter_List.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateVCenter_List.cs @@ -17,6 +17,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVCenter))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Method to get all vCenters in a site.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/VMwareSites/{siteName}/vCenters", ApiVersion = "2020-01-01")] public partial class GetAzMigrateVCenter_List : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateVault_Get.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateVault_Get.cs new file mode 100644 index 000000000000..cb51b27d9578 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateVault_Get.cs @@ -0,0 +1,407 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Gets the details of the vault. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMigrateVault_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModel))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Gets the details of the vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}", ApiVersion = "2021-02-16-preview")] + public partial class GetAzMigrateVault_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The vault name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The vault name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The vault name.", + SerializedName = @"vaultName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("VaultName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure Subscription Id in which migrate project was created. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure Subscription Id in which migrate project was created.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure Subscription Id in which migrate project was created.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20210216Preview.IVaultModel + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 GetAzMigrateVault_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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.VaultGet(SubscriptionId, ResourceGroupName, Name, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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.Migrate.Models.Api20210216Preview.IVaultModel + /// 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.Migrate.Models.Api20210216Preview.IVaultModel + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateVault_GetViaIdentity.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateVault_GetViaIdentity.cs new file mode 100644 index 000000000000..bd801c8b847b --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateVault_GetViaIdentity.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.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Gets the details of the vault. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMigrateVault_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModel))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Gets the details of the vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}", ApiVersion = "2021-02-16-preview")] + public partial class GetAzMigrateVault_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity 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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20210216Preview.IVaultModel + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 GetAzMigrateVault_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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.VaultGetViaIdentity(InputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + 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.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.VaultName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.VaultName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.VaultGet(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.VaultName ?? null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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.Migrate.Models.Api20210216Preview.IVaultModel + /// 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.Migrate.Models.Api20210216Preview.IVaultModel + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateVault_List.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateVault_List.cs new file mode 100644 index 000000000000..48cf19521694 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateVault_List.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.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Gets the list of vaults in the given subscription. + /// + /// [OpenAPI] ListBySubscription=>GET:"/subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/replicationVaults" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMigrateVault_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModel))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Gets the list of vaults in the given subscription.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/replicationVaults", ApiVersion = "2021-02-16-preview")] + public partial class GetAzMigrateVault_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// Backing field for property. + private string _continuationToken; + + /// Continuation token from the previous call. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Continuation token from the previous call.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Continuation token from the previous call.", + SerializedName = @"continuationToken", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Query)] + public string ContinuationToken { get => this._continuationToken; set => this._continuationToken = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure Subscription Id in which migrate project was created. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure Subscription Id in which migrate project was created.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure Subscription Id in which migrate project was created.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20210216Preview.IVaultModelCollection + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 GetAzMigrateVault_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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.VaultListBySubscription(SubscriptionId, this.InvocationInformation.BoundParameters.ContainsKey("ContinuationToken") ? ContinuationToken : null, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ContinuationToken=this.InvocationInformation.BoundParameters.ContainsKey("ContinuationToken") ? ContinuationToken : null}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ContinuationToken=this.InvocationInformation.BoundParameters.ContainsKey("ContinuationToken") ? ContinuationToken : null }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ContinuationToken=this.InvocationInformation.BoundParameters.ContainsKey("ContinuationToken") ? ContinuationToken : null }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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.Migrate.Models.Api20210216Preview.IVaultModelCollection + /// 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.Migrate.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.VaultListBySubscription_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateVault_List1.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateVault_List1.cs new file mode 100644 index 000000000000..2358c20af5bc --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateVault_List1.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.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Gets the list of vaults in the given subscription and resource group. + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMigrateVault_List1")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModel))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Gets the list of vaults in the given subscription and resource group.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults", ApiVersion = "2021-02-16-preview")] + public partial class GetAzMigrateVault_List1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// Backing field for property. + private string _continuationToken; + + /// Continuation token from the previous call. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Continuation token from the previous call.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Continuation token from the previous call.", + SerializedName = @"continuationToken", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Query)] + public string ContinuationToken { get => this._continuationToken; set => this._continuationToken = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure Subscription Id in which migrate project was created. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure Subscription Id in which migrate project was created.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure Subscription Id in which migrate project was created.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20210216Preview.IVaultModelCollection + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 GetAzMigrateVault_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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.VaultList(SubscriptionId, ResourceGroupName, this.InvocationInformation.BoundParameters.ContainsKey("ContinuationToken") ? ContinuationToken : null, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,ContinuationToken=this.InvocationInformation.BoundParameters.ContainsKey("ContinuationToken") ? ContinuationToken : null}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, ContinuationToken=this.InvocationInformation.BoundParameters.ContainsKey("ContinuationToken") ? ContinuationToken : null }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, ContinuationToken=this.InvocationInformation.BoundParameters.ContainsKey("ContinuationToken") ? ContinuationToken : null }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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.Migrate.Models.Api20210216Preview.IVaultModelCollection + /// 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.Migrate.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.VaultList_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateWorkflow_Get.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateWorkflow_Get.cs new file mode 100644 index 000000000000..27363605adf1 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateWorkflow_Get.cs @@ -0,0 +1,420 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Gets the details of the job. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/jobs/{jobName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMigrateWorkflow_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Gets the details of the job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/jobs/{jobName}", ApiVersion = "2021-02-16-preview")] + public partial class GetAzMigrateWorkflow_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.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; + + /// The job (workflow) name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The job (workflow) name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The job (workflow) name.", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure Subscription Id in which migrate project was created. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure Subscription Id in which migrate project was created.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure Subscription Id in which migrate project was created.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private string _vaultName; + + /// The vault name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The vault name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The vault name.", + SerializedName = @"vaultName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string VaultName { get => this._vaultName; set => this._vaultName = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20210216Preview.IWorkflowModel + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 GetAzMigrateWorkflow_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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.WorkflowGet(SubscriptionId, ResourceGroupName, VaultName, JobName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,VaultName=VaultName,JobName=JobName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, VaultName=VaultName, JobName=JobName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, VaultName=VaultName, JobName=JobName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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.Migrate.Models.Api20210216Preview.IWorkflowModel + /// 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.Migrate.Models.Api20210216Preview.IWorkflowModel + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateWorkflow_GetViaIdentity.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateWorkflow_GetViaIdentity.cs new file mode 100644 index 000000000000..f8e0cf3475fd --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateWorkflow_GetViaIdentity.cs @@ -0,0 +1,389 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Gets the details of the job. + /// + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/jobs/{jobName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMigrateWorkflow_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Gets the details of the job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/jobs/{jobName}", ApiVersion = "2021-02-16-preview")] + public partial class GetAzMigrateWorkflow_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity 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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20210216Preview.IWorkflowModel + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 GetAzMigrateWorkflow_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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.WorkflowGetViaIdentity(InputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + 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.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.VaultName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.VaultName"),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.WorkflowGet(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.VaultName ?? null, InputObject.JobName ?? null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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.Migrate.Models.Api20210216Preview.IWorkflowModel + /// 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.Migrate.Models.Api20210216Preview.IWorkflowModel + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateWorkflow_List.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateWorkflow_List.cs new file mode 100644 index 000000000000..c75fbe4095c1 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/GetAzMigrateWorkflow_List.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.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Gets the list of jobs in the given vault. + /// + /// [OpenAPI] List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/jobs" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzMigrateWorkflow_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Gets the list of jobs in the given vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/jobs", ApiVersion = "2021-02-16-preview")] + public partial class GetAzMigrateWorkflow_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// Backing field for property. + private string _continuationToken; + + /// Continuation token. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Continuation token.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Continuation token.", + SerializedName = @"continuationToken", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Query)] + public string ContinuationToken { get => this._continuationToken; set => this._continuationToken = value; } + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _filter; + + /// Filter string. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Filter string.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Filter string.", + SerializedName = @"$filter", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// Azure Subscription Id in which migrate project was created. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure Subscription Id in which migrate project was created.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure Subscription Id in which migrate project was created.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private string _vaultName; + + /// The vault name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The vault name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The vault name.", + SerializedName = @"vaultName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string VaultName { get => this._vaultName; set => this._vaultName = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20210216Preview.IWorkflowModelCollection + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 GetAzMigrateWorkflow_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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.WorkflowList(SubscriptionId, ResourceGroupName, VaultName, this.InvocationInformation.BoundParameters.ContainsKey("Filter") ? Filter : null, this.InvocationInformation.BoundParameters.ContainsKey("ContinuationToken") ? ContinuationToken : null, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,VaultName=VaultName,Filter=this.InvocationInformation.BoundParameters.ContainsKey("Filter") ? Filter : null,ContinuationToken=this.InvocationInformation.BoundParameters.ContainsKey("ContinuationToken") ? ContinuationToken : null}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, VaultName=VaultName, Filter=this.InvocationInformation.BoundParameters.ContainsKey("Filter") ? Filter : null, ContinuationToken=this.InvocationInformation.BoundParameters.ContainsKey("ContinuationToken") ? ContinuationToken : null }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, VaultName=VaultName, Filter=this.InvocationInformation.BoundParameters.ContainsKey("Filter") ? Filter : null, ContinuationToken=this.InvocationInformation.BoundParameters.ContainsKey("ContinuationToken") ? ContinuationToken : null }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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.Migrate.Models.Api20210216Preview.IWorkflowModelCollection + /// 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.Migrate.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.WorkflowList_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/InvokeAzMigratePlannedProtectedItemFailover_Planned.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/InvokeAzMigratePlannedProtectedItemFailover_Planned.cs new file mode 100644 index 000000000000..ee1b5421057f --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/InvokeAzMigratePlannedProtectedItemFailover_Planned.cs @@ -0,0 +1,501 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Performs the planned failover on the protected item. + /// + /// [OpenAPI] PlannedFailover=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/plannedFailover" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzMigratePlannedProtectedItemFailover_Planned", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelProperties))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Performs the planned failover on the protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/plannedFailover", ApiVersion = "2021-02-16-preview")] + public partial class InvokeAzMigratePlannedProtectedItemFailover_Planned : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModel _body; + + /// Planned failover model. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Planned failover model.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Planned failover model.", + SerializedName = @"body", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModel) })] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModel Body { get => this._body; set => this._body = 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.HttpPipeline Pipeline { get; set; } + + /// Backing field for property. + private string _protectedItemName; + + /// The protected item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The protected item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The protected item name.", + SerializedName = @"protectedItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string ProtectedItemName { get => this._protectedItemName; set => this._protectedItemName = 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// Azure Subscription Id in which migrate project was created. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure Subscription Id in which migrate project was created.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure Subscription Id in which migrate project was created.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private string _vaultName; + + /// The vault name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The vault name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The vault name.", + SerializedName = @"vaultName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string VaultName { get => this._vaultName; set => this._vaultName = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20210216Preview.IPlannedFailoverModel + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of InvokeAzMigratePlannedProtectedItemFailover_Planned + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets.InvokeAzMigratePlannedProtectedItemFailover_Planned Clone() + { + var clone = new InvokeAzMigratePlannedProtectedItemFailover_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.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.VaultName = this.VaultName; + clone.ProtectedItemName = this.ProtectedItemName; + clone.Body = this.Body; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public InvokeAzMigratePlannedProtectedItemFailover_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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.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.Migrate.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ProtectedItemPlannedFailover' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ProtectedItemPlannedFailover(SubscriptionId, ResourceGroupName, VaultName, ProtectedItemName, Body, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,VaultName=VaultName,ProtectedItemName=ProtectedItemName,body=Body}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, VaultName=VaultName, ProtectedItemName=ProtectedItemName, body=Body }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, VaultName=VaultName, ProtectedItemName=ProtectedItemName, body=Body }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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.Migrate.Models.Api20210216Preview.IPlannedFailoverModel + /// 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.Migrate.Models.Api20210216Preview.IPlannedFailoverModel + WriteObject((await response).Property); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/InvokeAzMigratePlannedProtectedItemFailover_PlannedExpanded.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/InvokeAzMigratePlannedProtectedItemFailover_PlannedExpanded.cs new file mode 100644 index 000000000000..4dc7e34c4704 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/InvokeAzMigratePlannedProtectedItemFailover_PlannedExpanded.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.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Performs the planned failover on the protected item. + /// + /// [OpenAPI] PlannedFailover=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/plannedFailover" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzMigratePlannedProtectedItemFailover_PlannedExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelProperties))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Performs the planned failover on the protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/plannedFailover", ApiVersion = "2021-02-16-preview")] + public partial class InvokeAzMigratePlannedProtectedItemFailover_PlannedExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// Planned failover model. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModel _body = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PlannedFailoverModel(); + + /// + /// 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.HttpPipeline Pipeline { get; set; } + + /// Planned failover model properties. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Planned failover model properties.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Planned failover model properties.", + SerializedName = @"properties", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelProperties) })] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelProperties Property { get => _body.Property ?? null /* object */; set => _body.Property = value; } + + /// Backing field for property. + private string _protectedItemName; + + /// The protected item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The protected item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The protected item name.", + SerializedName = @"protectedItemName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string ProtectedItemName { get => this._protectedItemName; set => this._protectedItemName = 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// Azure Subscription Id in which migrate project was created. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure Subscription Id in which migrate project was created.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure Subscription Id in which migrate project was created.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private string _vaultName; + + /// The vault name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The vault name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The vault name.", + SerializedName = @"vaultName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string VaultName { get => this._vaultName; set => this._vaultName = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20210216Preview.IPlannedFailoverModel + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of InvokeAzMigratePlannedProtectedItemFailover_PlannedExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets.InvokeAzMigratePlannedProtectedItemFailover_PlannedExpanded Clone() + { + var clone = new InvokeAzMigratePlannedProtectedItemFailover_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._body = this._body; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.VaultName = this.VaultName; + clone.ProtectedItemName = this.ProtectedItemName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public InvokeAzMigratePlannedProtectedItemFailover_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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.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.Migrate.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ProtectedItemPlannedFailover' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ProtectedItemPlannedFailover(SubscriptionId, ResourceGroupName, VaultName, ProtectedItemName, _body, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,VaultName=VaultName,ProtectedItemName=ProtectedItemName,body=_body}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, VaultName=VaultName, ProtectedItemName=ProtectedItemName, body=_body }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, VaultName=VaultName, ProtectedItemName=ProtectedItemName, body=_body }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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.Migrate.Models.Api20210216Preview.IPlannedFailoverModel + /// 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.Migrate.Models.Api20210216Preview.IPlannedFailoverModel + WriteObject((await response).Property); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/InvokeAzMigratePlannedProtectedItemFailover_PlannedViaIdentity.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/InvokeAzMigratePlannedProtectedItemFailover_PlannedViaIdentity.cs new file mode 100644 index 000000000000..57b3beacfbb3 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/InvokeAzMigratePlannedProtectedItemFailover_PlannedViaIdentity.cs @@ -0,0 +1,472 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Performs the planned failover on the protected item. + /// + /// [OpenAPI] PlannedFailover=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/plannedFailover" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzMigratePlannedProtectedItemFailover_PlannedViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelProperties))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Performs the planned failover on the protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/plannedFailover", ApiVersion = "2021-02-16-preview")] + public partial class InvokeAzMigratePlannedProtectedItemFailover_PlannedViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModel _body; + + /// Planned failover model. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Planned failover model.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Planned failover model.", + SerializedName = @"body", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModel) })] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModel Body { get => this._body; set => this._body = 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity 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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20210216Preview.IPlannedFailoverModel + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of InvokeAzMigratePlannedProtectedItemFailover_PlannedViaIdentity + /// + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets.InvokeAzMigratePlannedProtectedItemFailover_PlannedViaIdentity Clone() + { + var clone = new InvokeAzMigratePlannedProtectedItemFailover_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.Body = this.Body; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public InvokeAzMigratePlannedProtectedItemFailover_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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.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.Migrate.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ProtectedItemPlannedFailover' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ProtectedItemPlannedFailoverViaIdentity(InputObject.Id, Body, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + 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.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.VaultName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.VaultName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectedItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectedItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ProtectedItemPlannedFailover(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.VaultName ?? null, InputObject.ProtectedItemName ?? null, Body, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=Body}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=Body }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=Body }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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.Migrate.Models.Api20210216Preview.IPlannedFailoverModel + /// 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.Migrate.Models.Api20210216Preview.IPlannedFailoverModel + WriteObject((await response).Property); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/InvokeAzMigratePlannedProtectedItemFailover_PlannedViaIdentityExpanded.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/InvokeAzMigratePlannedProtectedItemFailover_PlannedViaIdentityExpanded.cs new file mode 100644 index 000000000000..ba4ab43af99e --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/InvokeAzMigratePlannedProtectedItemFailover_PlannedViaIdentityExpanded.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.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Performs the planned failover on the protected item. + /// + /// [OpenAPI] PlannedFailover=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/plannedFailover" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Invoke, @"AzMigratePlannedProtectedItemFailover_PlannedViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelProperties))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Performs the planned failover on the protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/plannedFailover", ApiVersion = "2021-02-16-preview")] + public partial class InvokeAzMigratePlannedProtectedItemFailover_PlannedViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// Planned failover model. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModel _body = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PlannedFailoverModel(); + + /// + /// 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity 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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.HttpPipeline Pipeline { get; set; } + + /// Planned failover model properties. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Planned failover model properties.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Planned failover model properties.", + SerializedName = @"properties", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelProperties) })] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelProperties Property { get => _body.Property ?? null /* object */; set => _body.Property = 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20210216Preview.IPlannedFailoverModel + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of InvokeAzMigratePlannedProtectedItemFailover_PlannedViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets.InvokeAzMigratePlannedProtectedItemFailover_PlannedViaIdentityExpanded Clone() + { + var clone = new InvokeAzMigratePlannedProtectedItemFailover_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._body = this._body; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + + } + + /// + /// Intializes a new instance of the + /// cmdlet class. + /// + public InvokeAzMigratePlannedProtectedItemFailover_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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.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.Migrate.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ProtectedItemPlannedFailover' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ProtectedItemPlannedFailoverViaIdentity(InputObject.Id, _body, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + 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.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.VaultName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.VaultName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectedItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectedItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ProtectedItemPlannedFailover(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.VaultName ?? null, InputObject.ProtectedItemName ?? null, _body, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_body}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_body }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_body }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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.Migrate.Models.Api20210216Preview.IPlannedFailoverModel + /// 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.Migrate.Models.Api20210216Preview.IPlannedFailoverModel + WriteObject((await response).Property); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/InvokeAzMigrateResyncReplicationMigrationItem_ResyncExpanded.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/InvokeAzMigrateResyncReplicationMigrationItem_ResyncExpanded.cs index eb7f6eeb3a5b..6c8671d233b1 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/InvokeAzMigrateResyncReplicationMigrationItem_ResyncExpanded.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/InvokeAzMigrateResyncReplicationMigrationItem_ResyncExpanded.cs @@ -17,6 +17,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"The operation to resynchronize replication of an ASR migration item.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/resync", ApiVersion = "2023-01-01")] public partial class InvokeAzMigrateResyncReplicationMigrationItem_ResyncExpanded : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/MoveAzMigrateReplicationMigrationItem_MigrateExpanded.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/MoveAzMigrateReplicationMigrationItem_MigrateExpanded.cs index 6552f732bfb2..483831ed09a3 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/MoveAzMigrateReplicationMigrationItem_MigrateExpanded.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/MoveAzMigrateReplicationMigrationItem_MigrateExpanded.cs @@ -17,6 +17,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"The operation to initiate migration of the item.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrate", ApiVersion = "2023-01-01")] public partial class MoveAzMigrateReplicationMigrationItem_MigrateExpanded : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigratePolicy_Create.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigratePolicy_Create.cs new file mode 100644 index 000000000000..3e19728ba176 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigratePolicy_Create.cs @@ -0,0 +1,502 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Creates the policy. + /// + /// [OpenAPI] Create=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzMigratePolicy_Create", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Creates the policy.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}", ApiVersion = "2021-02-16-preview")] + public partial class NewAzMigratePolicy_Create : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel _body; + + /// Policy model. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Policy model.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Policy model.", + SerializedName = @"body", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel) })] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel Body { get => this._body; set => this._body = 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The policy name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The policy name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The policy name.", + SerializedName = @"policyName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("PolicyName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// Azure Subscription Id in which migrate project was created. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure Subscription Id in which migrate project was created.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure Subscription Id in which migrate project was created.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private string _vaultName; + + /// The vault name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The vault name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The vault name.", + SerializedName = @"vaultName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string VaultName { get => this._vaultName; set => this._vaultName = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20210216Preview.IPolicyModel + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzMigratePolicy_Create + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets.NewAzMigratePolicy_Create Clone() + { + var clone = new NewAzMigratePolicy_Create(); + 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.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.VaultName = this.VaultName; + clone.Name = this.Name; + clone.Body = this.Body; + 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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.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.Migrate.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 NewAzMigratePolicy_Create() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PolicyCreate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PolicyCreate(SubscriptionId, ResourceGroupName, VaultName, Name, Body, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,VaultName=VaultName,Name=Name,body=Body}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, VaultName=VaultName, Name=Name, body=Body }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, VaultName=VaultName, Name=Name, body=Body }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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.Migrate.Models.Api20210216Preview.IPolicyModel + /// 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.Migrate.Models.Api20210216Preview.IPolicyModel + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigratePolicy_CreateExpanded.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigratePolicy_CreateExpanded.cs new file mode 100644 index 000000000000..d35900a53367 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigratePolicy_CreateExpanded.cs @@ -0,0 +1,503 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Creates the policy. + /// + /// [OpenAPI] Create=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzMigratePolicy_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Creates the policy.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}", ApiVersion = "2021-02-16-preview")] + public partial class NewAzMigratePolicy_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// Policy model. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel _body = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PolicyModel(); + + /// + /// 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The policy name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The policy name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The policy name.", + SerializedName = @"policyName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("PolicyName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.HttpPipeline Pipeline { get; set; } + + /// Policy model properties. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Policy model properties.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Policy model properties.", + SerializedName = @"properties", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelProperties) })] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelProperties Property { get => _body.Property ?? null /* object */; set => _body.Property = 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// Azure Subscription Id in which migrate project was created. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure Subscription Id in which migrate project was created.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure Subscription Id in which migrate project was created.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private string _vaultName; + + /// The vault name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The vault name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The vault name.", + SerializedName = @"vaultName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string VaultName { get => this._vaultName; set => this._vaultName = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20210216Preview.IPolicyModel + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzMigratePolicy_CreateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets.NewAzMigratePolicy_CreateExpanded Clone() + { + var clone = new NewAzMigratePolicy_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._body = this._body; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.VaultName = this.VaultName; + clone.Name = this.Name; + 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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.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.Migrate.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 NewAzMigratePolicy_CreateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PolicyCreate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PolicyCreate(SubscriptionId, ResourceGroupName, VaultName, Name, _body, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,VaultName=VaultName,Name=Name,body=_body}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, VaultName=VaultName, Name=Name, body=_body }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, VaultName=VaultName, Name=Name, body=_body }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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.Migrate.Models.Api20210216Preview.IPolicyModel + /// 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.Migrate.Models.Api20210216Preview.IPolicyModel + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigratePolicy_CreateViaIdentity.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigratePolicy_CreateViaIdentity.cs new file mode 100644 index 000000000000..56aac92b3bf3 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigratePolicy_CreateViaIdentity.cs @@ -0,0 +1,469 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Creates the policy. + /// + /// [OpenAPI] Create=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzMigratePolicy_CreateViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Creates the policy.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}", ApiVersion = "2021-02-16-preview")] + public partial class NewAzMigratePolicy_CreateViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel _body; + + /// Policy model. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Policy model.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Policy model.", + SerializedName = @"body", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel) })] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel Body { get => this._body; set => this._body = 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity 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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20210216Preview.IPolicyModel + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzMigratePolicy_CreateViaIdentity + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets.NewAzMigratePolicy_CreateViaIdentity Clone() + { + var clone = new NewAzMigratePolicy_CreateViaIdentity(); + 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.Body = this.Body; + 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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.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.Migrate.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 NewAzMigratePolicy_CreateViaIdentity() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PolicyCreate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.PolicyCreateViaIdentity(InputObject.Id, Body, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + 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.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.VaultName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.VaultName"),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.PolicyCreate(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.VaultName ?? null, InputObject.PolicyName ?? null, Body, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=Body}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=Body }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=Body }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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.Migrate.Models.Api20210216Preview.IPolicyModel + /// 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.Migrate.Models.Api20210216Preview.IPolicyModel + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigratePolicy_CreateViaIdentityExpanded.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigratePolicy_CreateViaIdentityExpanded.cs new file mode 100644 index 000000000000..e7e9ee418b6b --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigratePolicy_CreateViaIdentityExpanded.cs @@ -0,0 +1,470 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Creates the policy. + /// + /// [OpenAPI] Create=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzMigratePolicy_CreateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Creates the policy.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}", ApiVersion = "2021-02-16-preview")] + public partial class NewAzMigratePolicy_CreateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// Policy model. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel _body = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.PolicyModel(); + + /// + /// 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity 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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.HttpPipeline Pipeline { get; set; } + + /// Policy model properties. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Policy model properties.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Policy model properties.", + SerializedName = @"properties", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelProperties) })] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelProperties Property { get => _body.Property ?? null /* object */; set => _body.Property = 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20210216Preview.IPolicyModel + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzMigratePolicy_CreateViaIdentityExpanded + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets.NewAzMigratePolicy_CreateViaIdentityExpanded Clone() + { + var clone = new NewAzMigratePolicy_CreateViaIdentityExpanded(); + 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._body = this._body; + 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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.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.Migrate.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 NewAzMigratePolicy_CreateViaIdentityExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PolicyCreate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.PolicyCreateViaIdentity(InputObject.Id, _body, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + 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.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.VaultName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.VaultName"),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.PolicyCreate(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.VaultName ?? null, InputObject.PolicyName ?? null, _body, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_body}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_body }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_body }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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.Migrate.Models.Api20210216Preview.IPolicyModel + /// 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.Migrate.Models.Api20210216Preview.IPolicyModel + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigrateProtectedItem_Create.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigrateProtectedItem_Create.cs new file mode 100644 index 000000000000..bfa77fade7a1 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigrateProtectedItem_Create.cs @@ -0,0 +1,502 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Creates the protected item. + /// + /// [OpenAPI] Create=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzMigrateProtectedItem_Create", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Creates the protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}", ApiVersion = "2021-02-16-preview")] + public partial class NewAzMigrateProtectedItem_Create : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel _body; + + /// Protected item model. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protected item model.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protected item model.", + SerializedName = @"body", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel) })] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel Body { get => this._body; set => this._body = 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The protected item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The protected item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The protected item name.", + SerializedName = @"protectedItemName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("ProtectedItemName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// Azure Subscription Id in which migrate project was created. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure Subscription Id in which migrate project was created.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure Subscription Id in which migrate project was created.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private string _vaultName; + + /// The vault name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The vault name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The vault name.", + SerializedName = @"vaultName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string VaultName { get => this._vaultName; set => this._vaultName = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20210216Preview.IProtectedItemModel + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzMigrateProtectedItem_Create + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets.NewAzMigrateProtectedItem_Create Clone() + { + var clone = new NewAzMigrateProtectedItem_Create(); + 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.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.VaultName = this.VaultName; + clone.Name = this.Name; + clone.Body = this.Body; + 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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.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.Migrate.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 NewAzMigrateProtectedItem_Create() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ProtectedItemCreate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ProtectedItemCreate(SubscriptionId, ResourceGroupName, VaultName, Name, Body, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,VaultName=VaultName,Name=Name,body=Body}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, VaultName=VaultName, Name=Name, body=Body }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, VaultName=VaultName, Name=Name, body=Body }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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.Migrate.Models.Api20210216Preview.IProtectedItemModel + /// 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.Migrate.Models.Api20210216Preview.IProtectedItemModel + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigrateProtectedItem_CreateExpanded.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigrateProtectedItem_CreateExpanded.cs new file mode 100644 index 000000000000..b6d9a7dcfee3 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigrateProtectedItem_CreateExpanded.cs @@ -0,0 +1,503 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Creates the protected item. + /// + /// [OpenAPI] Create=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzMigrateProtectedItem_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Creates the protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}", ApiVersion = "2021-02-16-preview")] + public partial class NewAzMigrateProtectedItem_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// Protected item model. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel _body = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModel(); + + /// + /// 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The protected item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The protected item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The protected item name.", + SerializedName = @"protectedItemName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("ProtectedItemName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.HttpPipeline Pipeline { get; set; } + + /// Protected item model properties. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protected item model properties.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protected item model properties.", + SerializedName = @"properties", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelProperties) })] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelProperties Property { get => _body.Property ?? null /* object */; set => _body.Property = 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// Azure Subscription Id in which migrate project was created. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure Subscription Id in which migrate project was created.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure Subscription Id in which migrate project was created.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private string _vaultName; + + /// The vault name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The vault name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The vault name.", + SerializedName = @"vaultName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string VaultName { get => this._vaultName; set => this._vaultName = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20210216Preview.IProtectedItemModel + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzMigrateProtectedItem_CreateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets.NewAzMigrateProtectedItem_CreateExpanded Clone() + { + var clone = new NewAzMigrateProtectedItem_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._body = this._body; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.VaultName = this.VaultName; + clone.Name = this.Name; + 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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.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.Migrate.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 NewAzMigrateProtectedItem_CreateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ProtectedItemCreate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ProtectedItemCreate(SubscriptionId, ResourceGroupName, VaultName, Name, _body, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,VaultName=VaultName,Name=Name,body=_body}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, VaultName=VaultName, Name=Name, body=_body }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, VaultName=VaultName, Name=Name, body=_body }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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.Migrate.Models.Api20210216Preview.IProtectedItemModel + /// 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.Migrate.Models.Api20210216Preview.IProtectedItemModel + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigrateProtectedItem_CreateViaIdentity.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigrateProtectedItem_CreateViaIdentity.cs new file mode 100644 index 000000000000..fc0141feb610 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigrateProtectedItem_CreateViaIdentity.cs @@ -0,0 +1,469 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Creates the protected item. + /// + /// [OpenAPI] Create=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzMigrateProtectedItem_CreateViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Creates the protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}", ApiVersion = "2021-02-16-preview")] + public partial class NewAzMigrateProtectedItem_CreateViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel _body; + + /// Protected item model. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protected item model.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protected item model.", + SerializedName = @"body", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel) })] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel Body { get => this._body; set => this._body = 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity 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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20210216Preview.IProtectedItemModel + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzMigrateProtectedItem_CreateViaIdentity + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets.NewAzMigrateProtectedItem_CreateViaIdentity Clone() + { + var clone = new NewAzMigrateProtectedItem_CreateViaIdentity(); + 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.Body = this.Body; + 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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.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.Migrate.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 NewAzMigrateProtectedItem_CreateViaIdentity() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ProtectedItemCreate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ProtectedItemCreateViaIdentity(InputObject.Id, Body, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + 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.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.VaultName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.VaultName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectedItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectedItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ProtectedItemCreate(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.VaultName ?? null, InputObject.ProtectedItemName ?? null, Body, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=Body}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=Body }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=Body }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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.Migrate.Models.Api20210216Preview.IProtectedItemModel + /// 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.Migrate.Models.Api20210216Preview.IProtectedItemModel + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigrateProtectedItem_CreateViaIdentityExpanded.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigrateProtectedItem_CreateViaIdentityExpanded.cs new file mode 100644 index 000000000000..7eab8fcd2ebe --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigrateProtectedItem_CreateViaIdentityExpanded.cs @@ -0,0 +1,470 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Creates the protected item. + /// + /// [OpenAPI] Create=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzMigrateProtectedItem_CreateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Creates the protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}", ApiVersion = "2021-02-16-preview")] + public partial class NewAzMigrateProtectedItem_CreateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// Protected item model. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel _body = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModel(); + + /// + /// 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity 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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.HttpPipeline Pipeline { get; set; } + + /// Protected item model properties. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Protected item model properties.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Protected item model properties.", + SerializedName = @"properties", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelProperties) })] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelProperties Property { get => _body.Property ?? null /* object */; set => _body.Property = 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20210216Preview.IProtectedItemModel + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzMigrateProtectedItem_CreateViaIdentityExpanded + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets.NewAzMigrateProtectedItem_CreateViaIdentityExpanded Clone() + { + var clone = new NewAzMigrateProtectedItem_CreateViaIdentityExpanded(); + 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._body = this._body; + 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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.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.Migrate.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 NewAzMigrateProtectedItem_CreateViaIdentityExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ProtectedItemCreate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ProtectedItemCreateViaIdentity(InputObject.Id, _body, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + 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.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.VaultName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.VaultName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectedItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectedItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ProtectedItemCreate(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.VaultName ?? null, InputObject.ProtectedItemName ?? null, _body, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_body}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_body }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_body }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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.Migrate.Models.Api20210216Preview.IProtectedItemModel + /// 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.Migrate.Models.Api20210216Preview.IProtectedItemModel + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigrateReplicationExtension_Create.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigrateReplicationExtension_Create.cs new file mode 100644 index 000000000000..ecabca7e120f --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigrateReplicationExtension_Create.cs @@ -0,0 +1,502 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Creates the replication extension in the given vault. + /// + /// [OpenAPI] Create=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzMigrateReplicationExtension_Create", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Creates the replication extension in the given vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}", ApiVersion = "2021-02-16-preview")] + public partial class NewAzMigrateReplicationExtension_Create : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel _body; + + /// Replication extension model. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Replication extension model.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Replication extension model.", + SerializedName = @"body", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel) })] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel Body { get => this._body; set => this._body = 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The replication extension name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The replication extension name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The replication extension name.", + SerializedName = @"replicationExtensionName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("ReplicationExtensionName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// Azure Subscription Id in which migrate project was created. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure Subscription Id in which migrate project was created.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure Subscription Id in which migrate project was created.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private string _vaultName; + + /// The vault name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The vault name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The vault name.", + SerializedName = @"vaultName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string VaultName { get => this._vaultName; set => this._vaultName = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20210216Preview.IReplicationExtensionModel + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzMigrateReplicationExtension_Create + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets.NewAzMigrateReplicationExtension_Create Clone() + { + var clone = new NewAzMigrateReplicationExtension_Create(); + 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.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.VaultName = this.VaultName; + clone.Name = this.Name; + clone.Body = this.Body; + 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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.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.Migrate.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 NewAzMigrateReplicationExtension_Create() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationExtensionCreate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationExtensionCreate(SubscriptionId, ResourceGroupName, VaultName, Name, Body, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,VaultName=VaultName,Name=Name,body=Body}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, VaultName=VaultName, Name=Name, body=Body }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, VaultName=VaultName, Name=Name, body=Body }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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.Migrate.Models.Api20210216Preview.IReplicationExtensionModel + /// 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.Migrate.Models.Api20210216Preview.IReplicationExtensionModel + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigrateReplicationExtension_CreateExpanded.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigrateReplicationExtension_CreateExpanded.cs new file mode 100644 index 000000000000..22c64d172c53 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigrateReplicationExtension_CreateExpanded.cs @@ -0,0 +1,503 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Creates the replication extension in the given vault. + /// + /// [OpenAPI] Create=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzMigrateReplicationExtension_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Creates the replication extension in the given vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}", ApiVersion = "2021-02-16-preview")] + public partial class NewAzMigrateReplicationExtension_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// Replication extension model. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel _body = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ReplicationExtensionModel(); + + /// + /// 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The replication extension name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The replication extension name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The replication extension name.", + SerializedName = @"replicationExtensionName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("ReplicationExtensionName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.HttpPipeline Pipeline { get; set; } + + /// Replication extension model properties. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Replication extension model properties.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Replication extension model properties.", + SerializedName = @"properties", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelProperties) })] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelProperties Property { get => _body.Property ?? null /* object */; set => _body.Property = 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// Azure Subscription Id in which migrate project was created. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure Subscription Id in which migrate project was created.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure Subscription Id in which migrate project was created.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private string _vaultName; + + /// The vault name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The vault name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The vault name.", + SerializedName = @"vaultName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string VaultName { get => this._vaultName; set => this._vaultName = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20210216Preview.IReplicationExtensionModel + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzMigrateReplicationExtension_CreateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets.NewAzMigrateReplicationExtension_CreateExpanded Clone() + { + var clone = new NewAzMigrateReplicationExtension_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._body = this._body; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.VaultName = this.VaultName; + clone.Name = this.Name; + 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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.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.Migrate.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 NewAzMigrateReplicationExtension_CreateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationExtensionCreate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationExtensionCreate(SubscriptionId, ResourceGroupName, VaultName, Name, _body, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,VaultName=VaultName,Name=Name,body=_body}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, VaultName=VaultName, Name=Name, body=_body }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, VaultName=VaultName, Name=Name, body=_body }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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.Migrate.Models.Api20210216Preview.IReplicationExtensionModel + /// 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.Migrate.Models.Api20210216Preview.IReplicationExtensionModel + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigrateReplicationExtension_CreateViaIdentity.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigrateReplicationExtension_CreateViaIdentity.cs new file mode 100644 index 000000000000..ab05002268f3 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigrateReplicationExtension_CreateViaIdentity.cs @@ -0,0 +1,469 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Creates the replication extension in the given vault. + /// + /// [OpenAPI] Create=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzMigrateReplicationExtension_CreateViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Creates the replication extension in the given vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}", ApiVersion = "2021-02-16-preview")] + public partial class NewAzMigrateReplicationExtension_CreateViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel _body; + + /// Replication extension model. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Replication extension model.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Replication extension model.", + SerializedName = @"body", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel) })] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel Body { get => this._body; set => this._body = 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity 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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20210216Preview.IReplicationExtensionModel + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzMigrateReplicationExtension_CreateViaIdentity + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets.NewAzMigrateReplicationExtension_CreateViaIdentity Clone() + { + var clone = new NewAzMigrateReplicationExtension_CreateViaIdentity(); + 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.Body = this.Body; + 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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.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.Migrate.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 NewAzMigrateReplicationExtension_CreateViaIdentity() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationExtensionCreate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationExtensionCreateViaIdentity(InputObject.Id, Body, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + 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.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.VaultName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.VaultName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ReplicationExtensionName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ReplicationExtensionName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationExtensionCreate(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.VaultName ?? null, InputObject.ReplicationExtensionName ?? null, Body, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=Body}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=Body }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=Body }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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.Migrate.Models.Api20210216Preview.IReplicationExtensionModel + /// 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.Migrate.Models.Api20210216Preview.IReplicationExtensionModel + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigrateReplicationExtension_CreateViaIdentityExpanded.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigrateReplicationExtension_CreateViaIdentityExpanded.cs new file mode 100644 index 000000000000..98a803b79f8e --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigrateReplicationExtension_CreateViaIdentityExpanded.cs @@ -0,0 +1,472 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Creates the replication extension in the given vault. + /// + /// [OpenAPI] Create=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzMigrateReplicationExtension_CreateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Creates the replication extension in the given vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}", ApiVersion = "2021-02-16-preview")] + public partial class NewAzMigrateReplicationExtension_CreateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// Replication extension model. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel _body = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ReplicationExtensionModel(); + + /// + /// 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity 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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.HttpPipeline Pipeline { get; set; } + + /// Replication extension model properties. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Replication extension model properties.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Replication extension model properties.", + SerializedName = @"properties", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelProperties) })] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelProperties Property { get => _body.Property ?? null /* object */; set => _body.Property = 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20210216Preview.IReplicationExtensionModel + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// + /// a duplicate instance of NewAzMigrateReplicationExtension_CreateViaIdentityExpanded + /// + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets.NewAzMigrateReplicationExtension_CreateViaIdentityExpanded Clone() + { + var clone = new NewAzMigrateReplicationExtension_CreateViaIdentityExpanded(); + 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._body = this._body; + 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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.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.Migrate.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 NewAzMigrateReplicationExtension_CreateViaIdentityExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationExtensionCreate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationExtensionCreateViaIdentity(InputObject.Id, _body, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + 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.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.VaultName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.VaultName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ReplicationExtensionName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ReplicationExtensionName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationExtensionCreate(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.VaultName ?? null, InputObject.ReplicationExtensionName ?? null, _body, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_body}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_body }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=_body }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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.Migrate.Models.Api20210216Preview.IReplicationExtensionModel + /// 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.Migrate.Models.Api20210216Preview.IReplicationExtensionModel + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigrateReplicationMigrationItem_CreateExpanded.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigrateReplicationMigrationItem_CreateExpanded.cs index b8c41f19193b..97170c0568b2 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigrateReplicationMigrationItem_CreateExpanded.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigrateReplicationMigrationItem_CreateExpanded.cs @@ -17,6 +17,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"The operation to create an ASR migration item (enable migration).")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}", ApiVersion = "2023-01-01")] public partial class NewAzMigrateReplicationMigrationItem_CreateExpanded : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigrateReplicationPolicy_CreateExpanded.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigrateReplicationPolicy_CreateExpanded.cs index 57248ecf9c03..36eef7941bce 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigrateReplicationPolicy_CreateExpanded.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigrateReplicationPolicy_CreateExpanded.cs @@ -16,6 +16,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IPolicy))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"The operation to create a replication policy.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}", ApiVersion = "2023-01-01")] public partial class NewAzMigrateReplicationPolicy_CreateExpanded : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigrateReplicationProtectionContainerMapping_CreateExpanded.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigrateReplicationProtectionContainerMapping_CreateExpanded.cs index 765ae790190d..da987a608e86 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigrateReplicationProtectionContainerMapping_CreateExpanded.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/NewAzMigrateReplicationProtectionContainerMapping_CreateExpanded.cs @@ -16,6 +16,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IProtectionContainerMapping))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"The operation to create a protection container mapping.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}", ApiVersion = "2023-01-01")] public partial class NewAzMigrateReplicationProtectionContainerMapping_CreateExpanded : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/RegisterAzMigrateProjectTool_RegisterExpanded.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/RegisterAzMigrateProjectTool_RegisterExpanded.cs index 30f17ed38f44..e5a8ad787852 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/RegisterAzMigrateProjectTool_RegisterExpanded.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/RegisterAzMigrateProjectTool_RegisterExpanded.cs @@ -16,6 +16,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(bool))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Registers a tool with the migrate project.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/migrateProjects/{migrateProjectName}/registerTool", ApiVersion = "2018-09-01-preview")] public partial class RegisterAzMigrateProjectTool_RegisterExpanded : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/RemoveAzMigrateDra_Delete.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/RemoveAzMigrateDra_Delete.cs new file mode 100644 index 000000000000..a517dc98a248 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/RemoveAzMigrateDra_Delete.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.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Deletes the fabric agent. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzMigrateDra_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Deletes the fabric agent.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}", ApiVersion = "2021-02-16-preview")] + public partial class RemoveAzMigrateDra_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _fabricAgentName; + + /// The fabric agent (Dra) name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The fabric agent (Dra) name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The fabric agent (Dra) name.", + SerializedName = @"fabricAgentName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string FabricAgentName { get => this._fabricAgentName; set => this._fabricAgentName = value; } + + /// 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.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The fabric name.", + SerializedName = @"fabricName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// Azure Subscription Id in which migrate project was created. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure Subscription Id in which migrate project was created.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure Subscription Id in which migrate project was created.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzMigrateDra_Delete + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets.RemoveAzMigrateDra_Delete Clone() + { + var clone = new RemoveAzMigrateDra_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.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.FabricName = this.FabricName; + clone.FabricAgentName = this.FabricAgentName; + 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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.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.Migrate.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'DraDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.DraDelete(SubscriptionId, ResourceGroupName, FabricName, FabricAgentName, onNoContent, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,FabricName=FabricName,FabricAgentName=FabricAgentName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzMigrateDra_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, FabricName=FabricName, FabricAgentName=FabricAgentName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, FabricName=FabricName, FabricAgentName=FabricAgentName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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/src/Migrate/Migrate.Autorest/generated/cmdlets/RemoveAzMigrateDra_DeleteViaIdentity.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/RemoveAzMigrateDra_DeleteViaIdentity.cs new file mode 100644 index 000000000000..55572f5df887 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/RemoveAzMigrateDra_DeleteViaIdentity.cs @@ -0,0 +1,460 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Deletes the fabric agent. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzMigrateDra_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Deletes the fabric agent.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}", ApiVersion = "2021-02-16-preview")] + public partial class RemoveAzMigrateDra_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity 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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzMigrateDra_DeleteViaIdentity + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets.RemoveAzMigrateDra_DeleteViaIdentity Clone() + { + var clone = new RemoveAzMigrateDra_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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.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.Migrate.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'DraDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.DraDeleteViaIdentity(InputObject.Id, onNoContent, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + 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.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.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.FabricAgentName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.FabricAgentName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.DraDelete(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.FabricName ?? null, InputObject.FabricAgentName ?? null, onNoContent, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzMigrateDra_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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/src/Migrate/Migrate.Autorest/generated/cmdlets/RemoveAzMigratePolicy_Delete.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/RemoveAzMigratePolicy_Delete.cs new file mode 100644 index 000000000000..ddf3ec297f44 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/RemoveAzMigratePolicy_Delete.cs @@ -0,0 +1,493 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Removes the policy. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzMigratePolicy_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Removes the policy.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}", ApiVersion = "2021-02-16-preview")] + public partial class RemoveAzMigratePolicy_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The policy name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The policy name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The policy name.", + SerializedName = @"policyName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("PolicyName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// Azure Subscription Id in which migrate project was created. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure Subscription Id in which migrate project was created.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure Subscription Id in which migrate project was created.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private string _vaultName; + + /// The vault name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The vault name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The vault name.", + SerializedName = @"vaultName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string VaultName { get => this._vaultName; set => this._vaultName = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzMigratePolicy_Delete + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets.RemoveAzMigratePolicy_Delete Clone() + { + var clone = new RemoveAzMigratePolicy_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.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.VaultName = this.VaultName; + clone.Name = this.Name; + 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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.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.Migrate.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PolicyDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.PolicyDelete(SubscriptionId, ResourceGroupName, VaultName, Name, onNoContent, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,VaultName=VaultName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzMigratePolicy_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, VaultName=VaultName, Name=Name }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, VaultName=VaultName, Name=Name }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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/src/Migrate/Migrate.Autorest/generated/cmdlets/RemoveAzMigratePolicy_DeleteViaIdentity.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/RemoveAzMigratePolicy_DeleteViaIdentity.cs new file mode 100644 index 000000000000..9cfd43baa11b --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/RemoveAzMigratePolicy_DeleteViaIdentity.cs @@ -0,0 +1,460 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Removes the policy. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzMigratePolicy_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Removes the policy.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}", ApiVersion = "2021-02-16-preview")] + public partial class RemoveAzMigratePolicy_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity 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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzMigratePolicy_DeleteViaIdentity + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets.RemoveAzMigratePolicy_DeleteViaIdentity Clone() + { + var clone = new RemoveAzMigratePolicy_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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.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.Migrate.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'PolicyDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.PolicyDeleteViaIdentity(InputObject.Id, onNoContent, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + 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.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.VaultName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.VaultName"),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.PolicyDelete(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.VaultName ?? null, InputObject.PolicyName ?? null, onNoContent, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzMigratePolicy_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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/src/Migrate/Migrate.Autorest/generated/cmdlets/RemoveAzMigrateProject_Delete.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/RemoveAzMigrateProject_Delete.cs index ec2ef48dabda..8cd66dde7fd3 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/RemoveAzMigrateProject_Delete.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/RemoveAzMigrateProject_Delete.cs @@ -16,6 +16,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(bool))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Delete the migrate project. Deleting non-existent project is a no-operation.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/migrateProjects/{migrateProjectName}", ApiVersion = "2018-09-01-preview")] public partial class RemoveAzMigrateProject_Delete : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/RemoveAzMigrateProtectedItem_Delete.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/RemoveAzMigrateProtectedItem_Delete.cs new file mode 100644 index 000000000000..032d330b562a --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/RemoveAzMigrateProtectedItem_Delete.cs @@ -0,0 +1,508 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Removes the protected item. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzMigrateProtectedItem_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Removes the protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}", ApiVersion = "2021-02-16-preview")] + public partial class RemoveAzMigrateProtectedItem_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private global::System.Management.Automation.SwitchParameter _forceDelete; + + /// A flag indicating whether to do force delete or not. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "A flag indicating whether to do force delete or not.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A flag indicating whether to do force delete or not.", + SerializedName = @"forceDelete", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Query)] + public global::System.Management.Automation.SwitchParameter ForceDelete { get => this._forceDelete; set => this._forceDelete = 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The protected item name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The protected item name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The protected item name.", + SerializedName = @"protectedItemName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("ProtectedItemName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// Azure Subscription Id in which migrate project was created. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure Subscription Id in which migrate project was created.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure Subscription Id in which migrate project was created.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private string _vaultName; + + /// The vault name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The vault name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The vault name.", + SerializedName = @"vaultName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string VaultName { get => this._vaultName; set => this._vaultName = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzMigrateProtectedItem_Delete + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets.RemoveAzMigrateProtectedItem_Delete Clone() + { + var clone = new RemoveAzMigrateProtectedItem_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.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.VaultName = this.VaultName; + clone.Name = this.Name; + clone.ForceDelete = this.ForceDelete; + 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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.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.Migrate.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ProtectedItemDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ProtectedItemDelete(SubscriptionId, ResourceGroupName, VaultName, Name, this.InvocationInformation.BoundParameters.ContainsKey("ForceDelete") ? ForceDelete : default(global::System.Management.Automation.SwitchParameter?), onNoContent, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,VaultName=VaultName,Name=Name,ForceDelete=this.InvocationInformation.BoundParameters.ContainsKey("ForceDelete") ? ForceDelete : default(global::System.Management.Automation.SwitchParameter?)}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzMigrateProtectedItem_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, VaultName=VaultName, Name=Name, ForceDelete=this.InvocationInformation.BoundParameters.ContainsKey("ForceDelete") ? ForceDelete : default(global::System.Management.Automation.SwitchParameter?) }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, VaultName=VaultName, Name=Name, ForceDelete=this.InvocationInformation.BoundParameters.ContainsKey("ForceDelete") ? ForceDelete : default(global::System.Management.Automation.SwitchParameter?) }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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/src/Migrate/Migrate.Autorest/generated/cmdlets/RemoveAzMigrateProtectedItem_DeleteViaIdentity.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/RemoveAzMigrateProtectedItem_DeleteViaIdentity.cs new file mode 100644 index 000000000000..f3c10c2f2fab --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/RemoveAzMigrateProtectedItem_DeleteViaIdentity.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.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Removes the protected item. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzMigrateProtectedItem_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Removes the protected item.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}", ApiVersion = "2021-02-16-preview")] + public partial class RemoveAzMigrateProtectedItem_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private global::System.Management.Automation.SwitchParameter _forceDelete; + + /// A flag indicating whether to do force delete or not. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "A flag indicating whether to do force delete or not.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A flag indicating whether to do force delete or not.", + SerializedName = @"forceDelete", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Query)] + public global::System.Management.Automation.SwitchParameter ForceDelete { get => this._forceDelete; set => this._forceDelete = 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity 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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzMigrateProtectedItem_DeleteViaIdentity + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets.RemoveAzMigrateProtectedItem_DeleteViaIdentity Clone() + { + var clone = new RemoveAzMigrateProtectedItem_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.ForceDelete = this.ForceDelete; + 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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.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.Migrate.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ProtectedItemDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ProtectedItemDeleteViaIdentity(InputObject.Id, this.InvocationInformation.BoundParameters.ContainsKey("ForceDelete") ? ForceDelete : default(global::System.Management.Automation.SwitchParameter?), onNoContent, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + 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.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.VaultName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.VaultName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ProtectedItemName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ProtectedItemName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ProtectedItemDelete(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.VaultName ?? null, InputObject.ProtectedItemName ?? null, this.InvocationInformation.BoundParameters.ContainsKey("ForceDelete") ? ForceDelete : default(global::System.Management.Automation.SwitchParameter?), onNoContent, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ForceDelete=this.InvocationInformation.BoundParameters.ContainsKey("ForceDelete") ? ForceDelete : default(global::System.Management.Automation.SwitchParameter?)}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzMigrateProtectedItem_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ForceDelete=this.InvocationInformation.BoundParameters.ContainsKey("ForceDelete") ? ForceDelete : default(global::System.Management.Automation.SwitchParameter?) }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ForceDelete=this.InvocationInformation.BoundParameters.ContainsKey("ForceDelete") ? ForceDelete : default(global::System.Management.Automation.SwitchParameter?) }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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/src/Migrate/Migrate.Autorest/generated/cmdlets/RemoveAzMigrateReplicationExtension_Delete.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/RemoveAzMigrateReplicationExtension_Delete.cs new file mode 100644 index 000000000000..77a62ec1250e --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/RemoveAzMigrateReplicationExtension_Delete.cs @@ -0,0 +1,493 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Deletes the replication extension in the given vault. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzMigrateReplicationExtension_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Deletes the replication extension in the given vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}", ApiVersion = "2021-02-16-preview")] + public partial class RemoveAzMigrateReplicationExtension_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The replication extension name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The replication extension name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The replication extension name.", + SerializedName = @"replicationExtensionName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("ReplicationExtensionName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// Azure Subscription Id in which migrate project was created. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure Subscription Id in which migrate project was created.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure Subscription Id in which migrate project was created.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private string _vaultName; + + /// The vault name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The vault name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The vault name.", + SerializedName = @"vaultName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string VaultName { get => this._vaultName; set => this._vaultName = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzMigrateReplicationExtension_Delete + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets.RemoveAzMigrateReplicationExtension_Delete Clone() + { + var clone = new RemoveAzMigrateReplicationExtension_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.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.VaultName = this.VaultName; + clone.Name = this.Name; + 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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.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.Migrate.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationExtensionDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.ReplicationExtensionDelete(SubscriptionId, ResourceGroupName, VaultName, Name, onNoContent, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,VaultName=VaultName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzMigrateReplicationExtension_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, VaultName=VaultName, Name=Name }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, VaultName=VaultName, Name=Name }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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/src/Migrate/Migrate.Autorest/generated/cmdlets/RemoveAzMigrateReplicationExtension_DeleteViaIdentity.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/RemoveAzMigrateReplicationExtension_DeleteViaIdentity.cs new file mode 100644 index 000000000000..7411d20e5424 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/RemoveAzMigrateReplicationExtension_DeleteViaIdentity.cs @@ -0,0 +1,460 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Deletes the replication extension in the given vault. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzMigrateReplicationExtension_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Deletes the replication extension in the given vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}", ApiVersion = "2021-02-16-preview")] + public partial class RemoveAzMigrateReplicationExtension_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity 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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzMigrateReplicationExtension_DeleteViaIdentity + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets.RemoveAzMigrateReplicationExtension_DeleteViaIdentity Clone() + { + var clone = new RemoveAzMigrateReplicationExtension_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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.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.Migrate.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'ReplicationExtensionDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.ReplicationExtensionDeleteViaIdentity(InputObject.Id, onNoContent, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + 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.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.VaultName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.VaultName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ReplicationExtensionName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ReplicationExtensionName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.ReplicationExtensionDelete(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.VaultName ?? null, InputObject.ReplicationExtensionName ?? null, onNoContent, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzMigrateReplicationExtension_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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/src/Migrate/Migrate.Autorest/generated/cmdlets/RemoveAzMigrateReplicationMigrationItem_Delete.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/RemoveAzMigrateReplicationMigrationItem_Delete.cs index e2f9de9230a4..9262ecbf3419 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/RemoveAzMigrateReplicationMigrationItem_Delete.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/RemoveAzMigrateReplicationMigrationItem_Delete.cs @@ -17,6 +17,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(bool))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"The operation to delete an ASR migration item.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}", ApiVersion = "2023-01-01")] public partial class RemoveAzMigrateReplicationMigrationItem_Delete : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/RemoveAzMigrateVault_Delete.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/RemoveAzMigrateVault_Delete.cs new file mode 100644 index 000000000000..9f32b2429e39 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/RemoveAzMigrateVault_Delete.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.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Removes the vault. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzMigrateVault_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Removes the vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}", ApiVersion = "2021-02-16-preview")] + public partial class RemoveAzMigrateVault_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The vault name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The vault name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The vault name.", + SerializedName = @"vaultName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("VaultName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// Azure Subscription Id in which migrate project was created. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure Subscription Id in which migrate project was created.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure Subscription Id in which migrate project was created.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzMigrateVault_Delete + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets.RemoveAzMigrateVault_Delete Clone() + { + var clone = new RemoveAzMigrateVault_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.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.Name = this.Name; + 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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.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.Migrate.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'VaultDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.VaultDelete(SubscriptionId, ResourceGroupName, Name, onNoContent, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzMigrateVault_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, Name=Name }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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/src/Migrate/Migrate.Autorest/generated/cmdlets/RemoveAzMigrateVault_DeleteViaIdentity.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/RemoveAzMigrateVault_DeleteViaIdentity.cs new file mode 100644 index 000000000000..af6b73bb3dd1 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/RemoveAzMigrateVault_DeleteViaIdentity.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.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Removes the vault. + /// + /// [OpenAPI] Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzMigrateVault_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Removes the vault.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}", ApiVersion = "2021-02-16-preview")] + public partial class RemoveAzMigrateVault_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity 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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzMigrateVault_DeleteViaIdentity + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets.RemoveAzMigrateVault_DeleteViaIdentity Clone() + { + var clone = new RemoveAzMigrateVault_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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.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.Migrate.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'VaultDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.VaultDeleteViaIdentity(InputObject.Id, onNoContent, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + 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.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.VaultName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.VaultName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.VaultDelete(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.VaultName ?? null, onNoContent, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzMigrateVault_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IErrorResponse + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// 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/src/Migrate/Migrate.Autorest/generated/cmdlets/ResumeAzMigrateReplicationMigrationItemReplication_ResumeExpanded.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/ResumeAzMigrateReplicationMigrationItemReplication_ResumeExpanded.cs index 5cf83564fe95..9f7b95374867 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/ResumeAzMigrateReplicationMigrationItemReplication_ResumeExpanded.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/ResumeAzMigrateReplicationMigrationItemReplication_ResumeExpanded.cs @@ -17,6 +17,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"The operation to initiate resume replication of the item.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/resumeReplication", ApiVersion = "2023-01-01")] public partial class ResumeAzMigrateReplicationMigrationItemReplication_ResumeExpanded : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/SetAzMigrateHyperVSite_Update.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/SetAzMigrateHyperVSite_Update.cs new file mode 100644 index 000000000000..03237fc58218 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/SetAzMigrateHyperVSite_Update.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.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Method to create or update a site. + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/HyperVSites/{siteName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Set, @"AzMigrateHyperVSite_Update", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVSite))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Method to create or update a site.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/HyperVSites/{siteName}", ApiVersion = "2020-01-01")] + public partial class SetAzMigrateHyperVSite_Update : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Models.Api202001.IHyperVSite _body; + + /// Site REST Resource. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Site REST Resource.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Site REST Resource.", + SerializedName = @"body", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVSite) })] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVSite Body { get => this._body; set => this._body = 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _siteName; + + /// Site name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Site name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Site name.", + SerializedName = @"siteName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string SiteName { get => this._siteName; set => this._siteName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnCreated will be called before the regular onCreated has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api202001.IHyperVSite + /// from the remote call + /// /// Determines if the rest of the onCreated method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api202001.IHyperVSite + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'HyperVSitesCreateOrUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.HyperVSitesCreateOrUpdate(SubscriptionId, ResourceGroupName, SiteName, Body, onOk, onCreated, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,SiteName=SiteName,body=Body}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public SetAzMigrateHyperVSite_Update() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 201 (Created). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVSite + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnCreated(responseMessage, response, ref _returnNow); + // if overrideOnCreated has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onCreated - response for 201 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVSite + WriteObject((await response)); + } + } + + /// 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.Migrate.Models.Api202001.IHyperVSite + /// 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.Migrate.Models.Api202001.IHyperVSite + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/SetAzMigrateHyperVSite_UpdateExpanded.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/SetAzMigrateHyperVSite_UpdateExpanded.cs new file mode 100644 index 000000000000..3ccfd1e8f225 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/SetAzMigrateHyperVSite_UpdateExpanded.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.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Method to create or update a site. + /// + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/HyperVSites/{siteName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Set, @"AzMigrateHyperVSite_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVSite))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Method to create or update a site.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/HyperVSites/{siteName}", ApiVersion = "2020-01-01")] + public partial class SetAzMigrateHyperVSite_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// Site REST Resource. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVSite _body = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.HyperVSite(); + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Key vault ARM Id. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Key vault ARM Id.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Key vault ARM Id.", + SerializedName = @"keyVaultId", + PossibleTypes = new [] { typeof(string) })] + public string AgentDetailKeyVaultId { get => _body.AgentDetailKeyVaultId ?? null; set => _body.AgentDetailKeyVaultId = value; } + + /// Key vault URI. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Key vault URI.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Key vault URI.", + SerializedName = @"keyVaultUri", + PossibleTypes = new [] { typeof(string) })] + public string AgentDetailKeyVaultUri { get => _body.AgentDetailKeyVaultUri ?? null; set => _body.AgentDetailKeyVaultUri = value; } + + /// Appliance Name. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Appliance Name.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Appliance Name.", + SerializedName = @"applianceName", + PossibleTypes = new [] { typeof(string) })] + public string ApplianceName { get => _body.ApplianceName ?? null; set => _body.ApplianceName = 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// ARM ID of migration hub solution for SDS. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "ARM ID of migration hub solution for SDS.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"ARM ID of migration hub solution for SDS.", + SerializedName = @"discoverySolutionId", + PossibleTypes = new [] { typeof(string) })] + public string DiscoverySolutionId { get => _body.DiscoverySolutionId ?? null; set => _body.DiscoverySolutionId = value; } + + /// eTag for concurrency control. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "eTag for concurrency control.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"eTag for concurrency control.", + SerializedName = @"eTag", + PossibleTypes = new [] { typeof(string) })] + public string ETag { get => _body.ETag ?? null; set => _body.ETag = 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.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; } } + + /// Azure location in which Sites is created. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Azure location in which Sites is created.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Azure location in which Sites is created.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + public string Location { get => _body.Location ?? null; set => _body.Location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Name of the Hyper-V site. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Name of the Hyper-V site.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Name of the Hyper-V site.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + public string Name { get => _body.Name ?? null; set => _body.Name = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. The name is case insensitive. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group. The name is case insensitive.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// + /// AAD Authority URL which was used to request the token for the service principal. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "AAD Authority URL which was used to request the token for the service principal.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"AAD Authority URL which was used to request the token for the service principal.", + SerializedName = @"aadAuthority", + PossibleTypes = new [] { typeof(string) })] + public string ServicePrincipalIdentityDetailAadAuthority { get => _body.ServicePrincipalIdentityDetailAadAuthority ?? null; set => _body.ServicePrincipalIdentityDetailAadAuthority = value; } + + /// + /// 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 = "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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"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 ServicePrincipalIdentityDetailApplicationId { get => _body.ServicePrincipalIdentityDetailApplicationId ?? null; set => _body.ServicePrincipalIdentityDetailApplicationId = value; } + + /// Intended audience for the service principal. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Intended audience for the service principal.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Intended audience for the service principal.", + SerializedName = @"audience", + PossibleTypes = new [] { typeof(string) })] + public string ServicePrincipalIdentityDetailAudience { get => _body.ServicePrincipalIdentityDetailAudience ?? null; set => _body.ServicePrincipalIdentityDetailAudience = value; } + + /// + /// 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 = "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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"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 ServicePrincipalIdentityDetailObjectId { get => _body.ServicePrincipalIdentityDetailObjectId ?? null; set => _body.ServicePrincipalIdentityDetailObjectId = value; } + + /// Raw certificate data for building certificate expiry flows. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Raw certificate data for building certificate expiry flows.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Raw certificate data for building certificate expiry flows.", + SerializedName = @"rawCertData", + PossibleTypes = new [] { typeof(string) })] + public string ServicePrincipalIdentityDetailRawCertData { get => _body.ServicePrincipalIdentityDetailRawCertData ?? null; set => _body.ServicePrincipalIdentityDetailRawCertData = value; } + + /// + /// 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 = "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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"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 ServicePrincipalIdentityDetailTenantId { get => _body.ServicePrincipalIdentityDetailTenantId ?? null; set => _body.ServicePrincipalIdentityDetailTenantId = value; } + + /// Backing field for property. + private string _siteName; + + /// Site name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Site name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Site name.", + SerializedName = @"siteName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string SiteName { get => this._siteName; set => this._siteName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The ID of the target subscription. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The ID of the target subscription.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Dictionary of + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Dictionary of ")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Dictionary of ", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVSiteTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVSiteTags Tag { get => _body.Tag ?? null /* object */; set => _body.Tag = value; } + + /// + /// overrideOnCreated will be called before the regular onCreated has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api202001.IHyperVSite + /// from the remote call + /// /// Determines if the rest of the onCreated method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api202001.IHyperVSite + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'HyperVSitesCreateOrUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.HyperVSitesCreateOrUpdate(SubscriptionId, ResourceGroupName, SiteName, _body, onOk, onCreated, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,SiteName=SiteName,body=_body}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public SetAzMigrateHyperVSite_UpdateExpanded() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 201 (Created). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVSite + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnCreated(responseMessage, response, ref _returnNow); + // if overrideOnCreated has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onCreated - response for 201 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVSite + WriteObject((await response)); + } + } + + /// 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.Migrate.Models.Api202001.IHyperVSite + /// 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.Migrate.Models.Api202001.IHyperVSite + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/SetAzMigrateProject_PutExpanded.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/SetAzMigrateProject_PutExpanded.cs index 35136879a12e..6008b809133d 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/SetAzMigrateProject_PutExpanded.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/SetAzMigrateProject_PutExpanded.cs @@ -17,6 +17,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IMigrateProject))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Method to create or update a migrate project.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/migrateProjects/{migrateProjectName}", ApiVersion = "2018-09-01-preview")] public partial class SetAzMigrateProject_PutExpanded : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/SetAzMigrateSite_Update.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/SetAzMigrateSite_Update.cs index e149d3c9c228..8c364e487cad 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/SetAzMigrateSite_Update.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/SetAzMigrateSite_Update.cs @@ -17,6 +17,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVMwareSite))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Method to create or update a site.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/VMwareSites/{siteName}", ApiVersion = "2020-01-01")] public partial class SetAzMigrateSite_Update : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/SetAzMigrateSite_UpdateExpanded.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/SetAzMigrateSite_UpdateExpanded.cs index 9b90f60acc77..8fb0fb7058f0 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/SetAzMigrateSite_UpdateExpanded.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/SetAzMigrateSite_UpdateExpanded.cs @@ -17,6 +17,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVMwareSite))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Method to create or update a site.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OffAzure/VMwareSites/{siteName}", ApiVersion = "2020-01-01")] public partial class SetAzMigrateSite_UpdateExpanded : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/SetAzMigrateSolution_Put.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/SetAzMigrateSolution_Put.cs new file mode 100644 index 000000000000..ef45a9df5532 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/SetAzMigrateSolution_Put.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.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Creates a solution in the migrate project. + /// + /// [OpenAPI] PutSolution=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/migrateProjects/{migrateProjectName}/solutions/{solutionName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Set, @"AzMigrateSolution_Put", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.ISolution))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Creates a solution in the migrate project.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/migrateProjects/{migrateProjectName}/solutions/{solutionName}", ApiVersion = "2018-09-01-preview")] + public partial class SetAzMigrateSolution_Put : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _migrateProjectName; + + /// Name of the Azure Migrate project. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the Azure Migrate project.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the Azure Migrate project.", + SerializedName = @"migrateProjectName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string MigrateProjectName { get => this._migrateProjectName; set => this._migrateProjectName = value; } + + /// Backing field for property. + private string _name; + + /// Unique name of a migration solution within a migrate project. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Unique name of a migration solution within a migrate project.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Unique name of a migration solution within a migrate project.", + SerializedName = @"solutionName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("SolutionName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// Name of the Azure Resource Group that migrate project is part of. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the Azure Resource Group that migrate project is part of.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the Azure Resource Group that migrate project is part of.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.ISolution _solutionInput; + + /// Solution REST Resource. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Solution REST Resource.", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Solution REST Resource.", + SerializedName = @"solutionInput", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.ISolution) })] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.ISolution SolutionInput { get => this._solutionInput; set => this._solutionInput = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// Azure Subscription Id in which migrate project was created. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure Subscription Id in which migrate project was created.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure Subscription Id in which migrate project was created.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnCreated will be called before the regular onCreated has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api20180901Preview.ISolution + /// from the remote call + /// /// Determines if the rest of the onCreated method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20180901Preview.ISolution + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'SolutionsPutSolution' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.SolutionsPutSolution(SubscriptionId, ResourceGroupName, MigrateProjectName, Name, SolutionInput, onOk, onCreated, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,MigrateProjectName=MigrateProjectName,Name=Name,body=SolutionInput}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public SetAzMigrateSolution_Put() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 201 (Created). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.ISolution + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnCreated(responseMessage, response, ref _returnNow); + // if overrideOnCreated has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onCreated - response for 201 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.ISolution + WriteObject((await response)); + } + } + + /// 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.Migrate.Models.Api20180901Preview.ISolution + /// 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.Migrate.Models.Api20180901Preview.ISolution + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/SetAzMigrateSolution_PutExpanded.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/SetAzMigrateSolution_PutExpanded.cs new file mode 100644 index 000000000000..0ba91f25d5bd --- /dev/null +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/SetAzMigrateSolution_PutExpanded.cs @@ -0,0 +1,506 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions; + using System; + + /// Creates a solution in the migrate project. + /// + /// [OpenAPI] PutSolution=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/migrateProjects/{migrateProjectName}/solutions/{solutionName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Set, @"AzMigrateSolution_PutExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.ISolution))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"Creates a solution in the migrate project.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/migrateProjects/{migrateProjectName}/solutions/{solutionName}", ApiVersion = "2018-09-01-preview")] + public partial class SetAzMigrateSolution_PutExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Solution REST Resource. + private Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.ISolution _solutionInputBody = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.Solution(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Gets or sets the cleanup state of the solution. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the cleanup state of the solution.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the cleanup state of the solution.", + SerializedName = @"cleanupState", + PossibleTypes = new [] { typeof(string) })] + public string CleanupState { get => _solutionInputBody.CleanupState ?? null; set => _solutionInputBody.CleanupState = value; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Migrate Client => Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.ClientAPI; + + /// + /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet + /// against a different subscription + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Gets or sets the count of assessments reported by the solution. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the count of assessments reported by the solution.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the count of assessments reported by the solution.", + SerializedName = @"assessmentCount", + PossibleTypes = new [] { typeof(int) })] + public int DetailAssessmentCount { get => _solutionInputBody.DetailAssessmentCount ?? default(int); set => _solutionInputBody.DetailAssessmentCount = value; } + + /// Gets or sets the extended details reported by the solution. + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the extended details reported by the solution.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the extended details reported by the solution.", + SerializedName = @"extendedDetails", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.ISolutionDetailsExtendedDetails) })] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.ISolutionDetailsExtendedDetails DetailExtendedDetail { get => _solutionInputBody.DetailExtendedDetail ?? null /* object */; set => _solutionInputBody.DetailExtendedDetail = value; } + + /// Gets or sets the count of groups reported by the solution. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the count of groups reported by the solution.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the count of groups reported by the solution.", + SerializedName = @"groupCount", + PossibleTypes = new [] { typeof(int) })] + public int DetailGroupCount { get => _solutionInputBody.DetailGroupCount ?? default(int); set => _solutionInputBody.DetailGroupCount = value; } + + /// Gets or sets the ETAG for optimistic concurrency control. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the ETAG for optimistic concurrency control.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the ETAG for optimistic concurrency control.", + SerializedName = @"etag", + PossibleTypes = new [] { typeof(string) })] + public string Etag { get => _solutionInputBody.Etag ?? null; set => _solutionInputBody.Etag = value; } + + /// Gets or sets the goal of the solution. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the goal of the solution.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the goal of the solution.", + SerializedName = @"goal", + PossibleTypes = new [] { typeof(string) })] + public string Goal { get => _solutionInputBody.Goal ?? null; set => _solutionInputBody.Goal = 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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _migrateProjectName; + + /// Name of the Azure Migrate project. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the Azure Migrate project.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the Azure Migrate project.", + SerializedName = @"migrateProjectName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string MigrateProjectName { get => this._migrateProjectName; set => this._migrateProjectName = value; } + + /// Backing field for property. + private string _name; + + /// Unique name of a migration solution within a migrate project. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Unique name of a migration solution within a migrate project.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Unique name of a migration solution within a migrate project.", + SerializedName = @"solutionName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("SolutionName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.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.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Gets or sets the purpose of the solution. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the purpose of the solution.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the purpose of the solution.", + SerializedName = @"purpose", + PossibleTypes = new [] { typeof(string) })] + public string Purpose { get => _solutionInputBody.Purpose ?? null; set => _solutionInputBody.Purpose = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// Name of the Azure Resource Group that migrate project is part of. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Name of the Azure Resource Group that migrate project is part of.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the Azure Resource Group that migrate project is part of.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Gets or sets the current status of the solution. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the current status of the solution.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the current status of the solution.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(string) })] + public string Status { get => _solutionInputBody.Status ?? null; set => _solutionInputBody.Status = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// Azure Subscription Id in which migrate project was created. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Azure Subscription Id in which migrate project was created.")] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure Subscription Id in which migrate project was created.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Gets or sets the tool being used in the solution. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the tool being used in the solution.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the tool being used in the solution.", + SerializedName = @"tool", + PossibleTypes = new [] { typeof(string) })] + public string Tool { get => _solutionInputBody.Tool ?? null; set => _solutionInputBody.Tool = value; } + + /// + /// overrideOnCreated will be called before the regular onCreated has been processed, allowing customization of what + /// happens on 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.Migrate.Models.Api20180901Preview.ISolution + /// from the remote call + /// /// Determines if the rest of the onCreated method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// 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.Migrate.Models.Api20180901Preview.ISolution + /// 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.Migrate.Module.Instance.GetTelemetryId.Invoke(); + if (telemetryId != "" && telemetryId != "internal") + { + __correlationId = telemetryId; + } + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data.Message, new string[]{}); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.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.Migrate.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'SolutionsPutSolution' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Migrate.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.SolutionsPutSolution(SubscriptionId, ResourceGroupName, MigrateProjectName, Name, _solutionInputBody, onOk, onCreated, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,MigrateProjectName=MigrateProjectName,Name=Name,body=_solutionInputBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public SetAzMigrateSolution_PutExpanded() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 201 (Created). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.ISolution + /// from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnCreated(responseMessage, response, ref _returnNow); + // if overrideOnCreated has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onCreated - response for 201 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.ISolution + WriteObject((await response)); + } + } + + /// 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.Migrate.Models.Api20180901Preview.ISolution + /// 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.Migrate.Models.Api20180901Preview.ISolution + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/SuspendAzMigrateReplicationMigrationItemReplication_PauseExpanded.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/SuspendAzMigrateReplicationMigrationItemReplication_PauseExpanded.cs index bb9e56c1afd5..8a46ced53acd 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/SuspendAzMigrateReplicationMigrationItemReplication_PauseExpanded.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/SuspendAzMigrateReplicationMigrationItemReplication_PauseExpanded.cs @@ -17,6 +17,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"The operation to initiate pause replication of the item.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/pauseReplication", ApiVersion = "2023-01-01")] public partial class SuspendAzMigrateReplicationMigrationItemReplication_PauseExpanded : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/TestAzMigrateReplicationMigrationItemMigrateCleanup_TestExpanded.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/TestAzMigrateReplicationMigrationItemMigrateCleanup_TestExpanded.cs index ed709c9a9e2c..9b22a595fbab 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/TestAzMigrateReplicationMigrationItemMigrateCleanup_TestExpanded.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/TestAzMigrateReplicationMigrationItemMigrateCleanup_TestExpanded.cs @@ -17,6 +17,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"The operation to initiate test migrate cleanup.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/testMigrateCleanup", ApiVersion = "2023-01-01")] public partial class TestAzMigrateReplicationMigrationItemMigrateCleanup_TestExpanded : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/TestAzMigrateReplicationMigrationItemMigrate_TestExpanded.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/TestAzMigrateReplicationMigrationItemMigrate_TestExpanded.cs index 268d9e086f6b..3bfbd261a4a4 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/TestAzMigrateReplicationMigrationItemMigrate_TestExpanded.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/TestAzMigrateReplicationMigrationItemMigrate_TestExpanded.cs @@ -17,6 +17,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"The operation to initiate test migration of the item.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/testMigrate", ApiVersion = "2023-01-01")] public partial class TestAzMigrateReplicationMigrationItemMigrate_TestExpanded : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/cmdlets/UpdateAzMigrateReplicationMigrationItem_UpdateExpanded.cs b/src/Migrate/Migrate.Autorest/generated/cmdlets/UpdateAzMigrateReplicationMigrationItem_UpdateExpanded.cs index d4b3d5467864..e1c0699fcff0 100644 --- a/src/Migrate/Migrate.Autorest/generated/cmdlets/UpdateAzMigrateReplicationMigrationItem_UpdateExpanded.cs +++ b/src/Migrate/Migrate.Autorest/generated/cmdlets/UpdateAzMigrateReplicationMigrationItem_UpdateExpanded.cs @@ -17,6 +17,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Cmdlets [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem))] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Description(@"The operation to update the recovery settings of an ASR migration item.")] [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.Generated] + [global::Microsoft.Azure.PowerShell.Cmdlets.Migrate.HttpPath(Path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}", ApiVersion = "2023-01-01")] public partial class UpdateAzMigrateReplicationMigrationItem_UpdateExpanded : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.IEventListener { diff --git a/src/Migrate/Migrate.Autorest/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs b/src/Migrate/Migrate.Autorest/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs index 8076186a5799..c97cd1159cdb 100644 --- a/src/Migrate/Migrate.Autorest/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs +++ b/src/Migrate/Migrate.Autorest/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs @@ -33,6 +33,9 @@ public class ExportHelpMarkdown : PSCmdlet [ValidateNotNullOrEmpty] public string ExamplesFolder { get; set; } + [Parameter()] + public SwitchParameter AddComplexInterfaceInfo { get; set; } + protected override void ProcessRecord() { try @@ -41,7 +44,7 @@ protected override void ProcessRecord() 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); + WriteMarkdowns(variantGroups, ModuleInfo.ToModuleInfo(), DocsFolder, ExamplesFolder, AddComplexInterfaceInfo.IsPresent); } catch (Exception ee) { diff --git a/src/Migrate/Migrate.Autorest/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs b/src/Migrate/Migrate.Autorest/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs index 423fbbea7605..b8bf9c3e96d7 100644 --- a/src/Migrate/Migrate.Autorest/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs +++ b/src/Migrate/Migrate.Autorest/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs @@ -52,6 +52,9 @@ public class ExportProxyCmdlet : PSCmdlet [Parameter(Mandatory = true, ParameterSetName = "NoDocs")] public SwitchParameter ExcludeDocs { get; set; } + [Parameter(ParameterSetName = "Docs")] + public SwitchParameter AddComplexInterfaceInfo { get; set; } + protected override void ProcessRecord() { try @@ -163,7 +166,7 @@ protected override void ProcessRecord() 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); + WriteMarkdowns(variantGroupsByProfile, moduleInfo, docsFolder, examplesFolder, AddComplexInterfaceInfo.IsPresent); } } } diff --git a/src/Migrate/Migrate.Autorest/generated/runtime/BuildTime/MarkdownRenderer.cs b/src/Migrate/Migrate.Autorest/generated/runtime/BuildTime/MarkdownRenderer.cs index 419abfe6232d..c13a3b227893 100644 --- a/src/Migrate/Migrate.Autorest/generated/runtime/BuildTime/MarkdownRenderer.cs +++ b/src/Migrate/Migrate.Autorest/generated/runtime/BuildTime/MarkdownRenderer.cs @@ -14,7 +14,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell { internal static class MarkdownRenderer { - public static void WriteMarkdowns(IEnumerable variantGroups, PsModuleHelpInfo moduleHelpInfo, string docsFolder, string examplesFolder) + public static void WriteMarkdowns(IEnumerable variantGroups, PsModuleHelpInfo moduleHelpInfo, string docsFolder, string examplesFolder, bool AddComplexInterfaceInfo = true) { Directory.CreateDirectory(docsFolder); var markdownInfos = variantGroups.Where(vg => !vg.IsInternal).Select(vg => new MarkdownHelpInfo(vg, examplesFolder)).OrderBy(mhi => mhi.CmdletName).ToArray(); @@ -69,18 +69,26 @@ public static void WriteMarkdowns(IEnumerable variantGroups, PsMod } sb.Append($"## NOTES{Environment.NewLine}{Environment.NewLine}"); - sb.Append($"ALIASES{Environment.NewLine}{Environment.NewLine}"); - foreach (var alias in markdownInfo.Aliases) + if (markdownInfo.Aliases.Any()) { - sb.Append($"{alias}{Environment.NewLine}{Environment.NewLine}"); + sb.Append($"ALIASES{Environment.NewLine}{Environment.NewLine}"); } - if (markdownInfo.ComplexInterfaceInfos.Any()) + foreach (var alias in markdownInfo.Aliases) { - sb.Append($"{ComplexParameterHeader}{Environment.NewLine}"); + sb.Append($"{alias}{Environment.NewLine}{Environment.NewLine}"); } - foreach (var complexInterfaceInfo in markdownInfo.ComplexInterfaceInfos) + + if (AddComplexInterfaceInfo) { - sb.Append($"{complexInterfaceInfo.ToNoteOutput(includeDashes: true, includeBackticks: true)}{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}"); diff --git a/src/Migrate/Migrate.Autorest/generated/runtime/BuildTime/Models/PsProxyOutputs.cs b/src/Migrate/Migrate.Autorest/generated/runtime/BuildTime/Models/PsProxyOutputs.cs index 2f9a70ef6ab4..a24d2e452a78 100644 --- a/src/Migrate/Migrate.Autorest/generated/runtime/BuildTime/Models/PsProxyOutputs.cs +++ b/src/Migrate/Migrate.Autorest/generated/runtime/BuildTime/Models/PsProxyOutputs.cs @@ -191,8 +191,15 @@ 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.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)"; + return VariantGroup.IsInternal ? "" : IsAzure ? $@"{Indent}{Indent}$cmdInfo = Get-Command -Name $mapping[$parameterSet] +{Indent}{Indent}[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) +{Indent}{Indent}if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){{ +{Indent}{Indent}{Indent}[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) +{Indent}{Indent}{Indent}[Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) +{Indent}{Indent}}}" : $@"{Indent}{Indent}$cmdInfo = Get-Command -Name $mapping[$parameterSet]{Environment.NewLine}{Indent}{Indent}[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) +{Indent}{Indent}[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)"; } + private string GetTelemetry() { if (!VariantGroup.IsInternal && IsAzure) diff --git a/src/Migrate/Migrate.Autorest/generated/runtime/BuildTime/PsAttributes.cs b/src/Migrate/Migrate.Autorest/generated/runtime/BuildTime/PsAttributes.cs index fce9e04798cd..974ca97e7616 100644 --- a/src/Migrate/Migrate.Autorest/generated/runtime/BuildTime/PsAttributes.cs +++ b/src/Migrate/Migrate.Autorest/generated/runtime/BuildTime/PsAttributes.cs @@ -48,6 +48,13 @@ public ProfileAttribute(params string[] profiles) } } + [AttributeUsage(AttributeTargets.Class)] + public class HttpPathAttribute : Attribute + { + public string Path { get; set; } + public string ApiVersion { get; set; } + } + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] public class CategoryAttribute : Attribute { diff --git a/src/Migrate/Migrate.Autorest/generated/runtime/MessageAttribute.cs b/src/Migrate/Migrate.Autorest/generated/runtime/MessageAttribute.cs index f521259f107e..88d7a297fd0c 100644 --- a/src/Migrate/Migrate.Autorest/generated/runtime/MessageAttribute.cs +++ b/src/Migrate/Migrate.Autorest/generated/runtime/MessageAttribute.cs @@ -21,7 +21,7 @@ public class GenericBreakingChangeAttribute : Attribute //The version the change is effective from, non mandatory public string DeprecateByVersion { get; } - public bool DeprecateByVersionSet { get; } = false; + public string DeprecateByAzVersion { get; } //The date on which the change comes in effect public DateTime ChangeInEfectByDate { get; } @@ -32,23 +32,18 @@ public class GenericBreakingChangeAttribute : Attribute //New way fo calling the cmdlet public string NewWay { get; set; } - public GenericBreakingChangeAttribute(string message) - { - _message = message; - } - - public GenericBreakingChangeAttribute(string message, string deprecateByVersion) + public GenericBreakingChangeAttribute(string message, string deprecateByAzVersion, string deprecateByVersion) { _message = message; + this.DeprecateByAzVersion = deprecateByAzVersion; this.DeprecateByVersion = deprecateByVersion; - this.DeprecateByVersionSet = true; } - public GenericBreakingChangeAttribute(string message, string deprecateByVersion, string changeInEfectByDate) + public GenericBreakingChangeAttribute(string message, string deprecateByAzVersion, string deprecateByVersion, string changeInEfectByDate) { _message = message; this.DeprecateByVersion = deprecateByVersion; - this.DeprecateByVersionSet = true; + this.DeprecateByAzVersion = deprecateByAzVersion; if (DateTime.TryParse(changeInEfectByDate, new CultureInfo("en-US"), DateTimeStyles.None, out DateTime result)) { @@ -86,10 +81,8 @@ public void PrintCustomAttributeInfo(Action writeOutput) writeOutput(string.Format(Resources.BreakingChangesAttributesInEffectByDateMessage, this.ChangeInEfectByDate.ToString("d"))); } - if (DeprecateByVersionSet) - { - writeOutput(string.Format(Resources.BreakingChangesAttributesInEffectByVersion, this.DeprecateByVersion)); - } + writeOutput(string.Format(Resources.BreakingChangesAttributesInEffectByAzVersion, this.DeprecateByAzVersion)); + writeOutput(string.Format(Resources.BreakingChangesAttributesInEffectByVersion, this.DeprecateByVersion)); if (OldWay != null && NewWay != null) { @@ -114,18 +107,13 @@ public class CmdletBreakingChangeAttribute : GenericBreakingChangeAttribute public string ReplacementCmdletName { get; set; } - public CmdletBreakingChangeAttribute() : - base(string.Empty) + public CmdletBreakingChangeAttribute(string deprecateByAzVersion, string deprecateByVersion) : + base(string.Empty, deprecateByAzVersion, deprecateByVersion) { } - public CmdletBreakingChangeAttribute(string deprecateByVersione) : - base(string.Empty, deprecateByVersione) - { - } - - public CmdletBreakingChangeAttribute(string deprecateByVersion, string changeInEfectByDate) : - base(string.Empty, deprecateByVersion, changeInEfectByDate) + public CmdletBreakingChangeAttribute(string deprecateByAzVersion, string deprecateByVersion, string changeInEfectByDate) : + base(string.Empty, deprecateByAzVersion, deprecateByVersion, changeInEfectByDate) { } @@ -146,20 +134,15 @@ protected override string GetAttributeSpecificMessage() 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) + public ParameterSetBreakingChangeAttribute(string[] changedParameterSet, string deprecateByAzVersion, string deprecateByVersion) : + base(string.Empty, deprecateByAzVersion, deprecateByVersion) { ChangedParameterSet = changedParameterSet; } - public ParameterSetBreakingChangeAttribute(string[] changedParameterSet, string deprecateByVersion, string changeInEfectByDate) : - base(string.Empty, deprecateByVersion, changeInEfectByDate) + public ParameterSetBreakingChangeAttribute(string[] changedParameterSet, string deprecateByAzVersion, string deprecateByVersion, string changeInEfectByDate) : + base(string.Empty, deprecateByAzVersion, deprecateByVersion, changeInEfectByDate) { ChangedParameterSet = changedParameterSet; } @@ -185,6 +168,11 @@ public class PreviewMessageAttribute : Attribute { public string _message; + public DateTime EstimatedGaDate { get; } + + public bool IsEstimatedGaDateSet { get; } = false; + + public PreviewMessageAttribute() { this._message = Resources.PreviewCmdletMessage; @@ -192,12 +180,26 @@ public PreviewMessageAttribute() public PreviewMessageAttribute(string message) { - this._message = message; + this._message = string.IsNullOrEmpty(message) ? Resources.PreviewCmdletMessage : message; } - public void PrintCustomAttributeInfo(System.Management.Automation.PSCmdlet psCmdlet) + public PreviewMessageAttribute(string message, string estimatedDateOfGa) : this(message) { - psCmdlet.WriteWarning(this._message); + if (DateTime.TryParse(estimatedDateOfGa, new CultureInfo("en-US"), DateTimeStyles.None, out DateTime result)) + { + this.EstimatedGaDate = result; + this.IsEstimatedGaDateSet = true; + } + } + + public void PrintCustomAttributeInfo(Action writeOutput) + { + writeOutput(this._message); + + if (IsEstimatedGaDateSet) + { + writeOutput(string.Format(Resources.PreviewCmdletETAMessage, this.EstimatedGaDate.ToShortDateString())); + } } public virtual bool IsApplicableToInvocation(InvocationInfo invocation) @@ -219,20 +221,14 @@ public class ParameterBreakingChangeAttribute : GenericBreakingChangeAttribute public String NewParameterType { get; set; } - public ParameterBreakingChangeAttribute(string nameOfParameterChanging) : - base(string.Empty) + public ParameterBreakingChangeAttribute(string nameOfParameterChanging, string deprecateByAzVersion, string deprecateByVersion) : + base(string.Empty, deprecateByAzVersion, deprecateByVersion) { 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) + public ParameterBreakingChangeAttribute(string nameOfParameterChanging, string deprecateByAzVersion, string deprecateByVersion, string changeInEfectByDate) : + base(string.Empty, deprecateByAzVersion, deprecateByVersion, changeInEfectByDate) { this.NameOfParameterChanging = nameOfParameterChanging; } @@ -298,20 +294,14 @@ public class OutputBreakingChangeAttribute : GenericBreakingChangeAttribute 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) + public OutputBreakingChangeAttribute(string deprecatedCmdletOutputType, string deprecateByAzVersion, string deprecateByVersion) : + base(string.Empty, deprecateByAzVersion, deprecateByVersion) { this.DeprecatedCmdLetOutputType = deprecatedCmdletOutputType; } - public OutputBreakingChangeAttribute(string deprecatedCmdletOutputType, string deprecateByVersion, string changeInEfectByDate) : - base(string.Empty, deprecateByVersion, changeInEfectByDate) + public OutputBreakingChangeAttribute(string deprecatedCmdletOutputType, string deprecateByAzVersion, string deprecateByVersion, string changeInEfectByDate) : + base(string.Empty, deprecateByAzVersion, deprecateByVersion, changeInEfectByDate) { this.DeprecatedCmdLetOutputType = deprecatedCmdletOutputType; } diff --git a/src/Migrate/Migrate.Autorest/generated/runtime/MessageAttributeHelper.cs b/src/Migrate/Migrate.Autorest/generated/runtime/MessageAttributeHelper.cs index d81a0e58ebc2..33427e72b6df 100644 --- a/src/Migrate/Migrate.Autorest/generated/runtime/MessageAttributeHelper.cs +++ b/src/Migrate/Migrate.Autorest/generated/runtime/MessageAttributeHelper.cs @@ -35,7 +35,7 @@ public class MessageAttributeHelper * 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) + public static void ProcessCustomAttributesAtRuntime(CommandInfo commandInfo, InvocationInfo invocationInfo, String parameterSet, System.Management.Automation.PSCmdlet psCmdlet, bool showPreviewMessage = true) { bool supressWarningOrError = false; @@ -57,36 +57,49 @@ public static void ProcessCustomAttributesAtRuntime(CommandInfo commandInfo, Inv { psCmdlet.WriteWarning("The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription."); } + + ProcessBreakingChangeAttributesAtRuntime(commandInfo, invocationInfo, parameterSet, psCmdlet); + + } + + private static void ProcessBreakingChangeAttributesAtRuntime(CommandInfo commandInfo, InvocationInfo invocationInfo, String parameterSet, System.Management.Automation.PSCmdlet psCmdlet) + { List attributes = new List(GetAllBreakingChangeAttributesInType(commandInfo, invocationInfo, parameterSet)); StringBuilder sb = new StringBuilder(); - Action appendBreakingChangeInfo = (string s) => sb.Append(s); + Action appendAttributeMessage = (string s) => sb.Append(s); if (attributes != null && attributes.Count > 0) { - appendBreakingChangeInfo(string.Format(Resources.BreakingChangesAttributesHeaderMessage, commandInfo.Name.Split('_')[0])); + appendAttributeMessage(string.Format(Resources.BreakingChangesAttributesHeaderMessage, commandInfo.Name.Split('_')[0])); foreach (GenericBreakingChangeAttribute attribute in attributes) { - attribute.PrintCustomAttributeInfo(appendBreakingChangeInfo); + attribute.PrintCustomAttributeInfo(appendAttributeMessage); } - appendBreakingChangeInfo(string.Format(Resources.BreakingChangesAttributesFooterMessage, BREAKING_CHANGE_ATTRIBUTE_INFORMATION_LINK)); + appendAttributeMessage(string.Format(Resources.BreakingChangesAttributesFooterMessage, BREAKING_CHANGE_ATTRIBUTE_INFORMATION_LINK)); psCmdlet.WriteWarning(sb.ToString()); } + } + + public static void ProcessPreviewMessageAttributesAtRuntime(CommandInfo commandInfo, InvocationInfo invocationInfo, String parameterSet, System.Management.Automation.PSCmdlet psCmdlet) + { List previewAttributes = new List(GetAllPreviewAttributesInType(commandInfo, invocationInfo)); + StringBuilder sb = new StringBuilder(); + Action appendAttributeMessage = (string s) => sb.Append(s); if (previewAttributes != null && previewAttributes.Count > 0) { foreach (PreviewMessageAttribute attribute in previewAttributes) { - attribute.PrintCustomAttributeInfo(psCmdlet); + attribute.PrintCustomAttributeInfo(appendAttributeMessage); } + psCmdlet.WriteWarning(sb.ToString()); } } - /** * This function takes in a CommandInfo (CmdletInfo or FunctionInfo) * And returns all the deprecation attributes attached to it @@ -128,6 +141,12 @@ private static IEnumerable GetAllBreakingChangeA } return invocationInfo == null ? attributeList : attributeList.Where(e => e.GetType() == typeof(ParameterSetBreakingChangeAttribute) ? ((ParameterSetBreakingChangeAttribute)e).IsApplicableToInvocation(invocationInfo, parameterSet) : e.IsApplicableToInvocation(invocationInfo)); } + + public static bool ContainsPreviewAttribute(CommandInfo commandInfo, InvocationInfo invocationInfo) + { + return GetAllPreviewAttributesInType(commandInfo, invocationInfo)?.Count() > 0; + } + private static IEnumerable GetAllPreviewAttributesInType(CommandInfo commandInfo, InvocationInfo invocationInfo) { List attributeList = new List(); diff --git a/src/Migrate/Migrate.Autorest/generated/runtime/Properties/Resources.Designer.cs b/src/Migrate/Migrate.Autorest/generated/runtime/Properties/Resources.Designer.cs index 5a0fabe27585..876ff8c1b867 100644 --- a/src/Migrate/Migrate.Autorest/generated/runtime/Properties/Resources.Designer.cs +++ b/src/Migrate/Migrate.Autorest/generated/runtime/Properties/Resources.Designer.cs @@ -734,7 +734,7 @@ public static string BreakingChangesAttributesInEffectByDateMessage } /// - /// Looks up a localized string similar to Note :The change is expected to take effect from the version : '{0}' + /// Looks up a localized string similar to Note :The change is expected to take effect from version : '{0}' /// ///. /// @@ -746,6 +746,19 @@ public static string BreakingChangesAttributesInEffectByVersion } } + /// + /// Looks up a localized string similar to Note :The change is expected to take effect from az version : '{0}' + /// + ///. + /// + public static string BreakingChangesAttributesInEffectByAzVersion + { + get + { + return ResourceManager.GetString("BreakingChangesAttributesInEffectByAzVersion", resourceCulture); + } + } + /// /// Looks up a localized string similar to ```powershell ///# Old @@ -3122,7 +3135,16 @@ public static string PortalInstructionsGit } /// - /// Looks up a localized string similar to This cmdlet is in preview. The functionality may not be available in the selected subscription. + /// Looks up a localized string similar to The estimated generally available date is '{0}'.. + /// + public static string PreviewCmdletETAMessage { + get { + return ResourceManager.GetString("PreviewCmdletETAMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to This cmdlet is in preview. Its behavior is subject to change based on customer feedback.. /// public static string PreviewCmdletMessage { @@ -5630,4 +5652,4 @@ public static string YesHint } } } -} +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/generated/runtime/Properties/Resources.resx b/src/Migrate/Migrate.Autorest/generated/runtime/Properties/Resources.resx index 598cd53e958a..a08a2e50172b 100644 --- a/src/Migrate/Migrate.Autorest/generated/runtime/Properties/Resources.resx +++ b/src/Migrate/Migrate.Autorest/generated/runtime/Properties/Resources.resx @@ -1705,7 +1705,7 @@ Use the Enable-AzureDataCollection cmdlet to turn the feature On. The cmdlet can -- The change is expected to take effect from the version : '{0}' +- The change is expected to take effect from version : '{0}' ```powershell @@ -1736,6 +1736,12 @@ 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. + This cmdlet is in preview. Its behavior is subject to change based on customer feedback. + + + The estimated generally available date is '{0}'. + + + - The change is expected to take effect from Az version : '{0}' \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/help/Az.Migrate.md b/src/Migrate/Migrate.Autorest/help/Az.Migrate.md new file mode 100644 index 000000000000..c3af3fde38d1 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/help/Az.Migrate.md @@ -0,0 +1,137 @@ +--- +Module Name: Az.Migrate +Module Guid: c638312b-9fd1-4611-a5cc-11a8caa5b698 +Download Help Link: https://learn.microsoft.com/powershell/module/az.migrate +Help Version: 1.0.0.0 +Locale: en-US +--- + +# Az.Migrate Module +## Description +Microsoft Azure PowerShell: Migrate cmdlets + +## Az.Migrate Cmdlets +### [Get-AzMigrateDiscoveredServer](Get-AzMigrateDiscoveredServer.md) +Get All discovered servers in a migrate project. + +### [Get-AzMigrateHCIJob](Get-AzMigrateHCIJob.md) +Retrieves the status of an Azure Migrate job. + +### [Get-AzMigrateHCIReplicationFabric](Get-AzMigrateHCIReplicationFabric.md) +Gets the details of the fabric. + +### [Get-AzMigrateHCIServerReplication](Get-AzMigrateHCIServerReplication.md) +Retrieves the details of the replicating server. + +### [Get-AzMigrateJob](Get-AzMigrateJob.md) +Retrieves the status of an Azure Migrate job. + +### [Get-AzMigrateProject](Get-AzMigrateProject.md) +Method to get a migrate project. + +### [Get-AzMigrateReplicationFabric](Get-AzMigrateReplicationFabric.md) +Gets the details of an Azure Site Recovery fabric. + +### [Get-AzMigrateReplicationPolicy](Get-AzMigrateReplicationPolicy.md) +Gets the details of a replication policy. + +### [Get-AzMigrateReplicationProtectionContainer](Get-AzMigrateReplicationProtectionContainer.md) +Gets the details of a protection container. + +### [Get-AzMigrateReplicationProtectionContainerMapping](Get-AzMigrateReplicationProtectionContainerMapping.md) +Gets the details of a protection container mapping. + +### [Get-AzMigrateReplicationRecoveryServicesProvider](Get-AzMigrateReplicationRecoveryServicesProvider.md) +Gets the details of registered recovery services provider. + +### [Get-AzMigrateRunAsAccount](Get-AzMigrateRunAsAccount.md) +Method to get run as account. + +### [Get-AzMigrateServerReplication](Get-AzMigrateServerReplication.md) +Retrieves the details of the replicating server. + +### [Get-AzMigrateSite](Get-AzMigrateSite.md) +Method to get a site. + +### [Get-AzMigrateSolution](Get-AzMigrateSolution.md) +Gets a solution in the migrate project. + +### [Initialize-AzMigrateHCIReplicationInfrastructure](Initialize-AzMigrateHCIReplicationInfrastructure.md) +Initializes the infrastructure for the migrate project. + +### [Initialize-AzMigrateReplicationInfrastructure](Initialize-AzMigrateReplicationInfrastructure.md) +Initialises the infrastructure for the migrate project. + +### [New-AzMigrateDiskMapping](New-AzMigrateDiskMapping.md) +Creates a new disk mapping + +### [New-AzMigrateHCIDiskMappingObject](New-AzMigrateHCIDiskMappingObject.md) +Creates a new disk mapping + +### [New-AzMigrateHCINicMappingObject](New-AzMigrateHCINicMappingObject.md) +Creates an object to update NIC properties of a replicating server. + +### [New-AzMigrateHCIServerReplication](New-AzMigrateHCIServerReplication.md) +Starts replication for the specified server. + +### [New-AzMigrateNicMapping](New-AzMigrateNicMapping.md) +Creates an object to update NIC properties of a replicating server. + +### [New-AzMigrateProject](New-AzMigrateProject.md) +Creates a new Migrate project. + +### [New-AzMigrateReplicationPolicy](New-AzMigrateReplicationPolicy.md) +The operation to create a replication policy. + +### [New-AzMigrateReplicationProtectionContainerMapping](New-AzMigrateReplicationProtectionContainerMapping.md) +The operation to create a protection container mapping. + +### [New-AzMigrateServerReplication](New-AzMigrateServerReplication.md) +Starts replication for the specified server. + +### [New-AzMigrateTestNicMapping](New-AzMigrateTestNicMapping.md) +Creates an object to update NIC properties of a test migrating server. + +### [Register-AzMigrateProjectTool](Register-AzMigrateProjectTool.md) +Registers a tool with the migrate project. + +### [Remove-AzMigrateHCIServerReplication](Remove-AzMigrateHCIServerReplication.md) +Stops replication for the migrated server. + +### [Remove-AzMigrateProject](Remove-AzMigrateProject.md) +Delete the migrate project. +Deleting non-existent project is a no-operation. + +### [Remove-AzMigrateServerReplication](Remove-AzMigrateServerReplication.md) +Stops replication for the migrated server. + +### [Restart-AzMigrateServerReplication](Restart-AzMigrateServerReplication.md) +Restarts the replication for specified server. + +### [Resume-AzMigrateServerReplication](Resume-AzMigrateServerReplication.md) +Starts the replication that has been suspended. + +### [Set-AzMigrateDiskMapping](Set-AzMigrateDiskMapping.md) +Updates disk mapping + +### [Set-AzMigrateHCIServerReplication](Set-AzMigrateHCIServerReplication.md) +Updates the target properties for the replicating server. + +### [Set-AzMigrateServerReplication](Set-AzMigrateServerReplication.md) +Updates the target properties for the replicating server. + +### [Start-AzMigrateHCIServerMigration](Start-AzMigrateHCIServerMigration.md) +Starts the migration for the replicating server. + +### [Start-AzMigrateServerMigration](Start-AzMigrateServerMigration.md) +Starts the migration for the replicating server. + +### [Start-AzMigrateTestMigration](Start-AzMigrateTestMigration.md) +Starts the test migration for the replicating server. + +### [Start-AzMigrateTestMigrationCleanup](Start-AzMigrateTestMigrationCleanup.md) +Cleans up the test migration for the replicating server. + +### [Suspend-AzMigrateServerReplication](Suspend-AzMigrateServerReplication.md) +Suspends the ongoing replication. + diff --git a/src/Migrate/Migrate.Autorest/help/Get-AzMigrateDiscoveredServer.md b/src/Migrate/Migrate.Autorest/help/Get-AzMigrateDiscoveredServer.md new file mode 100644 index 000000000000..b16dcdcebcc6 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/help/Get-AzMigrateDiscoveredServer.md @@ -0,0 +1,335 @@ +--- +external help file: +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratediscoveredserver +schema: 2.0.0 +--- + +# Get-AzMigrateDiscoveredServer + +## SYNOPSIS +Get All discovered servers in a migrate project. + +## SYNTAX + +### List (Default) +``` +Get-AzMigrateDiscoveredServer -ProjectName -ResourceGroupName [-DisplayName ] + [-SourceMachineType ] [-SubscriptionId ] [-Confirm] [-WhatIf] [] +``` + +### Get +``` +Get-AzMigrateDiscoveredServer -Name -ProjectName -ResourceGroupName + [-SourceMachineType ] [-SubscriptionId ] [-Confirm] [-WhatIf] [] +``` + +### GetInSite +``` +Get-AzMigrateDiscoveredServer -ApplianceName -Name -ProjectName + -ResourceGroupName [-SourceMachineType ] [-SubscriptionId ] [-Confirm] [-WhatIf] + [] +``` + +### ListInSite +``` +Get-AzMigrateDiscoveredServer -ApplianceName -ProjectName -ResourceGroupName + [-DisplayName ] [-SourceMachineType ] [-SubscriptionId ] [-Confirm] [-WhatIf] + [] +``` + +## DESCRIPTION +Get Azure migrate server commandlet fetches all servers in a migrate project. + +## EXAMPLES + +### Example 1: List VMware machines +```powershell +Get-AzMigrateDiscoveredServer -SubscriptionId xxx-xxx-xxx -ResourceGroupName julytest -ProjectName julytest +``` + +```output +Name Typeo… +---- ----o… +idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_5029e62c-31d2-a6c3-5316-aa39f47c49fc Microsoft.OffAzure/VMwareSites/machines +idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_5029c180-1359-5e3c-3f56-05632aa4a37f Microsoft.OffAzure/VMwareSites/machines +idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_5029d80d-d014-72f3-8d05-d43ee49a023d Microsoft.OffAzure/VMwareSites/machines +idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_5029bd24-6d40-88dc-4f29-329596f9a50b Microsoft.OffAzure/VMwareSites/machines +idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_50292d97-2025-bfdf-1f07-86afa50d144f Microsoft.OffAzure/VMwareSites/machines +idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_50293685-fb73-0a89-204f-f79cb1f0061e Microsoft.OffAzure/VMwareSites/machines +idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_5029c9aa-3c8c-aba8-834e-1058bc457e5b Microsoft.OffAzure/VMwareSites/machines +idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_5029dabc-cc94-780f-76fd-e39acb0e9dce Microsoft.OffAzure/VMwareSites/machines +idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_50299579-fc18-4152-ade2-c4a57946f72b Microsoft.OffAzure/VMwareSites/machines +idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_5029cc18-efdc-7315-3b09-9d12a0f337e2 Microsoft.OffAzure/VMwareSites/machines + +``` + +Get All servers in a migrate project. + +### Example 2: Get VMware machine +```powershell +Get-AzMigrateDiscoveredServer -Name idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_5029e62c-31d2-a6c3-5316-aa39f47c49fc -SubscriptionId xxx-xxx-xxx -ResourceGroupName julytest -ProjectName julytest +``` + +```output +Name Typeo… +---- ----o… +idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_5029e62c-31d2-a6c3-5316-aa39f47c49fc Microsoft.OffAzure/VMwareSites/machines + +``` + +Get a server in a migrate project by name. +Name is a unique paramenter for a server. + +### Example 3: List VMware machines in an appliance +```powershell +Get-AzMigrateDiscoveredServer -ApplianceName BBVMwareAVS -SubscriptionId xxx-xxx-xxx -ResourceGroupName julytest -ProjectName julytest +``` + +```output +Name Typeo… +---- ----o… +idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_5029e62c-31d2-a6c3-5316-aa39f47c49fc Microsoft.OffAzure/VMwareSites/machines +idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_5029c180-1359-5e3c-3f56-05632aa4a37f Microsoft.OffAzure/VMwareSites/machines +idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_5029d80d-d014-72f3-8d05-d43ee49a023d Microsoft.OffAzure/VMwareSites/machines +idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_5029bd24-6d40-88dc-4f29-329596f9a50b Microsoft.OffAzure/VMwareSites/machines +idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_50292d97-2025-bfdf-1f07-86afa50d144f Microsoft.OffAzure/VMwareSites/machines +idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_50293685-fb73-0a89-204f-f79cb1f0061e Microsoft.OffAzure/VMwareSites/machines +idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_5029c9aa-3c8c-aba8-834e-1058bc457e5b Microsoft.OffAzure/VMwareSites/machines +idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_5029dabc-cc94-780f-76fd-e39acb0e9dce Microsoft.OffAzure/VMwareSites/machines +idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_50299579-fc18-4152-ade2-c4a57946f72b Microsoft.OffAzure/VMwareSites/machines +idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_5029cc18-efdc-7315-3b09-9d12a0f337e2 Microsoft.OffAzure/VMwareSites/machines + +``` + +List all servers for an appliance in a project. + +### Example 4: Get VMware machine in an appliance +```powershell +Get-AzMigrateDiscoveredServer -Name idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_5029e62c-31d2-a6c3-5316-aa39f47c49fc -ApplianceName BBVMwareAVS -SubscriptionId xxx-xxx-xxx -ResourceGroupName julytest -ProjectName julytest +``` + +```output +Name Typeo… +---- ----o… +idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_5029e62c-31d2-a6c3-5316-aa39f47c49fc Microsoft.OffAzure/VMwareSites/machines + +``` + +Get a server for an appliance in a project. +Name is a unique paramenter for a server. + +### Example 5: List and filter VMware machines by display name +```powershell +Get-AzMigrateDiscoveredServer -SubscriptionId xxx-xxx-xxx -ResourceGroupName BugBashAVSVMware -ProjectName BugBashAVSVMware -DisplayName Contoso | Format-Table DisplayName,Name,Type +``` + +```output +DisplayName Name Type +----------- ---- ---- +Contoso-ConfigurationServer 10-150-8-52-b090bef3-b733-5e34-bc8f-eb6f2701432a_50098b08-5701-4c58-f6ad-1daf127a8ed9 Microsoft.OffAzure/VMwareSites/machines +Contoso-FrontTier1 10-150-8-52-b090bef3-b733-5e34-bc8f-eb6f2701432a_5009c31a-241a-8213-5627-4ea4af00df93 Microsoft.OffAzure/VMwareSites/machines +Contoso-MiddleTier1 10-150-8-52-b090bef3-b733-5e34-bc8f-eb6f2701432a_50097bb8-f32c-39d6-f475-5aaa6194f016 Microsoft.OffAzure/VMwareSites/machines +ContosoAppSrv2 10-150-8-52-b090bef3-b733-5e34-bc8f-eb6f2701432a_5009b455-1721-fa03-7ceb-8177cd2c5de6 Microsoft.OffAzure/VMwareSites/machines +ContosoCSASR 10-150-8-52-b090bef3-b733-5e34-bc8f-eb6f2701432a_50096b80-7061-672c-8db0-07ee41212869 Microsoft.OffAzure/VMwareSites/machines +ContosoVMwareMigration2 10-150-8-52-b090bef3-b733-5e34-bc8f-eb6f2701432a_50099d31-71d5-2bd1-fada-8c4eba2f279a Microsoft.OffAzure/VMwareSites/machines +ContosoAppSrv1 10-150-8-52-b090bef3-b733-5e34-bc8f-eb6f2701432a_50097d3f-c1f6-9217-825c-936db54043df Microsoft.OffAzure/VMwareSites/machines + +``` + +List servers in a migrate project and filter responses with display name. + +### Example 6: List VMware machines in an appliance and filter by display name +```powershell +Get-AzMigrateDiscoveredServer -SubscriptionId xxx-xxx-xxx -ResourceGroupName BugBashAVSVMware -ProjectName BugBashAVSVMware -ApplianceName BBVMwareAVS -DisplayName Contoso | Format-Table DisplayName,Name,Type +``` + +```output +DisplayName Name Type +----------- ---- ---- +Contoso-ConfigurationServer 10-150-8-52-b090bef3-b733-5e34-bc8f-eb6f2701432a_50098b08-5701-4c58-f6ad-1daf127a8ed9 Microsoft.OffAzure/VMwareSites/machines +Contoso-FrontTier1 10-150-8-52-b090bef3-b733-5e34-bc8f-eb6f2701432a_5009c31a-241a-8213-5627-4ea4af00df93 Microsoft.OffAzure/VMwareSites/machines +Contoso-MiddleTier1 10-150-8-52-b090bef3-b733-5e34-bc8f-eb6f2701432a_50097bb8-f32c-39d6-f475-5aaa6194f016 Microsoft.OffAzure/VMwareSites/machines +ContosoAppSrv2 10-150-8-52-b090bef3-b733-5e34-bc8f-eb6f2701432a_5009b455-1721-fa03-7ceb-8177cd2c5de6 Microsoft.OffAzure/VMwareSites/machines +ContosoCSASR 10-150-8-52-b090bef3-b733-5e34-bc8f-eb6f2701432a_50096b80-7061-672c-8db0-07ee41212869 Microsoft.OffAzure/VMwareSites/machines +ContosoVMwareMigration2 10-150-8-52-b090bef3-b733-5e34-bc8f-eb6f2701432a_50099d31-71d5-2bd1-fada-8c4eba2f279a Microsoft.OffAzure/VMwareSites/machines +ContosoAppSrv1 10-150-8-52-b090bef3-b733-5e34-bc8f-eb6f2701432a_50097d3f-c1f6-9217-825c-936db54043df Microsoft.OffAzure/VMwareSites/machines +Contoso-DataTier3 10-150-8-52-b090bef3-b733-5e34-bc8f-eb6f2701432a_500986e5-7720-471e-11d7-d4e8ae9edc45 Microsoft.OffAzure/VMwareSites/machines +``` + +List servers for an appliance in a migrate project and filter responses with display name. + +### Example 7: List HyperV machines +```powershell +Get-AzMigrateDiscoveredServer -SubscriptionId xxx-xxx-xxx -ResourceGroupName "test-rg" -ProjectName "testproj" -SourceMachineType "HyperV" | Format-Table DisplayName,Name,Type +``` + +```output +DisplayName Name Type +----------- ---- ---- +testvm1 291b6c67-8793-4e21-887e-1e6c3bd00a60 Microsoft.OffAzure/HyperVSites/machines +testvm2 0fbd6ccb-7133-4e72-b18e-5ec98c9c628f Microsoft.OffAzure/HyperVSites/machines +testvm3 e6390dfa-6125-431c-871d-f407bdecb571 Microsoft.OffAzure/HyperVSites/machines +testvm4 af83b64b-2314-48e2-8d0f-fd44ab5142ba Microsoft.OffAzure/HyperVSites/machines +``` + +Get All HyperV servers in a migrate project. +Similarly, specify "HyperV" for -SourceMachineType in all the above examples can retrieve HyperV machine(s) in different ways. + +## PARAMETERS + +### -ApplianceName +Specifies the appliance name. +This internally maps to a site. + +```yaml +Type: System.String +Parameter Sets: GetInSite, ListInSite +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DisplayName +Specifies the source machine display name. + +```yaml +Type: System.String +Parameter Sets: List, ListInSite +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Specifies the source machine name. +This is an internal Name. +For users, use display name. + +```yaml +Type: System.String +Parameter Sets: Get, GetInSite +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProjectName +Specifies the migrate project 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 +Specifies the resource group name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SourceMachineType +Specifies the source machine type. +Currently, only HyperV and VMware are supported. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Specifies 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.Migrate.Models.Api202001.IHyperVMachine + +### Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVMwareMachine + +## NOTES + +## RELATED LINKS + diff --git a/src/Migrate/Migrate.Autorest/help/Get-AzMigrateHCIJob.md b/src/Migrate/Migrate.Autorest/help/Get-AzMigrateHCIJob.md new file mode 100644 index 000000000000..9e61b77f15ec --- /dev/null +++ b/src/Migrate/Migrate.Autorest/help/Get-AzMigrateHCIJob.md @@ -0,0 +1,467 @@ +--- +external help file: +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratehcijob +schema: 2.0.0 +--- + +# Get-AzMigrateHCIJob + +## SYNOPSIS +Retrieves the status of an Azure Migrate job. + +## SYNTAX + +### ListByName (Default) +``` +Get-AzMigrateHCIJob -ProjectName -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### GetById +``` +Get-AzMigrateHCIJob -ID [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### GetByInputObject +``` +Get-AzMigrateHCIJob -InputObject [-SubscriptionId ] [-DefaultProfile ] + [] +``` + +### GetByName +``` +Get-AzMigrateHCIJob -Name -ProjectName -ResourceGroupName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### ListById +``` +Get-AzMigrateHCIJob -ProjectID -ResourceGroupID [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +## DESCRIPTION +The Get-AzMigrateHCIJob cmdlet retrives the status of an Azure Migrate job. + +## EXAMPLES + +### Example 1: Get by job Id +```powershell +Get-AzMigrateHCIJob -ID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/jobs/0203aa1b-1dff-4653-89a9-b90a76d1601a" +``` + +```output +ActivityId : ActivityId: 00000000-0000-0000-0000-000000000000 +AllowedAction : {Cancel} +CustomPropertyAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetails +CustomPropertyInstanceType : WorkflowDetails +DisplayName : Delete protected item +EndTime : +Error : {} +Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication + /replicationVaults/testproj1234replicationvault/jobs/0203aa1b-1dff-4653-89a9-b90a76d1601a +Name : 0203aa1b-1dff-4653-89a9-b90a76d1601a +ObjectId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication + /replicationVaults/testproj1234replicationvault/protectedItems/testsite-0000-0000-00000001 +ObjectInternalId : 13436868-1f4c-5d4e-a252-c666179bf4df +ObjectInternalName : testmachine1 +ObjectName : testsite-0000-0000-00000001 +ObjectType : ProtectedItem +ReplicationProviderId : 0a870516-56c7-4460-998c-f267bd579f16 +SourceFabricProviderId : a2793d98-d4f1-427f-a5a6-2d694f4a1bf7 +StartTime : 8/14/2023 7:09:10 PM +State : Started +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelTags +TargetFabricProviderId : 22f00372-a1b7-467f-87ce-d95e17a6e7c7 +Task : {Prerequisite check, Deleting protected item} +Type : Microsoft.DataReplication/replicationVaults/jobs +``` + +Retrieves a job by its Id. + +### Example 2: Get by job name +```powershell +Get-AzMigrateHCIJob -ResourceGroupName "test-rg" -ProjectName "testproj" -Name "0203aa1b-1dff-4653-89a9-b90a76d1601a" +``` + +```output +ActivityId : ActivityId: 00000000-0000-0000-0000-000000000000 +AllowedAction : {Cancel} +CustomPropertyAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetails +CustomPropertyInstanceType : WorkflowDetails +DisplayName : Delete protected item +EndTime : +Error : {} +Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication + /replicationVaults/testproj1234replicationvault/jobs/0203aa1b-1dff-4653-89a9-b90a76d1601a +Name : 0203aa1b-1dff-4653-89a9-b90a76d1601a +ObjectId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication + /replicationVaults/testproj1234replicationvault/protectedItems/testsite-0000-0000-00000001 +ObjectInternalId : 13436868-1f4c-5d4e-a252-c666179bf4df +ObjectInternalName : testmachine1 +ObjectName : testsite-0000-0000-00000001 +ObjectType : ProtectedItem +ReplicationProviderId : 0a870516-56c7-4460-998c-f267bd579f16 +SourceFabricProviderId : a2793d98-d4f1-427f-a5a6-2d694f4a1bf7 +StartTime : 8/14/2023 7:09:10 PM +State : Started +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelTags +TargetFabricProviderId : 22f00372-a1b7-467f-87ce-d95e17a6e7c7 +Task : {Prerequisite check, Deleting protected item} +Type : Microsoft.DataReplication/replicationVaults/jobs +``` + +Retrieves a job by its name. + +### Example 3: Get by job input object +```powershell +$InputObject = Get-AzMigrateHCIJob -ID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/jobs/0203aa1b-1dff-4653-89a9-b90a76d1601a" + +Get-AzMigrateHCIJob -InputObject $InputObject + +$InputObject | Get-AzMigrateHCIJob +``` + +```output +ActivityId : ActivityId: 00000000-0000-0000-0000-000000000000 +AllowedAction : {Cancel} +CustomPropertyAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetails +CustomPropertyInstanceType : WorkflowDetails +DisplayName : Delete protected item +EndTime : +Error : {} +Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication + /replicationVaults/testproj1234replicationvault/jobs/0203aa1b-1dff-4653-89a9-b90a76d1601a +Name : 0203aa1b-1dff-4653-89a9-b90a76d1601a +ObjectId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication + /replicationVaults/testproj1234replicationvault/protectedItems/testsite-0000-0000-00000001 +ObjectInternalId : 13436868-1f4c-5d4e-a252-c666179bf4df +ObjectInternalName : testmachine1 +ObjectName : testsite-0000-0000-00000001 +ObjectType : ProtectedItem +ReplicationProviderId : 0a870516-56c7-4460-998c-f267bd579f16 +SourceFabricProviderId : a2793d98-d4f1-427f-a5a6-2d694f4a1bf7 +StartTime : 8/14/2023 7:09:10 PM +State : Started +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelTags +TargetFabricProviderId : 22f00372-a1b7-467f-87ce-d95e17a6e7c7 +Task : {Prerequisite check, Deleting protected item} +Type : Microsoft.DataReplication/replicationVaults/jobs +``` + +Retrieves a job by the job itself as an input object. + +### Example 4: List by resource group Id and project Id. +```powershell +Get-AzMigrateHCIJob -ResourceGroupID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg" -ProjectID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.Migrate/MigrateProjects/testproj" +``` + +```output +ActivityId : ActivityId: 00000000-0000-0000-0000-000000000000 +AllowedAction : {Cancel} +CustomPropertyAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetails +CustomPropertyInstanceType : WorkflowDetails +DisplayName : Delete protected item +EndTime : +Error : {} +Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication + /replicationVaults/testproj1234replicationvault/jobs/0203aa1b-1dff-4653-89a9-b90a76d1601a +Name : 0203aa1b-1dff-4653-89a9-b90a76d1601a +ObjectId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication + /replicationVaults/testproj1234replicationvault/protectedItems/testsite-0000-0000-00000001 +ObjectInternalId : 13436868-1f4c-5d4e-a252-c666179bf4df +ObjectInternalName : testmachine1 +ObjectName : testsite-0000-0000-00000001 +ObjectType : ProtectedItem +ReplicationProviderId : 0a870516-56c7-4460-998c-f267bd579f16 +SourceFabricProviderId : a2793d98-d4f1-427f-a5a6-2d694f4a1bf7 +StartTime : 8/14/2023 7:09:10 PM +State : Started +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelTags +TargetFabricProviderId : 22f00372-a1b7-467f-87ce-d95e17a6e7c7 +Task : {Prerequisite check, Deleting protected item} +Type : Microsoft.DataReplication/replicationVaults/jobs + +ActivityId : ActivityId: 00000000-0000-0000-0000-000000000000 +AllowedAction : {} +CustomPropertyAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetails +CustomPropertyInstanceType : +DisplayName : Planned failover +EndTime : 8/11/2023 10:09:18 PM +Error : +Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication + /replicationVaults/testproj1234replicationvault/jobs/f2ebb932-fa4a-47a7-b1fa-ff5aa877d5ed +Name : f2ebb932-fa4a-47a7-b1fa-ff5aa877d5ed +ObjectId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication + /replicationVaults/testproj1234replicationvault/protectedItems/testsite-0000-0000-00000000/plannedFailover +ObjectInternalId : 4ef231a3-0774-5e44-8317-bed903d297a2 +ObjectInternalName : testmachine2 +ObjectName : testsite-0000-0000-00000000 +ObjectType : ProtectedItem +ReplicationProviderId : 0a870516-56c7-4460-998c-f267bd579f16 +SourceFabricProviderId : a2793d98-d4f1-427f-a5a6-2d694f4a1bf7 +StartTime : 8/11/2023 9:53:48 PM +State : Succeeded +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelTags +TargetFabricProviderId : 22f00372-a1b7-467f-87ce-d95e17a6e7c7 +Task : +Type : Microsoft.DataReplication/replicationVaults/jobs +``` + +Retrieves all the jobs from a project in some resource group by Ids. + +### Example 5: List by resource group name and project name. +```powershell +Get-AzMigrateHCIJob -ResourceGroupName "test-rg" -ProjectName "testproj" +``` + +```output +ActivityId : ActivityId: 00000000-0000-0000-0000-000000000000 +AllowedAction : {Cancel} +CustomPropertyAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetails +CustomPropertyInstanceType : WorkflowDetails +DisplayName : Delete protected item +EndTime : +Error : {} +Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication + /replicationVaults/testproj1234replicationvault/jobs/0203aa1b-1dff-4653-89a9-b90a76d1601a +Name : 0203aa1b-1dff-4653-89a9-b90a76d1601a +ObjectId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication + /replicationVaults/testproj1234replicationvault/protectedItems/testsite-0000-0000-00000001 +ObjectInternalId : 13436868-1f4c-5d4e-a252-c666179bf4df +ObjectInternalName : testmachine1 +ObjectName : testsite-0000-0000-00000001 +ObjectType : ProtectedItem +ReplicationProviderId : 0a870516-56c7-4460-998c-f267bd579f16 +SourceFabricProviderId : a2793d98-d4f1-427f-a5a6-2d694f4a1bf7 +StartTime : 8/14/2023 7:09:10 PM +State : Started +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelTags +TargetFabricProviderId : 22f00372-a1b7-467f-87ce-d95e17a6e7c7 +Task : {Prerequisite check, Deleting protected item} +Type : Microsoft.DataReplication/replicationVaults/jobs + +ActivityId : ActivityId: 00000000-0000-0000-0000-000000000000 +AllowedAction : {} +CustomPropertyAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetails +CustomPropertyInstanceType : +DisplayName : Planned failover +EndTime : 8/11/2023 10:09:18 PM +Error : +Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication + /replicationVaults/testproj1234replicationvault/jobs/f2ebb932-fa4a-47a7-b1fa-ff5aa877d5ed +Name : f2ebb932-fa4a-47a7-b1fa-ff5aa877d5ed +ObjectId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication + /replicationVaults/testproj1234replicationvault/protectedItems/testsite-0000-0000-00000000/plannedFailover +ObjectInternalId : 4ef231a3-0774-5e44-8317-bed903d297a2 +ObjectInternalName : testmachine2 +ObjectName : testsite-0000-0000-00000000 +ObjectType : ProtectedItem +ReplicationProviderId : 0a870516-56c7-4460-998c-f267bd579f16 +SourceFabricProviderId : a2793d98-d4f1-427f-a5a6-2d694f4a1bf7 +StartTime : 8/11/2023 9:53:48 PM +State : Succeeded +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelTags +TargetFabricProviderId : 22f00372-a1b7-467f-87ce-d95e17a6e7c7 +Task : +Type : Microsoft.DataReplication/replicationVaults/jobs +``` + +Retrieves all the jobs from a project in some resource group by names. + +## 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 +``` + +### -ID +Specifies the job id for which the details needs to be retrieved. + +```yaml +Type: System.String +Parameter Sets: GetById +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Specifies the job object of the replicating server. +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity +Parameter Sets: GetByInputObject +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +Job identifier + +```yaml +Type: System.String +Parameter Sets: GetByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProjectID +Specifies the Azure Migrate Project in which servers are replicating. + +```yaml +Type: System.String +Parameter Sets: ListById +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProjectName +The name of the migrate project. + +```yaml +Type: System.String +Parameter Sets: GetByName, ListByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupID +Specifies the Resource Group of the Azure Migrate Project in the current subscription. + +```yaml +Type: System.String +Parameter Sets: ListById +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: GetByName, ListByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure 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 + +### Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel + +## NOTES + +## RELATED LINKS + diff --git a/src/Migrate/Migrate.Autorest/help/Get-AzMigrateHCIReplicationFabric.md b/src/Migrate/Migrate.Autorest/help/Get-AzMigrateHCIReplicationFabric.md new file mode 100644 index 000000000000..174bb715d632 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/help/Get-AzMigrateHCIReplicationFabric.md @@ -0,0 +1,273 @@ +--- +external help file: +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratehcireplicationfabric +schema: 2.0.0 +--- + +# Get-AzMigrateHCIReplicationFabric + +## SYNOPSIS +Gets the details of the fabric. + +## SYNTAX + +### List (Default) +``` +Get-AzMigrateHCIReplicationFabric [-SubscriptionId ] [-ContinuationToken ] + [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzMigrateHCIReplicationFabric -Name -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzMigrateHCIReplicationFabric -InputObject [-DefaultProfile ] + [] +``` + +### List1 +``` +Get-AzMigrateHCIReplicationFabric -ResourceGroupName [-SubscriptionId ] + [-ContinuationToken ] [-DefaultProfile ] [] +``` + +## DESCRIPTION +Gets the details of the fabric. + +## EXAMPLES + +### Example 1: Get by fabric name +```powershell +Get-AzMigrateHCIReplicationFabric -ResourceGroupName "test-rg" -Name "testsrcappreplicationfabric" +``` + +```output +Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationFabrics/testsrcappreplicationfabric +Location : southeastasia +Name : testsrcappreplicationfabric +Property : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelProperties +SystemDataCreatedAt : 8/11/2023 6:39:04 PM +SystemDataCreatedBy : testuser@example.com +SystemDataCreatedByType : User +SystemDataLastModifiedAt : 8/11/2023 6:48:29 PM +SystemDataLastModifiedBy : testuser@example.com +SystemDataLastModifiedByType : User +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelTags +Type : Microsoft.DataReplication/replicationFabrics +``` + +Retrieves a fabric by its name. + +### Example 2: Get by fabric input object +```powershell +$InputObject = Get-AzMigrateHCIReplicationFabric -ResourceGroupName "test-rg" -Name "testsrcappreplicationfabric" + +Get-AzMigrateHCIReplicationFabric -InputObject $InputObject + +$InputObject | Get-AzMigrateHCIReplicationFabric +``` + +```output +Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationFabrics/testsrcappreplicationfabric +Location : southeastasia +Name : testsrcappreplicationfabric +Property : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelProperties +SystemDataCreatedAt : 8/11/2023 6:39:04 PM +SystemDataCreatedBy : testuser@example.com +SystemDataCreatedByType : User +SystemDataLastModifiedAt : 8/11/2023 6:48:29 PM +SystemDataLastModifiedBy : testuser@example.com +SystemDataLastModifiedByType : User +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelTags +Type : Microsoft.DataReplication/replicationFabrics +``` + +Retrieves a fabric by the fabric itself as an input object. + +### Example 3: List by resource group name +```powershell +Get-AzMigrateHCIReplicationFabric -ResourceGroupName "test-rg" +``` + +```output +Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationFabrics/testsrcappreplicationfabric +Location : southeastasia +Name : testsrcappreplicationfabric +Property : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelProperties +SystemDataCreatedAt : 8/11/2023 6:39:04 PM +SystemDataCreatedBy : testuser@example.com +SystemDataCreatedByType : User +SystemDataLastModifiedAt : 8/11/2023 6:48:29 PM +SystemDataLastModifiedBy : testuser@example.com +SystemDataLastModifiedByType : User +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelTags +Type : Microsoft.DataReplication/replicationFabrics + +Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationFabrics/testtgtappreplicationfabric +Location : southeastasia +Name : testtgtappreplicationfabric +Property : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelProperties +SystemDataCreatedAt : 8/11/2023 9:16:46 PM +SystemDataCreatedBy : testuser@example.com +SystemDataCreatedByType : User +SystemDataLastModifiedAt : 8/11/2023 9:16:46 PM +SystemDataLastModifiedBy : testuser@example.com +SystemDataLastModifiedByType : User +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelTags +Type : Microsoft.DataReplication/replicationFabrics +``` + +Retrieves all fabrics from a resource group by name. + +### Example 4: List all fabircs +```powershell +Get-AzMigrateHCIReplicationFabric +``` + +```output +Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationFabrics/testsrcappreplicationfabric +Location : southeastasia +Name : testsrcappreplicationfabric +Property : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelProperties +SystemDataCreatedAt : 8/11/2023 6:39:04 PM +SystemDataCreatedBy : testuser@example.com +SystemDataCreatedByType : User +SystemDataLastModifiedAt : 8/11/2023 6:48:29 PM +SystemDataLastModifiedBy : testuser@example.com +SystemDataLastModifiedByType : User +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelTags +Type : Microsoft.DataReplication/replicationFabrics + +Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationFabrics/testtgtappreplicationfabric +Location : southeastasia +Name : testtgtappreplicationfabric +Property : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelProperties +SystemDataCreatedAt : 8/11/2023 9:16:46 PM +SystemDataCreatedBy : testuser@example.com +SystemDataCreatedByType : User +SystemDataLastModifiedAt : 8/11/2023 9:16:46 PM +SystemDataLastModifiedBy : testuser@example.com +SystemDataLastModifiedByType : User +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.FabricModelTags +Type : Microsoft.DataReplication/replicationFabrics + +... +``` + +Retrieves all fabrics from a subscription. + +## PARAMETERS + +### -ContinuationToken +Continuation token from the previous call. + +```yaml +Type: System.String +Parameter Sets: List, List1 +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```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.Migrate.Models.IMigrateIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +The fabric name. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: FabricName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: Get, List1 +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure Subscription Id in which migrate project was created. + +```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.Migrate.Models.IMigrateIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModel + +## NOTES + +## RELATED LINKS + diff --git a/src/Migrate/Migrate.Autorest/help/Get-AzMigrateHCIServerReplication.md b/src/Migrate/Migrate.Autorest/help/Get-AzMigrateHCIServerReplication.md new file mode 100644 index 000000000000..4c49d90a6883 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/help/Get-AzMigrateHCIServerReplication.md @@ -0,0 +1,300 @@ +--- +external help file: +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratehciserverreplication +schema: 2.0.0 +--- + +# Get-AzMigrateHCIServerReplication + +## SYNOPSIS +Retrieves the details of the replicating server. + +## SYNTAX + +### ListByName (Default) +``` +Get-AzMigrateHCIServerReplication -ProjectName -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### GetByInputObject +``` +Get-AzMigrateHCIServerReplication -InputObject [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### GetByItemID +``` +Get-AzMigrateHCIServerReplication -TargetObjectID [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### GetByMachineName +``` +Get-AzMigrateHCIServerReplication -MachineName -ProjectName -ResourceGroupName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### GetBySDSID +``` +Get-AzMigrateHCIServerReplication -DiscoveredMachineId [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### ListById +``` +Get-AzMigrateHCIServerReplication -ProjectID -ResourceGroupID [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +## DESCRIPTION +The Get-AzMigrateHCIServerReplication cmdlet retrieves the object for the replicating server. + +## EXAMPLES + +### Example 1: Get details by id +```powershell +Get-AzMigrateHCIServerReplication -TargetObjectID '/subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/protectedItems/503a4f02-916c-d6b0-8d14-222bbd4767e5' +``` + +```output +Id : /subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/protectedItems/503a4f02-916c-d6b0-8d14-222bbd4767e5 +Name : 503a4f02-916c-d6b0-8d14-222bbd4767e5 +Property : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelProperties +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelTags +Type : Microsoft.DataReplication/replicationVaults/protectedItems +``` + +Get by id. + +### Example 2: Get detail by discovered machine id +```powershell +Get-AzMigrateHCIServerReplication -DiscoveredMachineId "/subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.OffAzure/HyperVSites/siteName1/machines/503a4f02-916c-d6b0-8d14-222bbd4767e5" + +``` + +```output +Id : /subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/protectedItems/503a4f02-916c-d6b0-8d14-222bbd4767e5 +Name : 503a4f02-916c-d6b0-8d14-222bbd4767e5 +Property : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelProperties +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelTags +Type : Microsoft.DataReplication/replicationVaults/protectedItems +``` + +Get by discovered machine id. + +### Example 3: List all in project by name +```powershell +Get-AzMigrateServerReplication -ResourceGroupName testResourceGroup -ProjectName testProjectName +``` + +```output + +Id : /subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/protectedItems/503a4f02-916c-d6b0-8d14-222bbd4767e5 +Name : 503a4f02-916c-d6b0-8d14-222bbd4767e5 +Property : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelProperties +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelTags +Type : Microsoft.DataReplication/replicationVaults/protectedItems + +Id : /subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/protectedItems/d758f4fb-ae5e-4ac8-bb97-1e114555fe9f +Name : d758f4fb-ae5e-4ac8-bb97-1e114555fe9f +Property : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelProperties +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemModelTags +Type : Microsoft.DataReplication/replicationVaults/protectedItems +``` + +List all. + +## 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 +``` + +### -DiscoveredMachineId +Specifies the machine ID of the discovered server. + +```yaml +Type: System.String +Parameter Sets: GetBySDSID +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Specifies the machine object of the replicating server. +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity +Parameter Sets: GetByInputObject +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -MachineName +Specifies the display name of the replicating machine. + +```yaml +Type: System.String +Parameter Sets: GetByMachineName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProjectID +Specifies the Azure Migrate Project in which servers are replicating. + +```yaml +Type: System.String +Parameter Sets: ListById +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProjectName +Specifies the Azure Migrate project in the current subscription. + +```yaml +Type: System.String +Parameter Sets: GetByMachineName, ListByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupID +Specifies the Resource Group of the Azure Migrate Project in the current subscription. + +```yaml +Type: System.String +Parameter Sets: ListById +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +Specifies the Resource Group of the Azure Migrate Project in the current subscription. + +```yaml +Type: System.String +Parameter Sets: GetByMachineName, ListByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure 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 +``` + +### -TargetObjectID +Specifies the replicating server ARM ID. + +```yaml +Type: System.String +Parameter Sets: GetByItemID +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.Migrate.Models.IMigrateIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel + +## NOTES + +## RELATED LINKS + diff --git a/src/Migrate/Migrate.Autorest/help/Get-AzMigrateJob.md b/src/Migrate/Migrate.Autorest/help/Get-AzMigrateJob.md new file mode 100644 index 000000000000..dae93061df99 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/help/Get-AzMigrateJob.md @@ -0,0 +1,304 @@ +--- +external help file: +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratejob +schema: 2.0.0 +--- + +# Get-AzMigrateJob + +## SYNOPSIS +Retrieves the status of an Azure Migrate job. + +## SYNTAX + +### ListByName (Default) +``` +Get-AzMigrateJob -ProjectName -ResourceGroupName [-SubscriptionId ] + [-Filter ] [-DefaultProfile ] [] +``` + +### GetById +``` +Get-AzMigrateJob -JobID [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### GetByInputObject +``` +Get-AzMigrateJob -InputObject [-SubscriptionId ] [-DefaultProfile ] + [] +``` + +### GetByName +``` +Get-AzMigrateJob -JobName -ProjectName -ResourceGroupName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### ListById +``` +Get-AzMigrateJob -ProjectID -ResourceGroupID [-SubscriptionId ] [-Filter ] + [-DefaultProfile ] [] +``` + +## DESCRIPTION +The Get-AzMigrateJob cmdlet retrives the status of an Azure Migrate job. + +## EXAMPLES + +### Example 1: Get By Job Id +```powershell +Get-AzMigrateJob -JobID "/Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.RecoveryServices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationJobs/997e2a92-5afe-49c7-a81a-89660aec9b7b" +``` + +```output +ActivityId : 68af14b4-46ae-48d1-b3e9-cdcffb9e8a93 ActivityId: 74d1a396-1d37-4264-8a5b-b727aaef0171 +AllowedAction : {} +CustomDetailAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.JobDetailsAffectedObjectDetails +CustomDetailInstanceType : AsrJobDetails +EndTime : 9/16/20 11:57:33 AM +Error : {} +FriendlyName : Associate replication policy +Id : /Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.Recover + yServices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationJobs/997e2a92-5afe-49c7-a81a-89660aec9b7b +Location : +Name : 997e2a92-5afe-49c7-a81a-89660aec9b7b +ScenarioName : AssociateProtectionProfile +StartTime : 9/16/20 11:57:32 AM +State : Succeeded +StateDescription : Completed +TargetInstanceType : ProtectionProfile +TargetObjectId : 42752b89-5fad-52fd-bf93-679fbdb6fed9 +TargetObjectName : migrateAzMigratePWSHTc8d1sitepolicy +Task : {CloudPairingPrerequisitesCheck, CloudPairingPrepareSite} +Type : Microsoft.RecoveryServices/vaults/replicationJobs +``` + +This retrieves a job by it's Id. + +### Example 2: List by resource group and project +```powershell +Get-AzMigrateJob -ResourceGroupName 'azmigratepwshtestasr13072020' -ProjectName 'AzMigrateTestProjectPWSH' +``` + +```output +ActivityId : +AllowedAction : {} +CustomDetailAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.JobDetailsAffectedObjectDetails +CustomDetailInstanceType : +EndTime : 9/21/20 4:13:40 PM +Error : {} +FriendlyName : Update the virtual machine +Id : /Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.Recover + yServices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationJobs/1c89e38e-34ec-4903-aa7c-115201bf2de1 +Location : +Name : 1c89e38e-34ec-4903-aa7c-115201bf2de1 +ScenarioName : UpdateVmProperties +StartTime : 9/21/20 4:13:34 PM +State : Succeeded +StateDescription : Completed +TargetInstanceType : ProtectionEntity +TargetObjectId : 593b735d-2a34-53b2-b8ed-e33da5650703 +TargetObjectName : rb-w2k12r2-1 +Task : {} +Type : Microsoft.RecoveryServices/vaults/replicationJobs +``` + +This gets all jobs in a project. + +### Example 3: Get by resource group, project and job name +```powershell +Get-AzMigrateJob -ResourceGroupName 'azmigratepwshtestasr13072020' -ProjectName 'AzMigrateTestProjectPWSH' -JobName 7ae1ee7c-442c-499d-8b0e-81d52a42b71e +``` + +```output +ActivityId : 6986b7e5-0f1f-49d8-8b4b-77e6f66bcb92 ActivityId: eb73c6a1-7c66-469f-a853-d896aa38cc0f +AllowedAction : {} +CustomDetailAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.JobDetailsAffectedObjectDetails +CustomDetailInstanceType : AsrJobDetails +EndTime : 8/21/20 6:41:48 AM +Error : {} +FriendlyName : Create replication policy +Id : /Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.Recover + yServices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationJobs/7ae1ee7c-442c-499d-8b0e-81d52a42b71e +Location : +Name : 7ae1ee7c-442c-499d-8b0e-81d52a42b71e +ScenarioName : AddProtectionProfile +StartTime : 8/21/20 6:41:48 AM +State : Succeeded +StateDescription : Completed +TargetInstanceType : ProtectionProfile +TargetObjectId : 18b2ccec-e39a-517b-ae5d-dd395e9f4f96 +TargetObjectName : samplePolicy3 +Task : {AddProtectionProfilePreflightsCheckTask, AddProtectionProfileTask} +Type : Microsoft.RecoveryServices/vaults/replicationJobs +``` + +This gets a specific job. + +## 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: ListById, ListByName +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Specifies the job object of the replicating server. +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IJob +Parameter Sets: GetByInputObject +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -JobID +Specifies the job id for which the details needs to be retrieved. + +```yaml +Type: System.String +Parameter Sets: GetById +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -JobName +Job identifier + +```yaml +Type: System.String +Parameter Sets: GetByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProjectID +Specifies the Azure Migrate Project in which servers are replicating. + +```yaml +Type: System.String +Parameter Sets: ListById +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProjectName +The name of the migrate project. + +```yaml +Type: System.String +Parameter Sets: GetByName, ListByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupID +Specifies the Resource Group of the Azure Migrate Project in the current subscription. + +```yaml +Type: System.String +Parameter Sets: ListById +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: GetByName, ListByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure 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.Migrate.Models.Api202301.IJob + +## NOTES + +## RELATED LINKS + diff --git a/src/Migrate/Migrate.Autorest/help/Get-AzMigrateProject.md b/src/Migrate/Migrate.Autorest/help/Get-AzMigrateProject.md new file mode 100644 index 000000000000..3c5bf9e8daab --- /dev/null +++ b/src/Migrate/Migrate.Autorest/help/Get-AzMigrateProject.md @@ -0,0 +1,113 @@ +--- +external help file: +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/get-azmigrateproject +schema: 2.0.0 +--- + +# Get-AzMigrateProject + +## SYNOPSIS +Method to get a migrate project. + +## SYNTAX + +``` +Get-AzMigrateProject -Name -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +## DESCRIPTION +Method to get a migrate project. + +## EXAMPLES + +### Example 1: Get +```powershell +Get-AzMigrateProject -SubscriptionId xxx-xxx-xxx -ResourceGroupName BugBashAVSVMware -Name BugBashAVSVMware +``` + +```output +ETag Location Name Type +---- -------- ---- ---- + southeastasia BugBashAVSVMware Microsoft.Migrate/MigrateProjects +``` + +Method to get a migrate project. + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```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 +``` + +### -Name +Name of the Azure Migrate project. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: MigrateProjectName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +Name of the Azure Resource Group that migrate project is part of. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure Subscription Id in which migrate project was created. + +```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.Migrate.Models.Api20180901Preview.IMigrateProject + +## NOTES + +## RELATED LINKS + diff --git a/src/Migrate/Migrate.Autorest/help/Get-AzMigrateReplicationFabric.md b/src/Migrate/Migrate.Autorest/help/Get-AzMigrateReplicationFabric.md new file mode 100644 index 000000000000..675b5af1bb24 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/help/Get-AzMigrateReplicationFabric.md @@ -0,0 +1,193 @@ +--- +external help file: +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratereplicationfabric +schema: 2.0.0 +--- + +# Get-AzMigrateReplicationFabric + +## SYNOPSIS +Gets the details of an Azure Site Recovery fabric. + +## SYNTAX + +### List (Default) +``` +Get-AzMigrateReplicationFabric -ResourceGroupName -ResourceName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzMigrateReplicationFabric -FabricName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-Filter ] [-DefaultProfile ] [] +``` + +## DESCRIPTION +Gets the details of an Azure Site Recovery fabric. + +## EXAMPLES + +### Example 1: Get all fabrics by resource group and vault name +```powershell +Get-AzMigrateReplicationFabric -ResourceGroupName azmigratepwshtestasr13072020 -ResourceName AzMigrateTestProjectPWSH02aarsvault -FabricName AzMigratePWSHTc8d1replicationfabric +``` + +```output +BcdrState : Valid +CustomDetailInstanceType : VMwareV2 +EncryptionDetailKekCertExpiryDate : +EncryptionDetailKekCertThumbprint : +EncryptionDetailKekState : None +FriendlyName : AzMigratePWSHTc8d1replicationfabric +Health : Normal +HealthErrorDetail : {} +Id : /Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsof + t.RecoveryServices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationFabrics/AzMigratePWSHTc8d1replicationfabr + ic +InternalIdentifier : 501ff8f2-c9d7-5bf4-87ff-d0b3fc98aeb5 +Location : +Name : AzMigratePWSHTc8d1replicationfabric +RolloverEncryptionDetailKekCertExpiryDate : +RolloverEncryptionDetailKekCertThumbprint : +RolloverEncryptionDetailKekState : None +Type : Microsoft.RecoveryServices/vaults/replicationFabrics +``` + +Get all fabrics in resource group and vault + +### Example 2: Get fabric by resource group, vault name and fabric name +```powershell +Get-AzMigrateReplicationFabric -ResourceGroupName azmigratepwshtestasr13072020 -ResourceName AzMigrateTestProjectPWSH02aarsvault +``` + +```output +BcdrState : Valid +CustomDetailInstanceType : VMwareV2 +EncryptionDetailKekCertExpiryDate : +EncryptionDetailKekCertThumbprint : +EncryptionDetailKekState : None +FriendlyName : AzMigratePWSHTc8d1replicationfabric +Health : Normal +HealthErrorDetail : {} +Id : /Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsof + t.RecoveryServices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationFabrics/AzMigratePWSHTc8d1replicationfabr + ic +InternalIdentifier : 501ff8f2-c9d7-5bf4-87ff-d0b3fc98aeb5 +Location : +Name : AzMigratePWSHTc8d1replicationfabric +RolloverEncryptionDetailKekCertExpiryDate : +RolloverEncryptionDetailKekCertThumbprint : +RolloverEncryptionDetailKekState : None +Type : Microsoft.RecoveryServices/vaults/replicationFabrics +``` + +Get a specific fabric + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```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 +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 +Azure Subscription Id in which migrate project was created. + +```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.Migrate.Models.Api202301.IFabric + +## NOTES + +## RELATED LINKS + diff --git a/src/Migrate/Migrate.Autorest/help/Get-AzMigrateReplicationPolicy.md b/src/Migrate/Migrate.Autorest/help/Get-AzMigrateReplicationPolicy.md new file mode 100644 index 000000000000..e3f1c86bbcb2 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/help/Get-AzMigrateReplicationPolicy.md @@ -0,0 +1,151 @@ +--- +external help file: +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratereplicationpolicy +schema: 2.0.0 +--- + +# Get-AzMigrateReplicationPolicy + +## SYNOPSIS +Gets the details of a replication policy. + +## SYNTAX + +### List (Default) +``` +Get-AzMigrateReplicationPolicy -ResourceGroupName -ResourceName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzMigrateReplicationPolicy -PolicyName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +## DESCRIPTION +Gets the details of a replication policy. + +## EXAMPLES + +### Example 1: Get all policies in a vault +```powershell +Get-AzMigrateReplicationPolicy -ResourceGroupName azmigratepwshtestasr13072020 -ResourceName AzMigrateTestProjectPWSH02aarsvault +``` + +```output +Location Name Type +-------- ---- ---- + samplepolicy2 Microsoft.RecoveryServices/vaults/replicationPolicies + samplepolicy1 Microsoft.RecoveryServices/vaults/replicationPolicies + samplePolicy3 Microsoft.RecoveryServices/vaults/replicationPolicies + migrateAzMigratePWSHTc8d1sitepolicy Microsoft.RecoveryServices/vaults/replicationPolicies +``` + +Get all policies. + +### Example 2: Get a specific policy +```powershell +Get-AzMigrateReplicationPolicy -ResourceGroupName azmigratepwshtestasr13072020 -ResourceName AzMigrateTestProjectPWSH02aarsvault -PolicyName migrateAzMigratePWSHTc8d1sitepolicy +``` + +```output +Location Name Type +-------- ---- ---- + migrateAzMigratePWSHTc8d1sitepolicy Microsoft.RecoveryServices/vaults/replicationPolicies +``` + +Get a specific one. + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```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 +``` + +### -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: (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 +Azure Subscription Id in which migrate project was created. + +```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.Migrate.Models.Api202301.IPolicy + +## NOTES + +## RELATED LINKS + diff --git a/src/Migrate/Migrate.Autorest/help/Get-AzMigrateReplicationProtectionContainer.md b/src/Migrate/Migrate.Autorest/help/Get-AzMigrateReplicationProtectionContainer.md new file mode 100644 index 000000000000..ed49cba9199d --- /dev/null +++ b/src/Migrate/Migrate.Autorest/help/Get-AzMigrateReplicationProtectionContainer.md @@ -0,0 +1,170 @@ +--- +external help file: +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratereplicationprotectioncontainer +schema: 2.0.0 +--- + +# Get-AzMigrateReplicationProtectionContainer + +## SYNOPSIS +Gets the details of a protection container. + +## SYNTAX + +### List1 (Default) +``` +Get-AzMigrateReplicationProtectionContainer -ResourceGroupName -ResourceName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzMigrateReplicationProtectionContainer -FabricName -ProtectionContainerName + -ResourceGroupName -ResourceName [-SubscriptionId ] [-DefaultProfile ] + [] +``` + +### List +``` +Get-AzMigrateReplicationProtectionContainer -FabricName -ResourceGroupName + -ResourceName [-SubscriptionId ] [-DefaultProfile ] [] +``` + +## DESCRIPTION +Gets the details of a protection container. + +## EXAMPLES + +### Example 1: List all protection containers in vault and fabric +```powershell +Get-AzMigrateReplicationProtectionContainer -ResourceGroupName azmigratepwshtestasr13072020 -ResourceName AzMigrateTestProjectPWSH02aarsvault -FabricName AzMigratePWSHTc8d1replicationfabric +``` + +```output +Location Name Type +-------- ---- ---- + AzMigratePWSHTc8d1replicationcontainer Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers +``` + +Lists all. + +### Example 2: Get a specific container +```powershell +Get-AzMigrateReplicationProtectionContainer -ResourceGroupName azmigratepwshtestasr13072020 -ResourceName AzMigrateTestProjectPWSH02aarsvault -FabricName AzMigratePWSHTc8d1replicationfabric -ProtectionContainerName AzMigratePWSHTc8d1replicationcontainer +``` + +```output +Location Name Type +-------- ---- ---- + AzMigratePWSHTc8d1replicationcontainer Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers +``` + +Gets a specific one. + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```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 +``` + +### -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: (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 +Azure Subscription Id in which migrate project was created. + +```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.Migrate.Models.Api202301.IProtectionContainer + +## NOTES + +## RELATED LINKS + diff --git a/src/Migrate/Migrate.Autorest/help/Get-AzMigrateReplicationProtectionContainerMapping.md b/src/Migrate/Migrate.Autorest/help/Get-AzMigrateReplicationProtectionContainerMapping.md new file mode 100644 index 000000000000..90894e594f53 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/help/Get-AzMigrateReplicationProtectionContainerMapping.md @@ -0,0 +1,173 @@ +--- +external help file: +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratereplicationprotectioncontainermapping +schema: 2.0.0 +--- + +# Get-AzMigrateReplicationProtectionContainerMapping + +## SYNOPSIS +Gets the details of a protection container mapping. + +## SYNTAX + +### List1 (Default) +``` +Get-AzMigrateReplicationProtectionContainerMapping -ResourceGroupName -ResourceName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzMigrateReplicationProtectionContainerMapping -FabricName -MappingName + -ProtectionContainerName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### List +``` +Get-AzMigrateReplicationProtectionContainerMapping -FabricName -ProtectionContainerName + -ResourceGroupName -ResourceName [-SubscriptionId ] [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Gets the details of a protection container mapping. + +## EXAMPLES + +### Example 1: Get a specific mapping +```powershell +Get-AzMigrateReplicationProtectionContainerMapping -ResourceGroupName azmigratepwshtestasr13072020 -ResourceName AzMigrateTestProjectPWSH02aarsvault -FabricName AzMigratePWSHTc8d1replicationfabric -ProtectionContainerName AzMigratePWSHTc8d1replicationcontainer -MappingName "containermapping" +``` + +```output +Location Name Type +-------- ---- ---- + containermapping Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectionContainerMappings +``` + +Get a mapping detail. + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```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 +``` + +### -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: (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 +Azure Subscription Id in which migrate project was created. + +```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.Migrate.Models.Api202301.IProtectionContainerMapping + +## NOTES + +## RELATED LINKS + diff --git a/src/Migrate/Migrate.Autorest/help/Get-AzMigrateReplicationRecoveryServicesProvider.md b/src/Migrate/Migrate.Autorest/help/Get-AzMigrateReplicationRecoveryServicesProvider.md new file mode 100644 index 000000000000..e52bd6ff478f --- /dev/null +++ b/src/Migrate/Migrate.Autorest/help/Get-AzMigrateReplicationRecoveryServicesProvider.md @@ -0,0 +1,151 @@ +--- +external help file: +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratereplicationrecoveryservicesprovider +schema: 2.0.0 +--- + +# Get-AzMigrateReplicationRecoveryServicesProvider + +## SYNOPSIS +Gets the details of registered recovery services provider. + +## SYNTAX + +### List (Default) +``` +Get-AzMigrateReplicationRecoveryServicesProvider -ResourceGroupName -ResourceName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzMigrateReplicationRecoveryServicesProvider -FabricName -ProviderName + -ResourceGroupName -ResourceName [-SubscriptionId ] [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Gets the details of registered recovery services provider. + +## EXAMPLES + +### Example 1: Get all providers in vault +```powershell +Get-AzMigrateReplicationRecoveryServicesProvider -ResourceGroupName azmigratepwshtestasr13072020 -ResourceName AzMigrateTestProjectPWSH02aarsvault +``` + +```output +Location Name Type +-------- ---- ---- + AzMigratePWSHTc8d1dra Microsoft.RecoveryServices/vaults/replicationFabrics/replicationRecoveryServicesProviders +``` + +List all. + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```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 +``` + +### -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: (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 +Azure Subscription Id in which migrate project was created. + +```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.Migrate.Models.Api202301.IRecoveryServicesProvider + +## NOTES + +## RELATED LINKS + diff --git a/src/Migrate/Migrate.Autorest/help/Get-AzMigrateRunAsAccount.md b/src/Migrate/Migrate.Autorest/help/Get-AzMigrateRunAsAccount.md new file mode 100644 index 000000000000..f36b5737a2d8 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/help/Get-AzMigrateRunAsAccount.md @@ -0,0 +1,149 @@ +--- +external help file: +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/get-azmigraterunasaccount +schema: 2.0.0 +--- + +# Get-AzMigrateRunAsAccount + +## SYNOPSIS +Method to get run as account. + +## SYNTAX + +### List (Default) +``` +Get-AzMigrateRunAsAccount -ResourceGroupName -SiteName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzMigrateRunAsAccount -AccountName -ResourceGroupName -SiteName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +## DESCRIPTION +Method to get run as account. + +## EXAMPLES + +### Example 1: List (Default) +```powershell +Get-AzMigrateRunAsAccount -SubscriptionId xxx-xxx-xxx -ResourceGroupName BugBashAVSVMware -SiteName BBVMwareAVScbbcsite +``` + +```output +Name Type +---- ---- +b090bef3-b733-5e34-bc8f-eb6f2701432a Microsoft.OffAzure/VMwareSites/runasaccounts +``` + +List all run as accounts in a site. + +### Example 2: Get +```powershell +Get-AzMigrateRunAsAccount -SubscriptionId xxx-xxx-xxx -ResourceGroupName BugBashAVSVMware -SiteName BBVMwareAVScbbcsite -AccountName b090bef3-b733-5e34-bc8f-eb6f2701432a +``` + +```output +Name Type +---- ---- +b090bef3-b733-5e34-bc8f-eb6f2701432a Microsoft.OffAzure/VMwareSites/runasaccounts +``` + +Get Run as account by name. + +## PARAMETERS + +### -AccountName +Run as account ARM name. + +```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 DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```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 +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SiteName +Site 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 ID of the target subscription. + +```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.Migrate.Models.Api202001.IVMwareRunAsAccount + +## NOTES + +## RELATED LINKS + diff --git a/src/Migrate/Migrate.Autorest/help/Get-AzMigrateServerReplication.md b/src/Migrate/Migrate.Autorest/help/Get-AzMigrateServerReplication.md new file mode 100644 index 000000000000..0d3d470d7f5b --- /dev/null +++ b/src/Migrate/Migrate.Autorest/help/Get-AzMigrateServerReplication.md @@ -0,0 +1,413 @@ +--- +external help file: +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/get-azmigrateserverreplication +schema: 2.0.0 +--- + +# Get-AzMigrateServerReplication + +## SYNOPSIS +Retrieves the details of the replicating server. + +## SYNTAX + +### ListByName (Default) +``` +Get-AzMigrateServerReplication -ProjectName -ResourceGroupName [-SubscriptionId ] + [-Filter ] [-SkipToken ] [-DefaultProfile ] [] +``` + +### GetByInputObject +``` +Get-AzMigrateServerReplication -InputObject [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### GetByMachineName +``` +Get-AzMigrateServerReplication -MachineName -ProjectName -ResourceGroupName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### GetBySDSID +``` +Get-AzMigrateServerReplication -DiscoveredMachineId [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### GetBySRSID +``` +Get-AzMigrateServerReplication -TargetObjectID [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### ListById +``` +Get-AzMigrateServerReplication -ProjectID -ResourceGroupID [-SubscriptionId ] + [-Filter ] [-SkipToken ] [-DefaultProfile ] [] +``` + +## DESCRIPTION +The Get-AzMigrateServerReplication cmdlet retrieves the object for the replicating server. + +## EXAMPLES + +### Example 1: Get details by id +```powershell +Get-AzMigrateServerReplication -TargetObjectID '/Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.RecoveryServices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationFabrics/AzMigratePWSHTc8d1replicationfabric/replicationProtectionContainers/AzMigratePWSHTc8d1replicationcontainer/replicationMigrationItems/bcdr-vcenter-fareast-corp-micro-cfcc5a24-a40e-56b9-a6af-e206c9ca4f93_50063baa-9806-d6d6-7e09-c0ae87309b4f' +``` + +```output +AllowedOperation : {DisableMigration, TestMigrate, Migrate} +CurrentJobId : /Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.RecoveryServ + ices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationJobs/None +CurrentJobName : None +CurrentJobStartTime : 1/1/53 1:01:01 AM +EventCorrelationId : d8b110c6-3be9-4798-b2d4-9a1cd068adfb +Health : Normal +HealthError : {101883a0-23f7-538a-bbd5-6d8b4fa900e2} +Id : /Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.RecoveryServ + ices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationFabrics/AzMigratePWSHTc8d1replicationfabric/replicationProtectionCont + ainers/AzMigratePWSHTc8d1replicationcontainer/replicationMigrationItems/bcdr-vcenter-fareast-corp-micro-cfcc5a24-a40e-56b9-a6af- + e206c9ca4f93_50063baa-9806-d6d6-7e09-c0ae87309b4f +LastTestMigrationStatus : +LastTestMigrationTime : +Location : +MachineName : prsadhu-TestVM +MigrationState : Replicating +MigrationStateDescription : Ready to migrate +Name : bcdr-vcenter-fareast-corp-micro-cfcc5a24-a40e-56b9-a6af-e206c9ca4f93_50063baa-9806-d6d6-7e09-c0ae87309b4f +PolicyFriendlyName : migrateAzMigratePWSHTc8d1sitepolicy +PolicyId : /Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.RecoveryServ + ices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationPolicies/migrateAzMigratePWSHTc8d1sitepolicy +ProviderSpecificDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.VMwareCbtMigrationDetails +TestMigrateState : None +TestMigrateStateDescription : None +Type : Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationMigrationItems +``` + +Get by id. + +### Example 2: List all in project by id. +```powershell +Get-AzMigrateServerReplication -ResourceGroupID /Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020 -ProjectID "/subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.Migrate/MigrateProjects/AzMigrateTestProjectPWSH" +``` + +```output +AllowedOperation : {DisableMigration, TestMigrate, Migrate} +CurrentJobId : /Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.RecoveryServ + ices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationJobs/None +CurrentJobName : None +CurrentJobStartTime : 1/1/53 1:01:01 AM +EventCorrelationId : d8b110c6-3be9-4798-b2d4-9a1cd068adfb +Health : Normal +HealthError : {101883a0-23f7-538a-bbd5-6d8b4fa900e2} +Id : /Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.RecoveryServ + ices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationFabrics/AzMigratePWSHTc8d1replicationfabric/replicationProtectionCont + ainers/AzMigratePWSHTc8d1replicationcontainer/replicationMigrationItems/bcdr-vcenter-fareast-corp-micro-cfcc5a24-a40e-56b9-a6af- + e206c9ca4f93_50063baa-9806-d6d6-7e09-c0ae87309b4f +LastTestMigrationStatus : +LastTestMigrationTime : +Location : +MachineName : prsadhu-TestVM +MigrationState : Replicating +MigrationStateDescription : Ready to migrate +Name : bcdr-vcenter-fareast-corp-micro-cfcc5a24-a40e-56b9-a6af-e206c9ca4f93_50063baa-9806-d6d6-7e09-c0ae87309b4f +PolicyFriendlyName : migrateAzMigratePWSHTc8d1sitepolicy +PolicyId : /Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.RecoveryServ + ices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationPolicies/migrateAzMigratePWSHTc8d1sitepolicy +ProviderSpecificDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.VMwareCbtMigrationDetails +TestMigrateState : None +TestMigrateStateDescription : None +Type : Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationMigrationItems + +AllowedOperation : {DisableMigration, TestMigrate, Migrate} +CurrentJobId : /Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.RecoveryServ + ices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationJobs/None +CurrentJobName : None +CurrentJobStartTime : 1/1/53 1:01:01 AM +EventCorrelationId : 57b59212-6a2f-4333-8882-461647bb05f9 +Health : Normal +HealthError : {593b735d-2a34-53b2-b8ed-e33da5650703} +Id : /Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.RecoveryServ + ices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationFabrics/AzMigratePWSHTc8d1replicationfabric/replicationProtectionCont + ainers/AzMigratePWSHTc8d1replicationcontainer/replicationMigrationItems/bcdr-vcenter-fareast-corp-micro-cfcc5a24-a40e-56b9-a6af- + e206c9ca4f93_500f44f8-2aa3-587b-8958-ead358639629 +LastTestMigrationStatus : +LastTestMigrationTime : +Location : +MachineName : rb-w2k12r2-1 +MigrationState : Replicating +MigrationStateDescription : Ready to migrate +Name : bcdr-vcenter-fareast-corp-micro-cfcc5a24-a40e-56b9-a6af-e206c9ca4f93_500f44f8-2aa3-587b-8958-ead358639629 +PolicyFriendlyName : migrateAzMigratePWSHTc8d1sitepolicy +PolicyId : /Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.RecoveryServ + ices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationPolicies/migrateAzMigratePWSHTc8d1sitepolicy +ProviderSpecificDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.VMwareCbtMigrationDetails +TestMigrateState : None +TestMigrateStateDescription : None +Type : Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationMigrationItems +``` + +List all. + +### Example 3: List all in project by name. +```powershell +Get-AzMigrateServerReplication -ResourceGroupName azmigratepwshtestasr13072020 -ProjectName AzMigrateTestProjectPWSH +``` + +```output +AllowedOperation : {DisableMigration, TestMigrate, Migrate} +CurrentJobId : /Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.RecoveryServ + ices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationJobs/None +CurrentJobName : None +CurrentJobStartTime : 1/1/53 1:01:01 AM +EventCorrelationId : d8b110c6-3be9-4798-b2d4-9a1cd068adfb +Health : Normal +HealthError : {101883a0-23f7-538a-bbd5-6d8b4fa900e2} +Id : /Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.RecoveryServ + ices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationFabrics/AzMigratePWSHTc8d1replicationfabric/replicationProtectionCont + ainers/AzMigratePWSHTc8d1replicationcontainer/replicationMigrationItems/bcdr-vcenter-fareast-corp-micro-cfcc5a24-a40e-56b9-a6af- + e206c9ca4f93_50063baa-9806-d6d6-7e09-c0ae87309b4f +LastTestMigrationStatus : +LastTestMigrationTime : +Location : +MachineName : prsadhu-TestVM +MigrationState : Replicating +MigrationStateDescription : Ready to migrate +Name : bcdr-vcenter-fareast-corp-micro-cfcc5a24-a40e-56b9-a6af-e206c9ca4f93_50063baa-9806-d6d6-7e09-c0ae87309b4f +PolicyFriendlyName : migrateAzMigratePWSHTc8d1sitepolicy +PolicyId : /Subscriptions/7xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.RecoveryServ + ices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationPolicies/migrateAzMigratePWSHTc8d1sitepolicy +ProviderSpecificDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.VMwareCbtMigrationDetails +TestMigrateState : None +TestMigrateStateDescription : None +Type : Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationMigrationItems + +AllowedOperation : {DisableMigration, TestMigrate, Migrate} +CurrentJobId : /Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.RecoveryServ + ices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationJobs/None +CurrentJobName : None +CurrentJobStartTime : 1/1/53 1:01:01 AM +EventCorrelationId : 57b59212-6a2f-4333-8882-461647bb05f9 +Health : Normal +HealthError : {593b735d-2a34-53b2-b8ed-e33da5650703} +Id : /Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.RecoveryServ + ices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationFabrics/AzMigratePWSHTc8d1replicationfabric/replicationProtectionCont + ainers/AzMigratePWSHTc8d1replicationcontainer/replicationMigrationItems/bcdr-vcenter-fareast-corp-micro-cfcc5a24-a40e-56b9-a6af- + e206c9ca4f93_500f44f8-2aa3-587b-8958-ead358639629 +LastTestMigrationStatus : +LastTestMigrationTime : +Location : +MachineName : rb-w2k12r2-1 +MigrationState : Replicating +MigrationStateDescription : Ready to migrate +Name : bcdr-vcenter-fareast-corp-micro-cfcc5a24-a40e-56b9-a6af-e206c9ca4f93_500f44f8-2aa3-587b-8958-ead358639629 +PolicyFriendlyName : migrateAzMigratePWSHTc8d1sitepolicy +PolicyId : /Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.RecoveryServ + ices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationPolicies/migrateAzMigratePWSHTc8d1sitepolicy +ProviderSpecificDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.VMwareCbtMigrationDetails +TestMigrateState : None +TestMigrateStateDescription : None +Type : Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationMigrationItems +``` + +List all. + +## 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 +``` + +### -DiscoveredMachineId +Specifies the machine ID of the discovered server. + +```yaml +Type: System.String +Parameter Sets: GetBySDSID +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: ListById, ListByName +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Specifies the machine object of the replicating server. +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem +Parameter Sets: GetByInputObject +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MachineName +Specifies the display name of the replicating machine. + +```yaml +Type: System.String +Parameter Sets: GetByMachineName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProjectID +Specifies the Azure Migrate Project in which servers are replicating. + +```yaml +Type: System.String +Parameter Sets: ListById +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProjectName +Specifies the Azure Migrate project in the current subscription. + +```yaml +Type: System.String +Parameter Sets: GetByMachineName, ListByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupID +Specifies the Resource Group of the Azure Migrate Project in the current subscription. + +```yaml +Type: System.String +Parameter Sets: ListById +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +Specifies the Resource Group of the Azure Migrate Project in the current subscription. + +```yaml +Type: System.String +Parameter Sets: GetByMachineName, ListByName +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: ListById, ListByName +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure 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 +``` + +### -TargetObjectID +Specifies the replicating server. + +```yaml +Type: System.String +Parameter Sets: GetBySRSID +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 + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem + +## NOTES + +## RELATED LINKS + diff --git a/src/Migrate/Migrate.Autorest/help/Get-AzMigrateSite.md b/src/Migrate/Migrate.Autorest/help/Get-AzMigrateSite.md new file mode 100644 index 000000000000..8c7266aa8535 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/help/Get-AzMigrateSite.md @@ -0,0 +1,115 @@ +--- +external help file: +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratesite +schema: 2.0.0 +--- + +# Get-AzMigrateSite + +## SYNOPSIS +Method to get a site. + +## SYNTAX + +``` +Get-AzMigrateSite -Name -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +## DESCRIPTION +Method to get a site. + +## EXAMPLES + +### Example 1: Get (Default) +```powershell +Get-AzMigrateSite -SubscriptionId xxx-xxx-xxx -ResourceGroupName BugBashAVSVMware -SiteName BBVMwareAVScbbcsite +``` + +```output +ETag Location Name Type +---- -------- ---- ---- + southeastasia BBVMwareAVScbbcsite Microsoft.OffAzure/VMwareSites + +``` + +Get site by name + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```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 +``` + +### -Name +Site name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: SiteName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```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 ID of the target subscription. + +```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.Migrate.Models.Api202001.IVMwareSite + +## NOTES + +## RELATED LINKS + diff --git a/src/Migrate/Migrate.Autorest/help/Get-AzMigrateSolution.md b/src/Migrate/Migrate.Autorest/help/Get-AzMigrateSolution.md new file mode 100644 index 000000000000..54a477416235 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/help/Get-AzMigrateSolution.md @@ -0,0 +1,128 @@ +--- +external help file: +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratesolution +schema: 2.0.0 +--- + +# Get-AzMigrateSolution + +## SYNOPSIS +Gets a solution in the migrate project. + +## SYNTAX + +``` +Get-AzMigrateSolution -MigrateProjectName -Name -ResourceGroupName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +## DESCRIPTION +Gets a solution in the migrate project. + +## EXAMPLES + +### Example 1: Get +```powershell +Get-AzMigrateSolution -SubscriptionId xxx-xxx-xxx -ResourceGroupName BugBashAVSVMware -MigrateProjectName BugBashAVSVMware -Name Servers-Migration-ServerMigration +``` + +```output +Etag Name Type +---- ---- ---- +"010097f1-0000-1800-0000-5ee9ae2b0000" Servers-Migration-ServerMigration Microsoft.Migrate/MigrateProjec… +``` + +Get Migrate project solution by name. + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```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 +``` + +### -MigrateProjectName +Name of the Azure Migrate project. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Unique name of a migration solution within a migrate project. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: SolutionName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +Name of the Azure Resource Group that migrate project is part of. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure Subscription Id in which migrate project was created. + +```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.Migrate.Models.Api20180901Preview.ISolution + +## NOTES + +## RELATED LINKS + diff --git a/src/Migrate/Migrate.Autorest/help/Initialize-AzMigrateHCIReplicationInfrastructure.md b/src/Migrate/Migrate.Autorest/help/Initialize-AzMigrateHCIReplicationInfrastructure.md new file mode 100644 index 000000000000..a7c5894bd4bd --- /dev/null +++ b/src/Migrate/Migrate.Autorest/help/Initialize-AzMigrateHCIReplicationInfrastructure.md @@ -0,0 +1,217 @@ +--- +external help file: +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/initialize-azmigratehcireplicationinfrastructure +schema: 2.0.0 +--- + +# Initialize-AzMigrateHCIReplicationInfrastructure + +## SYNOPSIS +Initializes the infrastructure for the migrate project. + +## SYNTAX + +``` +Initialize-AzMigrateHCIReplicationInfrastructure -ProjectName -ResourceGroupName + -SourceApplianceName -TargetApplianceName [-CacheStorageAccountId ] + [-SubscriptionId ] [-DefaultProfile ] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The Initialize-AzMigrateHCIReplicationInfrastructure cmdlet initializes the infrastructure for the migrate project in AzStackHCI scenario. + +## EXAMPLES + +### Example 1: Initialize AzStackHCI replication infrastructure +```powershell +Initialize-AzMigrateHCIReplicationInfrastructure -ProjectName "testproj" -ResourceGroupName "test-rg" -SourceApplianceName "testsrcapp" -TargetApplianceName "testtgtapp" -PassThru:$true +``` + +```output +$true +``` + +Initialize AzStackHCI replication infrastructure. +Cache storage account, replication policy, and replication extension will be created automatically. + +### Example 2: Initialize AzStackHCI replication infrastructure with custom cache storage account +```powershell +$cacheStorageAccountId = "/subscriptions/xxx-xxx-xxxx/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/testSa" + +Initialize-AzMigrateHCIReplicationInfrastructure -ProjectName "testproj" -ResourceGroupName "test-rg" -CacheStorageAccountId $cacheStorageAccountId -SourceApplianceName "testsrcapp" -TargetApplianceName "testtgtapp" -PassThru:$true +``` + +```output +$true +``` + +Initialize AzStackHCI replication infrastructure with custom cache storage account. +Replication policy and replication extension will be created automatically. + +## PARAMETERS + +### -CacheStorageAccountId +Specifies the Storage Account ARM Id to be used for private endpoint scenario. + +```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 +``` + +### -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 +``` + +### -ProjectName +Specifies the name of the Azure Migrate project to be used for server migration. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +Specifies the Resource Group of the Azure Migrate Project in the current subscription. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SourceApplianceName +Specifies the source appliance name for the AzStackHCI scenario. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure 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 +``` + +### -TargetApplianceName +Specifies the target appliance name for the AzStackHCI scenario. + +```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 + +### System.Boolean + +## NOTES + +## RELATED LINKS + diff --git a/src/Migrate/Migrate.Autorest/help/Initialize-AzMigrateReplicationInfrastructure.md b/src/Migrate/Migrate.Autorest/help/Initialize-AzMigrateReplicationInfrastructure.md new file mode 100644 index 000000000000..32e4cc529376 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/help/Initialize-AzMigrateReplicationInfrastructure.md @@ -0,0 +1,198 @@ +--- +external help file: +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/initialize-azmigratereplicationinfrastructure +schema: 2.0.0 +--- + +# Initialize-AzMigrateReplicationInfrastructure + +## SYNOPSIS +Initialises the infrastructure for the migrate project. + +## SYNTAX + +``` +Initialize-AzMigrateReplicationInfrastructure -ProjectName -ResourceGroupName + -Scenario -TargetRegion [-CacheStorageAccountId ] [-SubscriptionId ] + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The Initialize-AzMigrateReplicationInfrastructure cmdlet initialises the infrastructure for the migrate project. + +## EXAMPLES + +### Example 1: Initialises the infrastructure for the migrate project. +```powershell +Initialize-AzMigrateReplicationInfrastructure -ResourceGroupName TestRG -ProjectName TestProject -TargetRegion centralus +``` + +```output +True +``` + +Initialises the infrastructure for the migrate project. + +### Example 2: Initialises the infrastructure for the migrate project for private endpoint scenario. +```powershell +Initialize-AzMigrateReplicationInfrastructure -ResourceGroupName "TestRG" -ProjectName "TestPEProject" -TargetRegion "centraluseuap" -Scenario "agentlessVMware" -CacheStorageAccountId "/subscriptions/b364ed8d-4279-4bf8-8fd1-56f8fa0ae05c/resourceGroups/singhabh-rg/providers/Microsoft.Storage/storageAccounts/singhabhstoragepe1" +``` + +```output +True +``` + +Initialises the infrastructure for the migrate project for private endpoint scenario. + +## PARAMETERS + +### -CacheStorageAccountId +Specifies the Storage Account Id to be used for private endpoint scenario. + +```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 +``` + +### -ProjectName +Specifies the name of the Azure Migrate project to be used for server migration. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +Specifies the Resource Group of the Azure Migrate Project in the current subscription. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Scenario +Specifies the server migration scenario for which the replication infrastructure needs to be initialized. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure 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 +``` + +### -TargetRegion +Specifies the target Azure region for server migrations. + +```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 + +### System.Boolean + +## NOTES + +## RELATED LINKS + diff --git a/src/Migrate/Migrate.Autorest/help/New-AzMigrateDiskMapping.md b/src/Migrate/Migrate.Autorest/help/New-AzMigrateDiskMapping.md new file mode 100644 index 000000000000..a875fb08a6fa --- /dev/null +++ b/src/Migrate/Migrate.Autorest/help/New-AzMigrateDiskMapping.md @@ -0,0 +1,112 @@ +--- +external help file: +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratediskmapping +schema: 2.0.0 +--- + +# New-AzMigrateDiskMapping + +## SYNOPSIS +Creates a new disk mapping + +## SYNTAX + +``` +New-AzMigrateDiskMapping -DiskID -DiskType -IsOSDisk + [-DiskEncryptionSetID ] [] +``` + +## DESCRIPTION +The New-AzMigrateDiskMapping cmdlet creates a mapping of the source disk attached to the server to be migrated + +## EXAMPLES + +### Example 1: Make disks +```powershell +New-AzMigrateDiskMapping -DiskID a -DiskType Standard -IsOSDisk 'true' +``` + +```output +DiskEncryptionSetId DiskId DiskType IsOSDisk LogStorageAccountId LogStorageAccountSasSecretName +------------------- ------ -------- -------- ------------------- ------------------------------ + a Standard true +``` + +Get disks object to provide input for New-AzMigrateServerReplication + +## PARAMETERS + +### -DiskEncryptionSetID +Specifies the disk encyption set to be used. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DiskID +Specifies the disk ID of the disk attached to the discovered server to be migrated. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DiskType +Specifies the type of disks to be used for the Azure VM. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IsOSDisk +Specifies whether the disk contains the Operating System for the source server to be migrated. + +```yaml +Type: System.String +Parameter Sets: (All) +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 + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IVMwareCbtDiskInput + +## NOTES + +## RELATED LINKS + diff --git a/src/Migrate/Migrate.Autorest/help/New-AzMigrateHCIDiskMappingObject.md b/src/Migrate/Migrate.Autorest/help/New-AzMigrateHCIDiskMappingObject.md new file mode 100644 index 000000000000..10d7b3d9e2db --- /dev/null +++ b/src/Migrate/Migrate.Autorest/help/New-AzMigrateHCIDiskMappingObject.md @@ -0,0 +1,130 @@ +--- +external help file: +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratehcidiskmappingobject +schema: 2.0.0 +--- + +# New-AzMigrateHCIDiskMappingObject + +## SYNOPSIS +Creates a new disk mapping + +## SYNTAX + +``` +New-AzMigrateHCIDiskMappingObject -DiskID -Format -IsDynamic -IsOSDisk + -Size [] +``` + +## DESCRIPTION +The New-AzMigrateHCIDiskMappingObject cmdlet creates a mapping of the source disk attached to the server to be migrated + +## EXAMPLES + +### Example 1: Creates Disk to migrate +```powershell +New-AzMigrateHCIDiskMappingObject -DiskID a -IsOSDisk true -IsDynamic true -Size 1 -Format VHDX +``` + +```output +DiskFileFormat : VHDX +DiskId : a +DiskSizeGb : 1 +IsDynamic : True +IsOSDisk : True +StorageContainerId : +``` + +Get disk object to provide input for New-AzMigrateHCIServerReplication + +## PARAMETERS + +### -DiskID +Specifies the disk ID of the disk attached to the discovered server to be migrated. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Format +Specifies the disk format. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IsDynamic +Specifies whether the disk is dynamic. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IsOSDisk +Specifies whether the disk contains the Operating System for the source server to be migrated. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Size +Specifies the disk size in GB. + +```yaml +Type: System.Int64 +Parameter Sets: (All) +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 + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHCIDiskInput + +## NOTES + +## RELATED LINKS + diff --git a/src/Migrate/Migrate.Autorest/help/New-AzMigrateHCINicMappingObject.md b/src/Migrate/Migrate.Autorest/help/New-AzMigrateHCINicMappingObject.md new file mode 100644 index 000000000000..e9ccdb6b7a0a --- /dev/null +++ b/src/Migrate/Migrate.Autorest/help/New-AzMigrateHCINicMappingObject.md @@ -0,0 +1,114 @@ +--- +external help file: +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratehcinicmappingobject +schema: 2.0.0 +--- + +# New-AzMigrateHCINicMappingObject + +## SYNOPSIS +Creates an object to update NIC properties of a replicating server. + +## SYNTAX + +``` +New-AzMigrateHCINicMappingObject -NicID -TargetVirtualSwitchId [-CreateAtTarget ] + [-TargetTestVirtualSwitchId ] [] +``` + +## DESCRIPTION +The New-AzMigrateHCINicMappingObject cmdlet creates a mapping of the source NIC attached to the server to be migrated. +This object is provided as an input to the Set-AzMigrateServerReplication cmdlet to update the NIC and its properties for a replicating server. + +## EXAMPLES + +### Example 1: Create NIC to migrate +```powershell +New-AzMigrateHCINicMappingObject -NicID a -TargetVirtualSwitchId "/subscriptions/xxx-xxx-xxx/resourceGroups/hciclus-rg/providers/Microsoft.AzureStackHCI/logicalnetworks/external" +``` + +```output +NicId : a +TargetNetworkId : /subscriptions/xxx-xxx-xxx/resourceGroups/hciclus-rg/providers/Microsoft.AzureStackHCI/logicalnetworks/external +TestNetworkId : /subscriptions/xxx-xxx-xxx/resourceGroups/hciclus-rg/providers/Microsoft.AzureStackHCI/logicalnetworks/external +SelectionTypeForFailover : SelectedByUser +``` + +Get NIC object to provide input for New-AzMigrateHCIServerReplication and Set-AzMigrateHCIServerReplication + +## PARAMETERS + +### -CreateAtTarget +Specifies whether the this Nic should be created at target. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NicID +Specifies the ID of the NIC to be updated. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetTestVirtualSwitchId +Specifies the test logical network ARM ID that the VMs will use. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetVirtualSwitchId +Specifies the logical network ARM ID that the VMs will use. + +```yaml +Type: System.String +Parameter Sets: (All) +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 + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHCINicInput + +## NOTES + +## RELATED LINKS + diff --git a/src/Migrate/Migrate.Autorest/help/New-AzMigrateHCIServerReplication.md b/src/Migrate/Migrate.Autorest/help/New-AzMigrateHCIServerReplication.md new file mode 100644 index 000000000000..f6b2d9f773c5 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/help/New-AzMigrateHCIServerReplication.md @@ -0,0 +1,379 @@ +--- +external help file: +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratehciserverreplication +schema: 2.0.0 +--- + +# New-AzMigrateHCIServerReplication + +## SYNOPSIS +Starts replication for the specified server. + +## SYNTAX + +### ByIdDefaultUser (Default) +``` +New-AzMigrateHCIServerReplication -MachineId -OSDiskID -TargetResourceGroupId + -TargetStoragePathId -TargetVirtualSwitchId -TargetVMName + [-IsDynamicMemoryEnabled ] [-SubscriptionId ] [-TargetTestVirtualSwitchId ] + [-TargetVMCPUCore ] [-TargetVMRam ] [-DefaultProfile ] [-Confirm] [-WhatIf] + [] +``` + +### ByIdPowerUser +``` +New-AzMigrateHCIServerReplication -DiskToInclude -MachineId + -NicToInclude -TargetResourceGroupId -TargetStoragePathId + -TargetVMName [-IsDynamicMemoryEnabled ] [-SubscriptionId ] + [-TargetVMCPUCore ] [-TargetVMRam ] [-DefaultProfile ] [-Confirm] [-WhatIf] + [] +``` + +## DESCRIPTION +The New-AzMigrateHCIServerReplication cmdlet starts the replication for a particular discovered server in the Azure Migrate project. + +## EXAMPLES + +### Example 1: When there is only OS disk to migrate +```powershell +New-AzMigrateHCIServerReplication -MachineId "/subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.OffAzure/HyperVSites/testsrc7972site/machines/005-005-005" -OSDiskID "Microsoft:0EC082D5-6827-457A-BAE2-F986E1B94851\83F8638B-8DCA-4152-9EDA-2CA8B33039B4\0\0\L" -TargetStoragePathId "/subscriptions/xxx-xxx-xxx/resourceGroups/hciclus-rg/providers/Microsoft.AzureStackHCI/storagecontainers/testStorageContainer1" -TargetVirtualSwitchId "/subscriptions/xxx-xxx-xxx/resourceGroups/hciclus-rg/providers/Microsoft.AzureStackHCI/logicalnetworks/external" -TargetResourceGroupId "/subscriptions//xxx-xxx-xxx/resourceGroups/target-rg"-TargetVMName "targetVM" +``` + +```output +ActivityId : ActivityId: 00000000-0000-0000-0000-000000000000 +AllowedAction : {} +CustomPropertyAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetails +CustomPropertyInstanceType : WorkflowDetails +DisplayName : Create or update protected item +EndTime : 1/1/1900 8:54:47 PM +Error : {} +Id : /subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/jobs/f2d3430a-2977-419f-abd5-11d171e17f5e +Name : f2d3430a-2977-419f-abd5-11d171e17f5e +ObjectId : /subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94555 +ObjectInternalId : a8b5ee68-102c-5aae-9499-c57a475a8fd4 +ObjectInternalName : test_vm +ObjectName : 0ec082d5-6827-457a-bae2-f986e1b94555 +ObjectType : ProtectedItem +ReplicationProviderId : xxx-xxx-xxx +SourceFabricProviderId : b35da11c-d69e-4220-9a90-d81ed93ad2fc +StartTime : 1/1/1900 8:49:27 PM +State : Succeeded +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelTags +TargetFabricProviderId : 22f00372-a1b7-467f-87ce-d95e17a6e7c7 +Task : {Creating or updating the protected item, Initializing Protection, Enabling Protection, Starting Replication} +Type : Microsoft.DataReplication/replicationVaults/jobs +``` + +This is for the scenario, when there is only one single disk that has to be protected. + +### Example 2: When there are multiple disks or NICs to migrate +```powershell +[AzStackHCIDiskInput[]]$DisksToInclude = @() +$OSDisk = New-AzMigrateHCIDiskMappingObject -DiskID "Microsoft:C1A34301-3BFF-4EC6-97F1-6C4BD5ADCDE0\83F8638B-8DCA-4152-9EDA-2CA8B33039B4\0\0\L" -IsOSDisk true -IsDynamic true -Size 42 -Format VHD +$DataDisk = New-AzMigrateHCIDiskMappingObject -DiskID "Microsoft:C1A34301-3BFF-4EC6-97F1-6C4BD5ADCDE0\C92FAB89-DA8B-47E9-92F3-364642ECDF39\0\0\L" -IsOSDisk false -IsDynamic true -Size 5 -Format VHD +$DisksToInclude += $OSDisk +$DisksToInclude += $DataDisk + +[AzStackHCINicInput[]]$NicsToInclude = @() +$Nic = New-AzMigrateHCINicMappingObject -NicID "Microsoft:C1A34301-3BFF-4EC6-97F1-6C4BD5ADCDE0\99CDFD2E-D60C-4218-AC2E-E7C2D8253EB9" -TargetVirtualSwitchId "/subscriptions/xxx-xxx-xxx/resourceGroups/hciclus-rg/providers/Microsoft.AzureStackHCI/logicalnetworks/external" +$NicsToInclude += $Nic + +New-AzMigrateHCIServerReplication -MachineId "/subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.OffAzure/HyperVSites/testsrc7972site/machines/005-005-005" -TargetStoragePathId "/subscriptions/xxx-xxx-xxx/resourceGroups/hciclus-rg/providers/Microsoft.AzureStackHCI/storagecontainers/testStorageContainer1" -TargetResourceGroupId "/subscriptions//xxx-xxx-xxx/resourceGroups/target-rg"-TargetVMName "targetVM" -DiskToInclude $DisksToInclude -NicToInclude $NicsToInclude +``` + +```output +ActivityId : ActivityId: 00000000-0000-0000-0000-000000000000 +AllowedAction : {} +CustomPropertyAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetails +CustomPropertyInstanceType : WorkflowDetails +DisplayName : Create or update protected item +EndTime : 1/1/1900 2:27:14 PM +Error : {} +Id : /subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/jobs/f855305c-5bed-4bc6-996e-d273115ab833 +Name : f855305c-5bed-4bc6-996e-d273115ab833 +ObjectId : /subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/protectedItems/c1a34301-3bff-4ec6-97f1-6c4bd5adcde0 +ObjectInternalId : a40ecd8e-6413-574d-b1f8-2ef925e087fc +ObjectInternalName : test_vm +ObjectName : c1a34301-3bff-4ec6-97f1-6c4bd5adcde0 +ObjectType : ProtectedItem +ReplicationProviderId : 4de0fddc-bdfe-40d9-b60e-678bdce89630 +SourceFabricProviderId : b35da11c-d69e-4220-9a90-d81ed93ad2fc +StartTime : 1/1/1900 2:21:50 PM +State : Succeeded +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelTags +TargetFabricProviderId : 22f00372-a1b7-467f-87ce-d95e17a6e7c7 +Task : {Creating or updating the protected item, Initializing Protection, Enabling Protection, Starting Replication} +Type : Microsoft.DataReplication/replicationVaults/jobs +``` + +This is for the scenario, when there are multiple disks that has to be protected. + +## 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 +``` + +### -DiskToInclude +Specifies the disks on the source server to be included for replication. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHCIDiskInput[] +Parameter Sets: ByIdPowerUser +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IsDynamicMemoryEnabled +Specifies if RAM is dynamic or not. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MachineId +Specifies the machine ARM ID of the discovered server to be migrated. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NicToInclude +Specifies the NICs on the source server to be included for replication. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHCINicInput[] +Parameter Sets: ByIdPowerUser +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OSDiskID +Specifies the Operating System disk for the source server to be migrated. + +```yaml +Type: System.String +Parameter Sets: ByIdDefaultUser +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure 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 +``` + +### -TargetResourceGroupId +Specifies the target Resource Group Id where the migrated VM resources will reside. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetStoragePathId +Specifies the storage path ARM ID where the VMs will be stored. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetTestVirtualSwitchId +Specifies the test logical network ARM ID that the VMs will use. + +```yaml +Type: System.String +Parameter Sets: ByIdDefaultUser +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetVirtualSwitchId +Specifies the logical network ARM ID that the VMs will use. + +```yaml +Type: System.String +Parameter Sets: ByIdDefaultUser +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetVMCPUCore +Specifies the number of CPU cores. + +```yaml +Type: System.Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetVMName +Specifies the name of the VM to be created. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetVMRam +Specifies the target RAM size in MB. + +```yaml +Type: System.Int64 +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.Migrate.Models.Api20210216Preview.IWorkflowModel + +## NOTES + +## RELATED LINKS + diff --git a/src/Migrate/Migrate.Autorest/help/New-AzMigrateNicMapping.md b/src/Migrate/Migrate.Autorest/help/New-AzMigrateNicMapping.md new file mode 100644 index 000000000000..9e611274f09e --- /dev/null +++ b/src/Migrate/Migrate.Autorest/help/New-AzMigrateNicMapping.md @@ -0,0 +1,159 @@ +--- +external help file: +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratenicmapping +schema: 2.0.0 +--- + +# New-AzMigrateNicMapping + +## SYNOPSIS +Creates an object to update NIC properties of a replicating server. + +## SYNTAX + +``` +New-AzMigrateNicMapping -NicID [-TargetNicIP ] [-TargetNicName ] + [-TargetNicSelectionType ] [-TargetNicSubnet ] [-TestNicIP ] + [-TestNicSubnet ] [] +``` + +## DESCRIPTION +The New-AzMigrateNicMapping cmdlet creates a mapping of the source NIC attached to the server to be migrated. +This object is provided as an input to the Set-AzMigrateServerReplication cmdlet to update the NIC and its properties for a replicating server. + +## EXAMPLES + +### Example 1: Create a NIC object +```powershell +New-AzMigrateNicMapping -NicID a2399354-653a-464e-a567-d30ef5467a31 -TargetNicSelectionType primary -TargetNicIP "172.17.1.17" +``` + +```output +IsPrimaryNic IsSelectedForMigration NicId TargetStaticIPAddress TargetSubnetName +------------ ---------------------- ----- --------------------- ---------------- +false false a2399354-653a-464e-a567-d30ef5467a31 +``` + +Creates a NIC update object. + +## PARAMETERS + +### -NicID +Specifies the ID of the NIC to be updated. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetNicIP +Specifies the IP within the destination subnet to be used for the NIC. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetNicName +Specifies the name of the NIC to be created. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetNicSelectionType +Specifies whether the NIC to be updated will be the primary, secondary or not migrated. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetNicSubnet +Specifies the Subnet name for the NIC in the destination Virtual Network to which the server needs to be migrated. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TestNicIP +Specifies the IP within the destination test subnet to be used for the NIC. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TestNicSubnet +Specifies the Subnet name for the NIC in the destination Virtual Network to which the server needs to be test migrated. + +```yaml +Type: System.String +Parameter Sets: (All) +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 + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IVMwareCbtNicInput + +## NOTES + +## RELATED LINKS + diff --git a/src/Migrate/Migrate.Autorest/help/New-AzMigrateProject.md b/src/Migrate/Migrate.Autorest/help/New-AzMigrateProject.md new file mode 100644 index 000000000000..acc0f929111a --- /dev/null +++ b/src/Migrate/Migrate.Autorest/help/New-AzMigrateProject.md @@ -0,0 +1,173 @@ +--- +external help file: +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/new-azmigrateproject +schema: 2.0.0 +--- + +# New-AzMigrateProject + +## SYNOPSIS +Creates a new Migrate project. + +## SYNTAX + +``` +New-AzMigrateProject -Location -Name -ResourceGroupName [-ETag ] + [-Property ] [-SubscriptionId ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Creates a new Migrate project. + +## EXAMPLES + +### Example 1: Create (Default) +```powershell +New-AzMigrateProject -SubscriptionId xxx-xxx-xxx -ResourceGroupName kuchaturimpkocrg1 -Name kuchaturimpkocrg1pwshp14 -Location "centralus" +``` + +```output +ETag Location Name Type +---- -------- ---- ---- + centralus kuchaturimpkocrg1pwshp14 Microsoft.Migrate/MigrateProjects + +``` + +Method to create a new migrate project. + +## PARAMETERS + +### -ETag +Specifies the VMware machine name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Location +Specifies the VMware machine name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Specifies the migrate project name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Property +Specifies the project properties. +To construct, see NOTES section for PROPERTY properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IMigrateProjectProperties +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +Specifies the resource group 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 +Specifies 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 + +## NOTES + +## RELATED LINKS + diff --git a/src/Migrate/Migrate.Autorest/help/New-AzMigrateReplicationPolicy.md b/src/Migrate/Migrate.Autorest/help/New-AzMigrateReplicationPolicy.md new file mode 100644 index 000000000000..8dbb1d7e0913 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/help/New-AzMigrateReplicationPolicy.md @@ -0,0 +1,212 @@ +--- +external help file: +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratereplicationpolicy +schema: 2.0.0 +--- + +# New-AzMigrateReplicationPolicy + +## SYNOPSIS +The operation to create a replication policy. + +## SYNTAX + +``` +New-AzMigrateReplicationPolicy -PolicyName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-ProviderSpecificInput ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The operation to create a replication policy. + +## EXAMPLES + +### Example 1: Create a replication policy +```powershell +$providerSpecificPolicy = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.VMwareCbtPolicyCreationInput]::new() +$providerSpecificPolicy.AppConsistentFrequencyInMinute = 240 +$providerSpecificPolicy.InstanceType = "VMwareCbt" +$providerSpecificPolicy.RecoveryPointHistoryInMinute = 4320 +$providerSpecificPolicy.CrashConsistentFrequencyInMinute = 60 +New-AzMigrateReplicationPolicy -PolicyName TestPolicy -ResourceGroupName ResourceGroup -ResourceName VaultName -SubscriptionId SubscriptionId -ProviderSpecificInput $providerSpecificPolicy +``` + +```output +Location Name Type +-------- ---- ---- + TestPolicy Microsoft.RecoveryServices/vaults/replicationPolicies + +``` + +Creates a policy for VmWare Cbt + +## 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 DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```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 +``` + +### -ProviderSpecificInput +The ReplicationProviderSettings. +To construct, see NOTES section for PROVIDERSPECIFICINPUT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IPolicyProviderSpecificInput +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 +Azure Subscription Id in which migrate project was created. + +```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.Migrate.Models.Api202301.IPolicy + +## NOTES + +## RELATED LINKS + diff --git a/src/Migrate/Migrate.Autorest/help/New-AzMigrateReplicationProtectionContainerMapping.md b/src/Migrate/Migrate.Autorest/help/New-AzMigrateReplicationProtectionContainerMapping.md new file mode 100644 index 000000000000..7c11d1971b3b --- /dev/null +++ b/src/Migrate/Migrate.Autorest/help/New-AzMigrateReplicationProtectionContainerMapping.md @@ -0,0 +1,278 @@ +--- +external help file: +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratereplicationprotectioncontainermapping +schema: 2.0.0 +--- + +# New-AzMigrateReplicationProtectionContainerMapping + +## SYNOPSIS +The operation to create a protection container mapping. + +## SYNTAX + +``` +New-AzMigrateReplicationProtectionContainerMapping -FabricName -MappingName + -ProtectionContainerName -ResourceGroupName -ResourceName + [-SubscriptionId ] [-PolicyId ] + [-ProviderSpecificInput ] + [-TargetProtectionContainerId ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] + [] +``` + +## DESCRIPTION +The operation to create a protection container mapping. + +## EXAMPLES + +### Example 1: Create a mapping +```powershell +$providerSpecificInput = [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.VMwareCbtContainerMappingInput]::new() +$providerSpecificInput.InstanceType = "VMwareCbt" +$providerSpecificInput.KeyVaultId = "/subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.KeyVault/vaults/migratekv846827101" +$providerSpecificInput.KeyVaultUri = "https://migratekv846827101.vault.azure.net" +$providerSpecificInput.ServiceBusConnectionStringSecretName = "ServiceBusConnectionString" +$providerSpecificInput.StorageAccountId = "/subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.Storage/storageAccounts/migrategwsa846827101" +$providerSpecificInput.StorageAccountSasSecretName = "migrategwsa846827101-gwySas" +$providerSpecificInput.TargetLocation = "centraluseuap" + +New-AzMigrateReplicationProtectionContainerMapping -FabricName "AzMigratePWSHTc8d1replicationfabric" -MappingName "containermapping" -ProtectionContainerName "AzMigratePWSHTc8d1replicationcontainer" -ResourceGroupName "azmigratepwshtestasr13072020" -ResourceName "AzMigrateTestProjectPWSH02aarsvault" -PolicyId "/subscriptionsxxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.RecoveryServices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationPolicies/migrateAzMigratePWSHTc8d1sitepolicy" -ProviderSpecificInput $providerSpecificInput -TargetProtectionContainerId "Microsoft Azure" +``` + +```output +Location Name Type +-------- ---- ---- + containermapping Microsoft.RecoveryServices/vaults/replicationFabrics/replicationProtectionContainers/replicationProtectionContainerMappings +``` + +Create a mapping + +## 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 DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```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 +``` + +### -ProviderSpecificInput +Provider specific input for pairing. +To construct, see NOTES section for PROVIDERSPECIFICINPUT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IReplicationProviderSpecificContainerMappingInput +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 +Azure Subscription Id in which migrate project was created. + +```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.Migrate.Models.Api202301.IProtectionContainerMapping + +## NOTES + +## RELATED LINKS + diff --git a/src/Migrate/Migrate.Autorest/help/New-AzMigrateServerReplication.md b/src/Migrate/Migrate.Autorest/help/New-AzMigrateServerReplication.md new file mode 100644 index 000000000000..15a664f7ef15 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/help/New-AzMigrateServerReplication.md @@ -0,0 +1,547 @@ +--- +external help file: +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/new-azmigrateserverreplication +schema: 2.0.0 +--- + +# New-AzMigrateServerReplication + +## SYNOPSIS +Starts replication for the specified server. + +## SYNTAX + +### ByIdDefaultUser (Default) +``` +New-AzMigrateServerReplication -DiskType -LicenseType -MachineId -OSDiskID + -TargetNetworkId -TargetResourceGroupId -TargetSubnetName -TargetVMName + [-DiskEncryptionSetID ] [-DiskTag ] + [-NicTag ] [-PerformAutoResync ] + [-SqlServerLicenseType ] [-SubscriptionId ] [-Tag ] + [-TargetAvailabilitySet ] [-TargetAvailabilityZone ] + [-TargetBootDiagnosticsStorageAccount ] [-TargetVMSize ] [-TestNetworkId ] + [-TestSubnetName ] [-VMTag ] + [-VMWarerunasaccountID ] [-DefaultProfile ] [] +``` + +### ByIdPowerUser +``` +New-AzMigrateServerReplication -DiskToInclude -LicenseType + -MachineId -TargetNetworkId -TargetResourceGroupId -TargetSubnetName + -TargetVMName [-DiskTag ] + [-NicTag ] [-PerformAutoResync ] + [-SqlServerLicenseType ] [-SubscriptionId ] [-Tag ] + [-TargetAvailabilitySet ] [-TargetAvailabilityZone ] + [-TargetBootDiagnosticsStorageAccount ] [-TargetVMSize ] [-TestNetworkId ] + [-TestSubnetName ] [-VMTag ] + [-VMWarerunasaccountID ] [-DefaultProfile ] [] +``` + +### ByInputObjectDefaultUser +``` +New-AzMigrateServerReplication -DiskType -InputObject -LicenseType + -OSDiskID -TargetNetworkId -TargetResourceGroupId -TargetSubnetName + -TargetVMName [-DiskEncryptionSetID ] + [-DiskTag ] + [-NicTag ] [-PerformAutoResync ] + [-SqlServerLicenseType ] [-SubscriptionId ] [-Tag ] + [-TargetAvailabilitySet ] [-TargetAvailabilityZone ] + [-TargetBootDiagnosticsStorageAccount ] [-TargetVMSize ] [-TestNetworkId ] + [-TestSubnetName ] [-VMTag ] + [-VMWarerunasaccountID ] [-DefaultProfile ] [] +``` + +### ByInputObjectPowerUser +``` +New-AzMigrateServerReplication -DiskToInclude -InputObject + -LicenseType -TargetNetworkId -TargetResourceGroupId -TargetSubnetName + -TargetVMName [-DiskTag ] + [-NicTag ] [-PerformAutoResync ] + [-SqlServerLicenseType ] [-SubscriptionId ] [-Tag ] + [-TargetAvailabilitySet ] [-TargetAvailabilityZone ] + [-TargetBootDiagnosticsStorageAccount ] [-TargetVMSize ] [-TestNetworkId ] + [-TestSubnetName ] [-VMTag ] + [-VMWarerunasaccountID ] [-DefaultProfile ] [] +``` + +## DESCRIPTION +The New-AzMigrateServerReplication cmdlet starts the replication for a particular discovered server in the Azure Migrate project. + +## EXAMPLES + +### Example 1: When there is only OS disk +```powershell +New-AzMigrateServerReplication -MachineId "/subscriptions/xxx-xxx-xxx4/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.OffAzure/VMwareSites/AzMigratePWSHTc8d1site/machines/bcdr-vcenter-fareast-corp-micro-cfcc5a24-a40e-56b9-a6af-e206c9ca4f93_50063baa-9806-d6d6-7e09-c0ae87309b4f" -LicenseType NoLicenseType -TargetResourceGroupId "/subscriptions/xxx-xxx-xxx/resourceGroups/AzMigratePWSHtargetRG" -TargetNetworkId "/subscriptions/xxx-xxx-xxx/resourceGroups/AzMigratePWSHtargetRG/providers/Microsoft.Network/virtualNetworks/AzMigrateTargetNetwork" -TargetSubnetName default -TargetVMName "prsadhu-TestVM" -DiskType "Standard_LRS" -OSDiskID "6000C299-343d-7bcd-c05e-a94bd63316dd" +``` + +```output +ActivityId : 68af14b4-46ae-48d1-b3e9-cdcffb9e8a93 ActivityId: 74d1a396-1d37-4264-8a5b-b727aaef0171 +AllowedAction : {} +CustomDetailAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.JobDetailsAffectedObjectDetails +CustomDetailInstanceType : AsrJobDetails +EndTime : 9/16/20 11:57:33 AM +Error : {} +FriendlyName : Enable +Id : /Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.Recover + yServices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationJobs/997e2a92-5afe-49c7-a81a-89660aec9b7b +Location : +Name : 997e2a92-5afe-49c7-a81a-89660aec9b7b +ScenarioName : Enable +StartTime : 9/16/20 11:57:32 AM +State : Succeeded +StateDescription : Completed +TargetInstanceType : ProtectionProfile +TargetObjectId : 42752b89-5fad-52fd-bf93-679fbdb6fed9 +TargetObjectName : migrateAzMigratePWSHTc8d1sitepolicy +Task : {CloudPairingPrerequisitesCheck, CloudPairingPrepareSite} +Type : Microsoft.RecoveryServices/vaults/replicationJobs +``` + +This is for the scenario, when there is only one single disk that has to be protected. + +### Example 2: When there are multiple disks +```powershell +$OSDisk = New-AzMigrateDiskMapping -DiskID '6000C299-343d-7bcd-c05e-a94bd63316dd' -DiskType 'Standard_LRS' -IsOSDisk 'true' +$DataDisk = New-AzMigrateDiskMapping -DiskID '7000C299-343d-7bcd-c05e-a94bd63316dd' -DiskType 'Standard_LRS' -IsOSDisk 'false' +$DisksToInclude += $OSDisk +$DisksToInclude += $DataDisk +New-AzMigrateServerReplication -MachineId "/subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.OffAzure/VMwareSites/AzMigratePWSHTc8d1site/machines/bcdr-vcenter-fareast-corp-micro-cfcc5a24-a40e-56b9-a6af-e206c9ca4f93_50063baa-9806-d6d6-7e09-c0ae87309b4f" -LicenseType NoLicenseType -TargetResourceGroupId "/subscriptions/xxx-xxx-xxx/resourceGroups/AzMigratePWSHtargetRG" -TargetNetworkId "/subscriptions/xxx-xxx-xxx/resourceGroups/AzMigratePWSHtargetRG/providers/Microsoft.Network/virtualNetworks/AzMigrateTargetNetwork" -TargetSubnetName default -TargetVMName "prsadhu-TestVM" -DiskToInclude $DisksToInclude -PerformAutoResync true +``` + +```output +ActivityId : 68af14b4-46ae-48d1-b3e9-cdcffb9e8a93 ActivityId: 74d1a396-1d37-4264-8a5b-b727aaef0171 +AllowedAction : {} +CustomDetailAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.JobDetailsAffectedObjectDetails +CustomDetailInstanceType : AsrJobDetails +EndTime : 9/16/20 11:57:33 AM +Error : {} +FriendlyName : Enable +Id : /Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.Recover + yServices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationJobs/997e2a92-5afe-49c7-a81a-89660aec9b7b +Location : +Name : 997e2a92-5afe-49c7-a81a-89660aec9b7b +ScenarioName : Enable +StartTime : 9/16/20 11:57:32 AM +State : Succeeded +StateDescription : Completed +TargetInstanceType : ProtectionProfile +TargetObjectId : 42752b89-5fad-52fd-bf93-679fbdb6fed9 +TargetObjectName : migrateAzMigratePWSHTc8d1sitepolicy +Task : {CloudPairingPrerequisitesCheck, CloudPairingPrepareSite} +Type : Microsoft.RecoveryServices/vaults/replicationJobs +``` + +This is for the scenario, when there are multiple disks that has to be protected. + +## 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 +``` + +### -DiskEncryptionSetID +Specifies the disk encyption set to be used. + +```yaml +Type: System.String +Parameter Sets: ByIdDefaultUser, ByInputObjectDefaultUser +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DiskTag +Specifies the tag to be used for disk creation. +To construct, see NOTES section for DISKTAG properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IVMwareCbtEnableMigrationInputTargetDiskTags +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DiskToInclude +Specifies the disks on the source server to be included for replication. +To construct, see NOTES section for DISKTOINCLUDE properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IVMwareCbtDiskInput[] +Parameter Sets: ByIdPowerUser, ByInputObjectPowerUser +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DiskType +Specifies the type of disks to be used for the Azure VM. + +```yaml +Type: System.String +Parameter Sets: ByIdDefaultUser, ByInputObjectDefaultUser +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Specifies the discovered server to be migrated. +The server object can be retrieved using the Get-AzMigrateServer cmdlet. +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVMwareMachine +Parameter Sets: ByInputObjectDefaultUser, ByInputObjectPowerUser +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -LicenseType +Specifies if Azure Hybrid benefit is applicable for the source server to be migrated. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MachineId +Specifies the machine ID of the discovered server to be migrated. + +```yaml +Type: System.String +Parameter Sets: ByIdDefaultUser, ByIdPowerUser +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NicTag +Specifies the tag to be used for NIC creation. +To construct, see NOTES section for NICTAG properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IVMwareCbtEnableMigrationInputTargetNicTags +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OSDiskID +Specifies the Operating System disk for the source server to be migrated. + +```yaml +Type: System.String +Parameter Sets: ByIdDefaultUser, ByInputObjectDefaultUser +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PerformAutoResync +Specifies if replication be auto-repaired in case change tracking is lost for the source server under replication. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SqlServerLicenseType +Specifies if Azure Hybrid benefit for SQL Server is applicable for the server to be migrated. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure 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 +``` + +### -Tag +Specifies the tag to be used for Resource creation. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetAvailabilitySet +Specifies the Availability Set to be used for VM creationSpecifies the Availability Set to be used for VM creation. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetAvailabilityZone +Specifies the Availability Zone to be used for VM creation. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetBootDiagnosticsStorageAccount +Specifies the storage account to be used for boot diagnostics. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetNetworkId +Specifies the Virtual Network id within the destination Azure subscription to which the server needs to be migrated. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetResourceGroupId +Specifies the Resource Group id within the destination Azure subscription to which the server needs to be migrated. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetSubnetName +Specifies the Subnet name within the destination Virtual Network to which the server needs to be migrated. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetVMName +Specifies the name of the Azure VM to be created. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetVMSize +Specifies the SKU of the Azure VM to be created. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TestNetworkId +Specifies the Virtual Network id within the destination Azure subscription to which the server needs to be test migrated. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TestSubnetName +Specifies the Subnet name within the destination Virtual Network to which the server needs to be test migrated. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VMTag +Specifies the tag to be used for VM creation. +To construct, see NOTES section for VMTAG properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IVMwareCbtEnableMigrationInputTargetVmtags +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VMWarerunasaccountID +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 +``` + +### 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.Migrate.Models.Api202301.IJob + +## NOTES + +## RELATED LINKS + diff --git a/src/Migrate/Migrate.Autorest/help/New-AzMigrateTestNicMapping.md b/src/Migrate/Migrate.Autorest/help/New-AzMigrateTestNicMapping.md new file mode 100644 index 000000000000..9478918f97ac --- /dev/null +++ b/src/Migrate/Migrate.Autorest/help/New-AzMigrateTestNicMapping.md @@ -0,0 +1,113 @@ +--- +external help file: +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratetestnicmapping +schema: 2.0.0 +--- + +# New-AzMigrateTestNicMapping + +## SYNOPSIS +Creates an object to update NIC properties of a test migrating server. + +## SYNTAX + +``` +New-AzMigrateTestNicMapping -NicID -TestNicSubnet [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The New-AzMigrateTestNicMapping cmdlet creates a mapping of the source NIC attached to the server to be test migrated. +This object is provided as an input to the Start-AzMigrateTestMigration cmdlet to update the NIC and its properties for a test migrating server. + +## EXAMPLES + +### Example 1: Create a NIC object for test migration. +```powershell +New-AzMigrateTestNicMapping -NicID a2399354-653a-464e-a567-d30ef5467a31 -TestNicSubnet subnet1 +``` + +```output +IsPrimaryNic IsSelectedForMigration NicId TargetNicName TargetStaticIPAddress TargetSubnetName TestStaticIPAddress TestSubnetName +------------ ---------------------- ----- ------------- --------------------- ---------------- ------------------- -------------- + a2399354-653a-464e-a567-d30ef5467a31 subnet1 +``` + +Creates a NIC object for test migration. + +## PARAMETERS + +### -NicID +Specifies the ID of the NIC to be updated. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TestNicSubnet +Specifies the Subnet name for the NIC in the destination Virtual Network to which the server needs to be test migrated. + +```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.Migrate.Models.Api202301.IVMwareCbtNicInput + +## NOTES + +## RELATED LINKS + diff --git a/src/Migrate/Migrate.Autorest/help/README.md b/src/Migrate/Migrate.Autorest/help/README.md new file mode 100644 index 000000000000..888608999710 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/help/README.md @@ -0,0 +1,11 @@ +# Docs +This directory contains the documentation of the cmdlets for the `Az.Migrate` 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.Migrate` 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/src/Migrate/Migrate.Autorest/help/Register-AzMigrateProjectTool.md b/src/Migrate/Migrate.Autorest/help/Register-AzMigrateProjectTool.md new file mode 100644 index 000000000000..c326e5a34428 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/help/Register-AzMigrateProjectTool.md @@ -0,0 +1,174 @@ +--- +external help file: +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/register-azmigrateprojecttool +schema: 2.0.0 +--- + +# Register-AzMigrateProjectTool + +## SYNOPSIS +Registers a tool with the migrate project. + +## SYNTAX + +``` +Register-AzMigrateProjectTool -MigrateProjectName -ResourceGroupName + [-SubscriptionId ] [-AcceptLanguage ] [-Tool ] [-DefaultProfile ] + [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Registers a tool with the migrate project. + +## EXAMPLES + +### Example 1: REgister tool. +```powershell +Register-AzMigrateProjectTool -SubscriptionId xxx-xxx-xxx -ResourceGroupName BugBashAVSVMware -MigrateProjectName BugBashAVSVMware -Tool Zerto +``` + +```output +True +``` + +Registers a tool with the migrate project. + +## PARAMETERS + +### -AcceptLanguage +Standard request header. +Used by service to respond to client in appropriate language. + +```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 DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```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 +``` + +### -MigrateProjectName +Name of the Azure Migrate project. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +Name of the Azure Resource Group that migrate project is part of. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure Subscription Id in which migrate project was created. + +```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 +``` + +### -Tool +Gets or sets the tool to be registered. + +```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 + +### System.Boolean + +## NOTES + +## RELATED LINKS + diff --git a/src/Migrate/Migrate.Autorest/help/Remove-AzMigrateHCIServerReplication.md b/src/Migrate/Migrate.Autorest/help/Remove-AzMigrateHCIServerReplication.md new file mode 100644 index 000000000000..6119150e772d --- /dev/null +++ b/src/Migrate/Migrate.Autorest/help/Remove-AzMigrateHCIServerReplication.md @@ -0,0 +1,238 @@ +--- +external help file: +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/remove-azmigratehciserverreplication +schema: 2.0.0 +--- + +# Remove-AzMigrateHCIServerReplication + +## SYNOPSIS +Stops replication for the migrated server. + +## SYNTAX + +### ByID (Default) +``` +Remove-AzMigrateHCIServerReplication -TargetObjectID [-SubscriptionId ] + [-ForceRemove ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### ByInputObject +``` +Remove-AzMigrateHCIServerReplication -InputObject [-SubscriptionId ] + [-ForceRemove ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The Remove-AzMigrateHCIServerReplication cmdlet stops the replication for a migrated server. + +## EXAMPLES + +### Example 1: Remove replication by Id +```powershell +Remove-AzMigrateHCIServerReplication -TargetObjectID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851" +``` + +```output +ActivityId : ActivityId: 00000000-0000-0000-0000-000000000000 +AllowedAction : {Cancel} +CustomPropertyAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetails +CustomPropertyInstanceType : WorkflowDetails +DisplayName : Delete protected item +EndTime : +Error : {} +Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/jobs/2b0b356e-d106-43af-ad26-02631fcaebba +Name : 2b0b356e-d106-43af-ad26-02631fcaebba +ObjectId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/protectedItems/c1a34301-3bff-4ec6-97f1-6c4bd5adcde0 +ObjectInternalId : a40ecd8e-6413-574d-b1f8-2ef925e087fc +ObjectInternalName : testmachine +ObjectName : c1a34301-3bff-4ec6-97f1-6c4bd5adcde0 +ObjectType : ProtectedItem +ReplicationProviderId : 4de0fddc-bdfe-40d9-b60e-678bdce89630 +SourceFabricProviderId : b35da11c-d69e-4220-9a90-d81ed93ad2fc +StartTime : 7/25/2023 10:14:42 PM +State : Started +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelTags +TargetFabricProviderId : 22f00372-a1b7-467f-87ce-d95e17a6e7c7 +Task : {Prerequisite check, Deleting protected item} +Type : Microsoft.DataReplication/replicationVaults/jobs +``` + +Remove AzStackHCI replication by Id. + +### Example 2: Remove replication by input object +```powershell +$InputObject = Get-AzMigrateHCIServerReplication -TargetObjectID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851" + +Remove-AzMigrateHCIServerReplication -InputObject $InputObject + +$InputObject | Remove-AzMigrateHCIServerReplication +``` + +```output +ActivityId : ActivityId: 00000000-0000-0000-0000-000000000000 +AllowedAction : {Cancel} +CustomPropertyAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetails +CustomPropertyInstanceType : WorkflowDetails +DisplayName : Delete protected item +EndTime : +Error : {} +Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/jobs/2b0b356e-d106-43af-ad26-02631fcaebba +Name : 2b0b356e-d106-43af-ad26-02631fcaebba +ObjectId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/protectedItems/c1a34301-3bff-4ec6-97f1-6c4bd5adcde0 +ObjectInternalId : a40ecd8e-6413-574d-b1f8-2ef925e087fc +ObjectInternalName : testmachine +ObjectName : c1a34301-3bff-4ec6-97f1-6c4bd5adcde0 +ObjectType : ProtectedItem +ReplicationProviderId : 4de0fddc-bdfe-40d9-b60e-678bdce89630 +SourceFabricProviderId : b35da11c-d69e-4220-9a90-d81ed93ad2fc +StartTime : 7/25/2023 10:14:42 PM +State : Started +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelTags +TargetFabricProviderId : 22f00372-a1b7-467f-87ce-d95e17a6e7c7 +Task : {Prerequisite check, Deleting protected item} +Type : Microsoft.DataReplication/replicationVaults/jobs +``` + +Remove AzStackHCI replication by replication input object. + +## 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 +``` + +### -ForceRemove +Specifies whether the replication needs to be force removed. +Default to "false". + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Specifies the replcating server for which the replication needs to be disabled. +The server object can be retrieved using the Get-AzMigrateHCIServerReplication cmdlet. +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity +Parameter Sets: ByInputObject +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure 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 +``` + +### -TargetObjectID +Specifies the replcating server for which the replication needs to be disabled. +The ID should be retrieved using the Get-AzMigrateHCIServerReplication cmdlet. + +```yaml +Type: System.String +Parameter Sets: ByID +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.Migrate.Models.IMigrateIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel + +## NOTES + +## RELATED LINKS + diff --git a/src/Migrate/Migrate.Autorest/help/Remove-AzMigrateProject.md b/src/Migrate/Migrate.Autorest/help/Remove-AzMigrateProject.md new file mode 100644 index 000000000000..2ea0719f91f3 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/help/Remove-AzMigrateProject.md @@ -0,0 +1,172 @@ +--- +external help file: +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/remove-azmigrateproject +schema: 2.0.0 +--- + +# Remove-AzMigrateProject + +## SYNOPSIS +Delete the migrate project. +Deleting non-existent project is a no-operation. + +## SYNTAX + +``` +Remove-AzMigrateProject -Name -ResourceGroupName [-SubscriptionId ] + [-AcceptLanguage ] [-DefaultProfile ] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Delete the migrate project. +Deleting non-existent project is a no-operation. + +## EXAMPLES + +### Example 1: Delete (Default) +```powershell +Remove-AzMigrateProject -SubscriptionId xxx-xxx-xxx -ResourceGroupName BugBashAVSVMware -Name BugBashAVSVMware +``` + +Delete the migrate project. +Deleting non-existent project is a no-operation. + +## PARAMETERS + +### -AcceptLanguage +Standard request header. +Used by service to respond to client in appropriate language. + +```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 DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```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 +``` + +### -Name +Name of the Azure Migrate project. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: MigrateProjectName + +Required: True +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 +Name of the Azure Resource Group that migrate project is part of. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure Subscription Id in which migrate project was created. + +```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 + +### System.Boolean + +## NOTES + +## RELATED LINKS + diff --git a/src/Migrate/Migrate.Autorest/help/Remove-AzMigrateServerReplication.md b/src/Migrate/Migrate.Autorest/help/Remove-AzMigrateServerReplication.md new file mode 100644 index 000000000000..0a64ea24c59a --- /dev/null +++ b/src/Migrate/Migrate.Autorest/help/Remove-AzMigrateServerReplication.md @@ -0,0 +1,186 @@ +--- +external help file: +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/remove-azmigrateserverreplication +schema: 2.0.0 +--- + +# Remove-AzMigrateServerReplication + +## SYNOPSIS +Stops replication for the migrated server. + +## SYNTAX + +### ByIDVMwareCbt (Default) +``` +Remove-AzMigrateServerReplication -TargetObjectID [-SubscriptionId ] [-ForceRemove ] + [-DefaultProfile ] [] +``` + +### ByInputObjectVMwareCbt +``` +Remove-AzMigrateServerReplication -InputObject [-SubscriptionId ] + [-ForceRemove ] [-DefaultProfile ] [] +``` + +## DESCRIPTION +The Remove-AzMigrateServerReplication cmdlet stops the replication for a migrated server. + +## EXAMPLES + +### Example 1: Remove by id. +```powershell +Remove-AzMigrateServerReplication -TargetObjectID "/Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.RecoveryServices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationFabrics/AzMigratePWSHTc8d1replicationfabric/replicationProtectionContainers/AzMigratePWSHTc8d1replicationcontainer/replicationMigrationItems/bcdr-vcenter-fareast-corp-micro-cfcc5a24-a40e-56b9-a6af-e206c9ca4f93_50063baa-9806-d6d6-7e09-c0ae87309b4f" +``` + +```output +ActivityId : da958651-96b3-4e65-a41e-897d4b06f7dd ActivityId: 3a4c8d4d-920a-47cd-82c3-f3dcce90a588 +AllowedAction : {Cancel} +CustomDetailAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.JobDetailsAffectedObjectDetails +CustomDetailInstanceType : AsrJobDetails +EndTime : +Error : {} +FriendlyName : Disable +Id : /Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.Recover + yServices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationJobs/931dde9a-de67-4a30-a045-bb9d6162f8ab +Location : +Name : 931dde9a-de67-4a30-a045-bb9d6162f8ab +ScenarioName : Disable +StartTime : 9/25/20 9:20:08 PM +State : InProgress +StateDescription : InProgress +TargetInstanceType : ProtectionEntity +TargetObjectId : 101883a0-23f7-538a-bbd5-6d8b4fa900e2 +TargetObjectName : prsadhu-TestVM +Task : {DisableProtectionOnPrimary, UpdateDraState} +Type : Microsoft.RecoveryServices/vaults/replicationJobs + +``` + +Resync by id. + +### Example 2: Remove by Input Object +```powershell +$obj = Get-AzMigrateServerReplication -TargetObjectID "/Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.RecoveryServices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationFabrics/AzMigratePWSHTc8d1replicationfabric/replicationProtectionContainers/AzMigratePWSHTc8d1replicationcontainer/replicationMigrationItems/bcdr-vcenter-fareast-corp-micro-cfcc5a24-a40e-56b9-a6af-e206c9ca4f93_50063baa-9806-d6d6-7e09-c0ae87309b4f" +Remove-AzMigrateServerReplication -InputObject $obj +``` + +```output +ActivityId : da958651-96b3-4e65-a41e-897d4b06f7dd ActivityId: 3a4c8d4d-920a-47cd-82c3-f3dcce90a588 +AllowedAction : {Cancel} +CustomDetailAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.JobDetailsAffectedObjectDetails +CustomDetailInstanceType : AsrJobDetails +EndTime : +Error : {} +FriendlyName : Disable +Id : /Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.Recover + yServices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationJobs/931dde9a-de67-4a30-a045-bb9d6162f8ab +Location : +Name : 931dde9a-de67-4a30-a045-bb9d6162f8ab +ScenarioName : Disable +StartTime : 9/25/20 9:20:08 PM +State : InProgress +StateDescription : InProgress +TargetInstanceType : ProtectionEntity +TargetObjectId : 101883a0-23f7-538a-bbd5-6d8b4fa900e2 +TargetObjectName : prsadhu-TestVM +Task : {DisableProtectionOnPrimary, UpdateDraState} +Type : Microsoft.RecoveryServices/vaults/replicationJobs +``` + +By name. + +## 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 +``` + +### -ForceRemove +Specifies whether the replication needs to be force removed. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Specifies the replcating server for which the replication needs to be disabled. +The server object should be retrieved using the Get-AzMigrateServerReplication cmdlet. +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem +Parameter Sets: ByInputObjectVMwareCbt +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure 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 +``` + +### -TargetObjectID +Specifies the replcating server for which the replication needs to be disabled. +The ID should be retrieved using the Get-AzMigrateServerReplication cmdlet. + +```yaml +Type: System.String +Parameter Sets: ByIDVMwareCbt +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 + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IJob + +## NOTES + +## RELATED LINKS + diff --git a/src/Migrate/Migrate.Autorest/help/Restart-AzMigrateServerReplication.md b/src/Migrate/Migrate.Autorest/help/Restart-AzMigrateServerReplication.md new file mode 100644 index 000000000000..44c7c4d8c789 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/help/Restart-AzMigrateServerReplication.md @@ -0,0 +1,169 @@ +--- +external help file: +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/restart-azmigrateserverreplication +schema: 2.0.0 +--- + +# Restart-AzMigrateServerReplication + +## SYNOPSIS +Restarts the replication for specified server. + +## SYNTAX + +### ByIDVMwareCbt (Default) +``` +Restart-AzMigrateServerReplication -TargetObjectID [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### ByInputObjectVMwareCbt +``` +Restart-AzMigrateServerReplication -InputObject [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +## DESCRIPTION +The Restart-AzMigrateServerReplication cmdlet repairs the replication for the specified server. + +## EXAMPLES + +### Example 1: By id. +```powershell +Restart-AzMigrateServerReplication -TargetObjectID "/Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.RecoveryServices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationFabrics/AzMigratePWSHTc8d1replicationfabric/replicationProtectionContainers/AzMigratePWSHTc8d1replicationcontainer/replicationMigrationItems/bcdr-vcenter-fareast-corp-micro-cfcc5a24-a40e-56b9-a6af-e206c9ca4f93_50063baa-9806-d6d6-7e09-c0ae87309b4f" +``` + +```output +ActivityId : da958651-96b3-4e65-a41e-897d4b06f7dd ActivityId: 3a4c8d4d-920a-47cd-82c3-f3dcce90a588 +AllowedAction : {Cancel} +CustomDetailAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.JobDetailsAffectedObjectDetails +CustomDetailInstanceType : AsrJobDetails +EndTime : +Error : {} +FriendlyName : Restart +Id : /Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.Recover + yServices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationJobs/931dde9a-de67-4a30-a045-bb9d6162f8ab +Location : +Name : 931dde9a-de67-4a30-a045-bb9d6162f8ab +ScenarioName : Restart +StartTime : 9/25/20 9:20:08 PM +State : InProgress +StateDescription : InProgress +TargetInstanceType : ProtectionEntity +TargetObjectId : 101883a0-23f7-538a-bbd5-6d8b4fa900e2 +TargetObjectName : prsadhu-TestVM +Task : {DisableProtectionOnPrimary, UpdateDraState} +Type : Microsoft.RecoveryServices/vaults/replicationJobs +``` + +By id. + +### Example 2: By Input Object +```powershell +$obj = Get-AzMigrateServerReplication -TargetObjectID "/Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.RecoveryServices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationFabrics/AzMigratePWSHTc8d1replicationfabric/replicationProtectionContainers/AzMigratePWSHTc8d1replicationcontainer/replicationMigrationItems/bcdr-vcenter-fareast-corp-micro-cfcc5a24-a40e-56b9-a6af-e206c9ca4f93_50063baa-9806-d6d6-7e09-c0ae87309b4f" +$output = Restart-AzMigrateServerReplication -InputObject $obj +``` + +```output +ActivityId : da958651-96b3-4e65-a41e-897d4b06f7dd ActivityId: 3a4c8d4d-920a-47cd-82c3-f3dcce90a588 +AllowedAction : {Cancel} +CustomDetailAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.JobDetailsAffectedObjectDetails +CustomDetailInstanceType : AsrJobDetails +EndTime : +Error : {} +FriendlyName : Restart +Id : /Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.Recover + yServices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationJobs/931dde9a-de67-4a30-a045-bb9d6162f8ab +Location : +Name : 931dde9a-de67-4a30-a045-bb9d6162f8ab +ScenarioName : Restart +StartTime : 9/25/20 9:20:08 PM +State : InProgress +StateDescription : InProgress +TargetInstanceType : ProtectionEntity +TargetObjectId : 101883a0-23f7-538a-bbd5-6d8b4fa900e2 +TargetObjectName : prsadhu-TestVM +Task : {DisableProtectionOnPrimary, UpdateDraState} +Type : Microsoft.RecoveryServices/vaults/replicationJobs +``` + +By Input Object. + +## 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 +Specifies the machine object of the replicating server. +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem +Parameter Sets: ByInputObjectVMwareCbt +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure 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 +``` + +### -TargetObjectID +Specifies the replcating server for which the resync needs to be initiated. +The ID should be retrieved using the Get-AzMigrateServerReplication cmdlet. + +```yaml +Type: System.String +Parameter Sets: ByIDVMwareCbt +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 + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IJob + +## NOTES + +## RELATED LINKS + diff --git a/src/Migrate/Migrate.Autorest/help/Resume-AzMigrateServerReplication.md b/src/Migrate/Migrate.Autorest/help/Resume-AzMigrateServerReplication.md new file mode 100644 index 000000000000..f5f00086a5d6 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/help/Resume-AzMigrateServerReplication.md @@ -0,0 +1,216 @@ +--- +external help file: +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/resume-azmigrateserverreplication +schema: 2.0.0 +--- + +# Resume-AzMigrateServerReplication + +## SYNOPSIS +Starts the replication that has been suspended. + +## SYNTAX + +### ByIDVMwareCbt (Default) +``` +Resume-AzMigrateServerReplication -TargetObjectID [-DeleteMigratedResource] + [-SubscriptionId ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### ByInputObjectVMwareCbt +``` +Resume-AzMigrateServerReplication -InputObject [-DeleteMigratedResource] + [-SubscriptionId ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The Resume-AzMigrateServerReplication starts the replication that has been suspended. + +## EXAMPLES + +### Example 1: By machine id. +```powershell +Resume-AzMigrateServerReplication -TargetObjectID "/Subscriptions/xxx-xxx-xxxxxx-xxx-xxx/resourceGroups/cbtsignoff2201rg/providers/Microsoft.RecoveryServices/vaults/signoffccyapp3352vault/replicationFabrics/signoffccyappae52replicationfabric/replicationProtectionContainers/signoffccyappae52replicationcontainer/replicationMigrationItems/idclab-vcen67-fareast-corp-micr-0f144e99-ba36-4649-b92b-8b06854aa539_5015f6d8-fc84-afdf-de47-1eab79330f00" +``` + +```output +ActivityId : 0b810233-b0aa-4a4c-a44e-bea4589c0513 ActivityId: ccb4889b-b9ec-4a76-af4d-4eb59c76ebac +AllowedAction : {} +CustomDetailAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.JobDetailsAffectedObjectDetails +CustomDetailInstanceType : AsrJobDetails +EndTime : +Error : {} +FriendlyName : +Id : /Subscriptions/xxx-xxx-xxxxxx-xxx-xxx/resourceGroups/cbtsignoff2201rg/providers/Microsoft.RecoveryServices/vaults/signoff + ccyapp3352vault/replicationJobs/75a6945d-2276-4dbb-926c-d0745e004130 +Location : +Name : 75a6945d-2276-4dbb-926c-d0745e004130 +ScenarioName : +StartTime : +State : NotStarted +StateDescription : NotStarted +TargetInstanceType : ProtectionEntity +TargetObjectId : +TargetObjectName : +Task : {} +Type : Microsoft.RecoveryServices/vaults/replicationJobs +``` + +By machine id. + +### Example 2: By input object +```powershell +$obj = Get-AzMigrateServerReplication -ProjectName "signoffccyproj" -ResourceGroupName "cbtsignoff2201rg" -MachineName "Win2k16" +Resume-AzMigrateServerReplication -InputObject $obj +``` + +```output +ActivityId : 0b810233-b0aa-4a4c-a44e-bea4589c0513 ActivityId: ccb4889b-b9ec-4a76-af4d-4eb59c76ebac +AllowedAction : {} +CustomDetailAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.JobDetailsAffectedObjectDetails +CustomDetailInstanceType : AsrJobDetails +EndTime : +Error : {} +FriendlyName : +Id : /Subscriptions/xxx-xxx-xxxxxx-xxx-xxx/resourceGroups/cbtsignoff2201rg/providers/Microsoft.RecoveryServices/vaults/signoff + ccyapp3352vault/replicationJobs/75a6945d-2276-4dbb-926c-d0745e004130 +Location : +Name : 75a6945d-2276-4dbb-926c-d0745e004130 +ScenarioName : +StartTime : +State : NotStarted +StateDescription : NotStarted +TargetInstanceType : ProtectionEntity +TargetObjectId : +TargetObjectName : +Task : {} +Type : Microsoft.RecoveryServices/vaults/replicationJobs +``` + +By input object. + +## 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 +``` + +### -DeleteMigratedResource +Specifies whether the migrated resources needs to be deleted. + +```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 +``` + +### -InputObject +Specifies the replicating server for which the resume replication needs to be initiated. +The server object can be retrieved using the Get-AzMigrateServerReplication cmdlet +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem +Parameter Sets: ByInputObjectVMwareCbt +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure 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 +``` + +### -TargetObjectID +Specifies the replicating server for which the resume replication needs to be initiated. +The ID should be retrieved using the Get-AzMigrateServerReplication cmdlet. + +```yaml +Type: System.String +Parameter Sets: ByIDVMwareCbt +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.Migrate.Models.Api202301.IJob + +## NOTES + +## RELATED LINKS + diff --git a/src/Migrate/Migrate.Autorest/help/Set-AzMigrateDiskMapping.md b/src/Migrate/Migrate.Autorest/help/Set-AzMigrateDiskMapping.md new file mode 100644 index 000000000000..1f9d2d7e143e --- /dev/null +++ b/src/Migrate/Migrate.Autorest/help/Set-AzMigrateDiskMapping.md @@ -0,0 +1,96 @@ +--- +external help file: +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/set-azmigratediskmapping +schema: 2.0.0 +--- + +# Set-AzMigrateDiskMapping + +## SYNOPSIS +Updates disk mapping + +## SYNTAX + +``` +Set-AzMigrateDiskMapping -DiskID [-DiskName ] [-IsOSDisk ] [] +``` + +## DESCRIPTION +The Set-AzMigrateDiskMapping cmdlet updates a mapping of the source disk attached to the server to be migrated + +## EXAMPLES + +### Example 1: Make disks +```powershell +Set-AzMigrateDiskMapping -DiskID "6000C294-1217-dec3-bc18-81f117220424" -DiskName "ContosoDisk_1" -IsOSDisk "True" +``` + +```output +DiskId IsOSDisk TargetDiskName +------ -------- -------------- +6000C294-1217-dec3-bc18-81f117220424 True ContosoDisk_1 +``` + +Get disks object to provide input for Set-AzMigrateServerReplication + +## PARAMETERS + +### -DiskID +Specifies the disk ID of the disk attached to the discovered server to be migrated. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DiskName +Specifies the name of the managed disk to be created. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IsOSDisk +Specifies whether the disk contains the Operating System for the source server to be migrated. + +```yaml +Type: System.String +Parameter Sets: (All) +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 + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IVMwareCbtUpdateDiskInput + +## NOTES + +## RELATED LINKS + diff --git a/src/Migrate/Migrate.Autorest/help/Set-AzMigrateHCIServerReplication.md b/src/Migrate/Migrate.Autorest/help/Set-AzMigrateHCIServerReplication.md new file mode 100644 index 000000000000..3db53e28c78f --- /dev/null +++ b/src/Migrate/Migrate.Autorest/help/Set-AzMigrateHCIServerReplication.md @@ -0,0 +1,292 @@ +--- +external help file: +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/set-azmigratehciserverreplication +schema: 2.0.0 +--- + +# Set-AzMigrateHCIServerReplication + +## SYNOPSIS +Updates the target properties for the replicating server. + +## SYNTAX + +``` +Set-AzMigrateHCIServerReplication -TargetObjectID + [-DynamicMemoryConfig ] [-IsDynamicMemoryEnabled ] + [-NicToInclude ] [-SubscriptionId ] [-TargetVMCPUCore ] + [-TargetVMName ] [-TargetVMRam ] [-DefaultProfile ] [-Confirm] [-WhatIf] + [] +``` + +## DESCRIPTION +The Set-AzMigrateHCIServerReplication cmdlet updates the target properties for the replicating server. + +## EXAMPLES + +### Example 1: Update target VM name +```powershell +Set-AzMigrateHCIServerReplication -TargetObjectID '/subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/protectedItems/503a4f02-916c-d6b0-8d14-222bbd4767e5' -TargetVMName "targetName1" +``` + +```output +ActivityId : ActivityId: 00000000-0000-0000-0000-000000000000 +AllowedAction : {} +CustomPropertyAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetails +CustomPropertyInstanceType : WorkflowDetails +DisplayName : Create or update protected item +EndTime : 1/1/1900 8:54:47 PM +Error : {} +Id : /subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/jobs/f2d3430a-2977-419f-abd5-11d171e17f5e +Name : f2d3430a-2977-419f-abd5-11d171e17f5e +ObjectId : /subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94555 +ObjectInternalId : a8b5ee68-102c-5aae-9499-c57a475a8fd4 +ObjectInternalName : test_vm +ObjectName : 0ec082d5-6827-457a-bae2-f986e1b94555 +ObjectType : ProtectedItem +ReplicationProviderId : xxx-xxx-xxx +SourceFabricProviderId : b35da11c-d69e-4220-9a90-d81ed93ad2fc +StartTime : 1/1/1900 8:49:27 PM +State : Succeeded +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelTags +TargetFabricProviderId : 22f00372-a1b7-467f-87ce-d95e17a6e7c7 +Task : {Creating or updating the protected item, Initializing Protection, Enabling Protection, Starting Replication} +Type : Microsoft.DataReplication/replicationVaults/jobs +``` + +Update target VM name + +### Example 2: Update dynamic memory configuration +```powershell +$memoryConfig = [PSCustomObject]@{ + MinimumMemoryInMegaByte = 1024 + MaximumMemoryInMegaByte = 34816 + TargetMemoryBufferPercentage = 20 +} + +Set-AzMigrateHCIServerReplication -TargetObjectID '/subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/protectedItems/503a4f02-916c-d6b0-8d14-222bbd4767e5' -DynamicMemoryConfig $memoryConfig +``` + +```output +ActivityId : ActivityId: 00000000-0000-0000-0000-000000000000 +AllowedAction : {} +CustomPropertyAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelCustomPropertiesAffectedObjectDetails +CustomPropertyInstanceType : WorkflowDetails +DisplayName : Create or update protected item +EndTime : 1/1/1900 8:54:47 PM +Error : {} +Id : /subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/jobs/f2d3430a-2977-419f-abd5-11d171e17f5e +Name : f2d3430a-2977-419f-abd5-11d171e17f5e +ObjectId : /subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94555 +ObjectInternalId : a8b5ee68-102c-5aae-9499-c57a475a8fd4 +ObjectInternalName : test_vm +ObjectName : 0ec082d5-6827-457a-bae2-f986e1b94555 +ObjectType : ProtectedItem +ReplicationProviderId : xxx-xxx-xxx +SourceFabricProviderId : b35da11c-d69e-4220-9a90-d81ed93ad2fc +StartTime : 1/1/1900 8:49:27 PM +State : Succeeded +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.WorkflowModelTags +TargetFabricProviderId : 22f00372-a1b7-467f-87ce-d95e17a6e7c7 +Task : {Creating or updating the protected item, Initializing Protection, Enabling Protection, Starting Replication} +Type : Microsoft.DataReplication/replicationVaults/jobs +``` + +Update dynamic memory configuration. + +## 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 +``` + +### -DynamicMemoryConfig +Specifies the dynamic memory configration of RAM. +To construct, see NOTES section for DYNAMICMEMORYCONFIG properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.ProtectedItemDynamicMemoryConfig +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IsDynamicMemoryEnabled +Specifies if RAM is dynamic or not. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NicToInclude +Specifies the nics on the source server to be included for replication. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHCINicInput[] +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 +``` + +### -TargetObjectID +Specifies the replicating server for which the properties need to be updated. +The ID should be retrieved using the Get-AzMigrateHCIServerReplication cmdlet. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetVMCPUCore +Specifies the number of CPU cores. + +```yaml +Type: System.Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetVMName +Specifies the target VM name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetVMRam +Specifies the target RAM size in MB. + +```yaml +Type: System.Int64 +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.Migrate.Models.Api20210216Preview.IWorkflowModel + +## NOTES + +## RELATED LINKS + diff --git a/src/Migrate/Migrate.Autorest/help/Set-AzMigrateServerReplication.md b/src/Migrate/Migrate.Autorest/help/Set-AzMigrateServerReplication.md new file mode 100644 index 000000000000..206068e0abe6 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/help/Set-AzMigrateServerReplication.md @@ -0,0 +1,496 @@ +--- +external help file: +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/set-azmigrateserverreplication +schema: 2.0.0 +--- + +# Set-AzMigrateServerReplication + +## SYNOPSIS +Updates the target properties for the replicating server. + +## SYNTAX + +### ByIDVMwareCbt (Default) +``` +Set-AzMigrateServerReplication -TargetObjectID [-DiskToUpdate ] + [-NicToUpdate ] [-SqlServerLicenseType ] [-SubscriptionId ] + [-TargetAvailabilitySet ] [-TargetAvailabilityZone ] + [-TargetBootDiagnosticsStorageAccount ] [-TargetDiskName ] [-TargetNetworkId ] + [-TargetResourceGroupID ] [-TargetVMName ] [-TargetVMSize ] [-TestNetworkId ] + [-UpdateDiskTag ] [-UpdateDiskTagOperation ] + [-UpdateNicTag ] [-UpdateNicTagOperation ] + [-UpdateTag ] [-UpdateTagOperation ] + [-UpdateVMTag ] [-UpdateVMTagOperation ] + [-DefaultProfile ] [] +``` + +### ByInputObjectVMwareCbt +``` +Set-AzMigrateServerReplication -InputObject [-DiskToUpdate ] + [-NicToUpdate ] [-SqlServerLicenseType ] [-SubscriptionId ] + [-TargetAvailabilitySet ] [-TargetAvailabilityZone ] + [-TargetBootDiagnosticsStorageAccount ] [-TargetDiskName ] [-TargetNetworkId ] + [-TargetResourceGroupID ] [-TargetVMName ] [-TargetVMSize ] [-TestNetworkId ] + [-UpdateDiskTag ] [-UpdateDiskTagOperation ] + [-UpdateNicTag ] [-UpdateNicTagOperation ] + [-UpdateTag ] [-UpdateTagOperation ] + [-UpdateVMTag ] [-UpdateVMTagOperation ] + [-DefaultProfile ] [] +``` + +## DESCRIPTION +The Set-AzMigrateServerReplication cmdlet updates the target properties for the replicating server. + +## EXAMPLES + +### Example 1: Update by id +```powershell +Set-AzMigrateServerReplication -TargetObjectID '/Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.RecoveryServices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationFabrics/AzMigratePWSHTc8d1replicationfabric/replicationProtectionContainers/AzMigratePWSHTc8d1replicationcontainer/replicationMigrationItems/bcdr-vcenter-fareast-corp-micro-cfcc5a24-a40e-56b9-a6af-e206c9ca4f93_500f44f8-2aa3-587b-8958-ead358639629' -TargetVMName 'rb-w2k12r2-1' +``` + +```output +ActivityId : da958651-96b3-4e65-a41e-897d4b06f7dd ActivityId: 3a4c8d4d-920a-47cd-82c3-f3dcce90a588 +AllowedAction : {Cancel} +CustomDetailAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.JobDetailsAffectedObjectDetails +CustomDetailInstanceType : AsrJobDetails +EndTime : +Error : {} +FriendlyName : Update +Id : /Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.Recover + yServices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationJobs/931dde9a-de67-4a30-a045-bb9d6162f8ab +Location : +Name : 931dde9a-de67-4a30-a045-bb9d6162f8ab +ScenarioName : Update +StartTime : 9/25/20 9:20:08 PM +State : InProgress +StateDescription : InProgress +TargetInstanceType : ProtectionEntity +TargetObjectId : 101883a0-23f7-538a-bbd5-6d8b4fa900e2 +TargetObjectName : prsadhu-TestVM +Task : {DisableProtectionOnPrimary, UpdateDraState} +Type : Microsoft.RecoveryServices/vaults/replicationJobs +``` + +By id. + +### Example 2: Update multiple disk names by id +```powershell +$OSDisk = Set-AzMigrateDiskMapping -DiskID "6000C294-1217-dec3-bc18-81f117220424" -DiskName "ContosoDisk_1" +$DataDisk = Set-AzMigrateDiskMapping -DiskID "6000C292-79b9-bbdc-fb8a-f1fa8dbeff84" -DiskName "ContosoDisk_2" +$DiskMapping = $OSDisk, $DataDisk +Set-AzMigrateServerReplication -TargetObjectId "/Subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/cbtsignoff2105srcrg/providers/Microsoft.RecoveryServices/vaults/signoff2105app1452vault/replicationFabrics/signoff2105app1c36replicationfabric/replicationProtectionContainers/signoff2105app1c36replicationcontainer/replicationMigrationItems/idclab-vcen67-fareast-corp-micr-6f5e3b29-29ad-4e62-abbd-6cd33c4183ef_5015f6d8-fc84-afdf-de47-1eab79330f00" -DiskToUpdate $DiskMapping +``` + +```output +ActivityId : c533d88d-2211-43c6-b615-7b46876d8882 ActivityId: de18df8b-8d43-4249-8989-846d33a124f6 +AllowedAction : {} +CustomDetailAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210210.JobDetailsAffectedObje + ctDetails +CustomDetailInstanceType : AsrJobDetails +EndTime : +Error : {} +FriendlyName : Update the virtual machine +Id : /Subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/cbtsignoff2105src + rg/providers/Microsoft.RecoveryServices/vaults/signoff2105app1452vault/replicationJo + bs/6ec1cca6-87c7-4f14-9657-bd0469c02fcd +Location : +Name : 6ec1cca6-87c7-4f14-9657-bd0469c02fcd +ScenarioName : UpdateVmProperties +StartTime : 8/30/2021 7:08:51 AM +State : InProgress +StateDescription : InProgress +TargetInstanceType : ProtectionEntity +TargetObjectId : f3aa6bd4-1b60-52bb-b12d-e850f8d8f13c +TargetObjectName : Win2k16 +Task : {UpdateVmPropertiesTask} +Type : Microsoft.RecoveryServices/vaults/replicationJobs +``` + +Updating disk name by id. + +## 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 +``` + +### -DiskToUpdate +Updates the disk for the Azure VM to be created. +To construct, see NOTES section for DISKTOUPDATE properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IVMwareCbtUpdateDiskInput[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Specifies the replicating server for which the properties need to be updated. +The server object can be retrieved using the Get-AzMigrateServerReplication cmdlet. +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem +Parameter Sets: ByInputObjectVMwareCbt +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NicToUpdate +Updates the NIC for the Azure VM to be created. +To construct, see NOTES section for NICTOUPDATE properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IVMwareCbtNicInput[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SqlServerLicenseType +Specifies if Azure Hybrid benefit for SQL Server is applicable for the server to be migrated. + +```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 +``` + +### -TargetAvailabilitySet +Specifies the Availability Set to be used for VM creation. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetAvailabilityZone +Specifies the Availability Zone to be used for VM creation. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetBootDiagnosticsStorageAccount +Specifies the storage account to be used for boot diagnostics. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetDiskName +Specifies the name of the Azure VM to be created. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetNetworkId +Updates the Virtual Network id within the destination Azure subscription to which the server needs to be migrated. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetObjectID +Specifies the replcating server for which the properties need to be updated. +The ID should be retrieved using the Get-AzMigrateServerReplication cmdlet. + +```yaml +Type: System.String +Parameter Sets: ByIDVMwareCbt +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetResourceGroupID +Updates the Resource Group id within the destination Azure subscription to which the server needs to be migrated. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetVMName +Specifies the replcating server for which the properties need to be updated. +The ID should be retrieved using the Get-AzMigrateServerReplication cmdlet. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetVMSize +Updates the SKU of the Azure VM to be created. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TestNetworkId +Updates the Virtual Network id within the destination Azure subscription to which the server needs to be test migrated. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UpdateDiskTag +Specifies the tag to be used for disk creation. +To construct, see NOTES section for UPDATEDISKTAG properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IVMwareCbtEnableMigrationInputTargetDiskTags +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UpdateDiskTagOperation +Specifies update disk tag operation. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UpdateNicTag +Specifies the tag to be used for NIC creation. +To construct, see NOTES section for UPDATENICTAG properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IVMwareCbtEnableMigrationInputTargetNicTags +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UpdateNicTagOperation +Specifies update NIC tag operation. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UpdateTag +Specifies the tag to be used for Resource creation. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UpdateTagOperation +Specifies update tag operation. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UpdateVMTag +Specifies the tag to be used for VM creation. +To construct, see NOTES section for UPDATEVMTAG properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IVMwareCbtEnableMigrationInputTargetVmtags +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UpdateVMTagOperation +Specifies update VM tag operation. + +```yaml +Type: System.String +Parameter Sets: (All) +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 + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IJob + +## NOTES + +## RELATED LINKS + diff --git a/src/Migrate/Migrate.Autorest/help/Start-AzMigrateHCIServerMigration.md b/src/Migrate/Migrate.Autorest/help/Start-AzMigrateHCIServerMigration.md new file mode 100644 index 000000000000..5d934672819a --- /dev/null +++ b/src/Migrate/Migrate.Autorest/help/Start-AzMigrateHCIServerMigration.md @@ -0,0 +1,251 @@ +--- +external help file: +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/start-azmigratehciservermigration +schema: 2.0.0 +--- + +# Start-AzMigrateHCIServerMigration + +## SYNOPSIS +Starts the migration for the replicating server. + +## SYNTAX + +### ByID (Default) +``` +Start-AzMigrateHCIServerMigration -TargetObjectID [-SubscriptionId ] [-TurnOffSourceServer] + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### ByInputObject +``` +Start-AzMigrateHCIServerMigration -InputObject [-SubscriptionId ] + [-TurnOffSourceServer] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Starts the migration for the replicating server. + +## EXAMPLES + +### Example 1: Start migration by Id +```powershell +Start-AzMigrateHCIServerMigration -TargetObjectID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851" +``` + +```output +ActivityId : ActivityId: 00000000-0000-0000-0000-000000000000 +AllowedAction : {Cancel} +CustomPropertyAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api2021 + 0216Preview.WorkflowModelCustomPropertiesAffectedObjectDe + tails +CustomPropertyInstanceType : FailoverWorkflowDetails +DisplayName : Planned failover +EndTime : +Error : {} +Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication + /replicationVaults/testproj1234replicationvault/jobs/af0e1bf6-e3e6-482c-8345-b1a06d87af96 +Name : af0e1bf6-e3e6-482c-8345-b1a06d87af96 +ObjectId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication + /replicationVaults/testproj1234replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851/plannedFai + lover +ObjectInternalId : a8b5ee68-102c-5aae-9499-c57a475a8fc4 +ObjectInternalName : testmachine +ObjectName : 0ec082d5-6827-457a-bae2-f986e1b94851 +ObjectType : ProtectedItem +ReplicationProviderId : 4de0fddc-bdfe-40d9-b60e-678bdce89630 +SourceFabricProviderId : b35da11c-d69e-4220-9a90-d81ed93ad2fc +StartTime : 8/1/2023 12:42:19 AM +State : Started +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api2021 + 0216Preview.WorkflowModelTags +TargetFabricProviderId : 22f00372-a1b7-467f-87ce-d95e17a6e7c7 +Task : {Prerequisite check, Turning off resource on primary, + Starting failover, Preparing protected entities...} +Type : Microsoft.DataReplication/replicationVaults/jobs +``` + +Start AzStackHCI server migration by Id. + +### Example 2: Start migration by input object +```powershell +$InputObject = Get-AzMigrateHCIServerReplication -TargetObjectID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851" + +Start-AzMigrateHCIServerMigration -InputObject $InputObject + +$InputObject | Start-AzMigrateHCIServerMigration +``` + +```output +ActivityId : ActivityId: 00000000-0000-0000-0000-000000000000 +AllowedAction : {Cancel} +CustomPropertyAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api2021 + 0216Preview.WorkflowModelCustomPropertiesAffectedObjectDe + tails +CustomPropertyInstanceType : FailoverWorkflowDetails +DisplayName : Planned failover +EndTime : +Error : {} +Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication + /replicationVaults/testproj1234replicationvault/jobs/af0e1bf6-e3e6-482c-8345-b1a06d87af96 +Name : af0e1bf6-e3e6-482c-8345-b1a06d87af96 +ObjectId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication + /replicationVaults/testproj1234replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851/plannedFai + lover +ObjectInternalId : a8b5ee68-102c-5aae-9499-c57a475a8fc4 +ObjectInternalName : testmachine +ObjectName : 0ec082d5-6827-457a-bae2-f986e1b94851 +ObjectType : ProtectedItem +ReplicationProviderId : 4de0fddc-bdfe-40d9-b60e-678bdce89630 +SourceFabricProviderId : b35da11c-d69e-4220-9a90-d81ed93ad2fc +StartTime : 8/1/2023 12:42:19 AM +State : Started +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api2021 + 0216Preview.WorkflowModelTags +TargetFabricProviderId : 22f00372-a1b7-467f-87ce-d95e17a6e7c7 +Task : {Prerequisite check, Turning off resource on primary, + Starting failover, Preparing protected entities...} +Type : Microsoft.DataReplication/replicationVaults/jobs +``` + +Start AzStackHCI server migration by replication input object. + +## 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 +Specifies the replicating server for which migration needs to be initiated. +The server object can be retrieved using the Get-AzMigrateHCIServerReplication cmdlet. +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity +Parameter Sets: ByInputObject +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure 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 +``` + +### -TargetObjectID +Specifies the replcating server for which migration needs to be initiated. +The ID should be retrieved using the Get-AzMigrateHCIServerReplication cmdlet. + +```yaml +Type: System.String +Parameter Sets: ByID +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TurnOffSourceServer +Specifies whether the source server should be turned off post migration. + +```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 +``` + +### -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.Migrate.Models.IMigrateIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel + +## NOTES + +## RELATED LINKS + diff --git a/src/Migrate/Migrate.Autorest/help/Start-AzMigrateServerMigration.md b/src/Migrate/Migrate.Autorest/help/Start-AzMigrateServerMigration.md new file mode 100644 index 000000000000..e279b30f11dd --- /dev/null +++ b/src/Migrate/Migrate.Autorest/help/Start-AzMigrateServerMigration.md @@ -0,0 +1,170 @@ +--- +external help file: +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/start-azmigrateservermigration +schema: 2.0.0 +--- + +# Start-AzMigrateServerMigration + +## SYNOPSIS +Starts the migration for the replicating server. + +## SYNTAX + +### ByIDVMwareCbt (Default) +``` +Start-AzMigrateServerMigration -TargetObjectID [-OsUpgradeVersion ] + [-SubscriptionId ] [-TurnOffSourceServer] [-DefaultProfile ] [] +``` + +### ByInputObjectVMwareCbt +``` +Start-AzMigrateServerMigration -InputObject [-OsUpgradeVersion ] + [-SubscriptionId ] [-TurnOffSourceServer] [-DefaultProfile ] [] +``` + +## DESCRIPTION +Starts the migration for the replicating server. + +## EXAMPLES + +### Example 1: By id +```powershell +Start-AzMigrateServerMigration -TargetObjectID "/Subscriptions/7xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.RecoveryServices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationFabrics/AzMigratePWSHTc8d1replicationfabric/replicationProtectionContainers/AzMigratePWSHTc8d1replicationcontainer/replicationMigrationItems/bcdr-vcenter-fareast-corp-micro-cfcc5a24-a40e-56b9-a6af-e206c9ca4f93_52f42ee7-8eb3-1aa4-e2d5-1ae83f86b085" +``` + +```output +ActivityId : da958651-96b3-4e65-a41e-897d4b06f7dd ActivityId: 3a4c8d4d-920a-47cd-82c3-f3dcce90a588 +AllowedAction : {Cancel} +CustomDetailAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.JobDetailsAffectedObjectDetails +CustomDetailInstanceType : AsrJobDetails +EndTime : +Error : {} +FriendlyName : Migrate +Id : /Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.Recover + yServices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationJobs/931dde9a-de67-4a30-a045-bb9d6162f8ab +Location : +Name : 931dde9a-de67-4a30-a045-bb9d6162f8ab +ScenarioName : Migrate +StartTime : 9/25/20 9:20:08 PM +State : InProgress +StateDescription : InProgress +TargetInstanceType : ProtectionEntity +TargetObjectId : 101883a0-23f7-538a-bbd5-6d8b4fa900e2 +TargetObjectName : prsadhu-TestVM +Task : {DisableProtectionOnPrimary, UpdateDraState} +Type : Microsoft.RecoveryServices/vaults/replicationJobs +``` + +By id + +## 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 +Specifies the replicating server for which migration needs to be initiated. +The server object can be retrieved using the Get-AzMigrateServerReplication cmdlet. +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem +Parameter Sets: ByInputObjectVMwareCbt +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OsUpgradeVersion +Specifies the target version to which the Os has to be upgraded to. +The valid values can be selected from SupportedOSVersions retrieved using Get-AzMigrateServerReplication cmdlet. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure 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 +``` + +### -TargetObjectID +Specifies the replcating server for which migration needs to be initiated. +The ID should be retrieved using the Get-AzMigrateServerReplication cmdlet. + +```yaml +Type: System.String +Parameter Sets: ByIDVMwareCbt +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TurnOffSourceServer +Specifies whether the source server should be turned off post migration. + +```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 +``` + +### 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.Migrate.Models.Api202301.IJob + +## NOTES + +## RELATED LINKS + diff --git a/src/Migrate/Migrate.Autorest/help/Start-AzMigrateTestMigration.md b/src/Migrate/Migrate.Autorest/help/Start-AzMigrateTestMigration.md new file mode 100644 index 000000000000..f75af6142f57 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/help/Start-AzMigrateTestMigration.md @@ -0,0 +1,221 @@ +--- +external help file: +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/start-azmigratetestmigration +schema: 2.0.0 +--- + +# Start-AzMigrateTestMigration + +## SYNOPSIS +Starts the test migration for the replicating server. + +## SYNTAX + +### ByIDVMwareCbt (Default) +``` +Start-AzMigrateTestMigration -TargetObjectID -TestNetworkID + [-NicToUpdate ] [-OsUpgradeVersion ] [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### ByInputObjectVMwareCbt +``` +Start-AzMigrateTestMigration -InputObject -TestNetworkID + [-NicToUpdate ] [-OsUpgradeVersion ] [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +## DESCRIPTION +The Start-AzMigrateTestMigration cmdlet initiates the test migration for the replicating server. + +## EXAMPLES + +### Example 1: By machine id. +```powershell +Start-AzMigrateTestMigration -TargetObjectID '/Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.RecoveryServices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationFabrics/AzMigratePWSHTc8d1replicationfabric/replicationProtectionContainers/AzMigratePWSHTc8d1replicationcontainer/replicationMigrationItems/bcdr-vcenter-fareast-corp-micro-cfcc5a24-a40e-56b9-a6af-e206c9ca4f93_50063baa-9806-d6d6-7e09-c0ae87309b4f' -TestNetworkId '/subscriptions/xxx-xxx-xxx/resourceGroups/AzMigratePWSHtargetRG/providers/Microsoft.Network/virtualNetworks/AzMigrateTargetNetwork' +``` + +```output +ActivityId : da958651-96b3-4e65-a41e-897d4b06f7dd ActivityId: 3a4c8d4d-920a-47cd-82c3-f3dcce90a588 +AllowedAction : {Cancel} +CustomDetailAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.JobDetailsAffectedObjectDetails +CustomDetailInstanceType : AsrJobDetails +EndTime : +Error : {} +FriendlyName : Test Migrate +Id : /Subscriptions/xxx-xxx-xxxresourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.Recover + yServices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationJobs/931dde9a-de67-4a30-a045-bb9d6162f8ab +Location : +Name : 931dde9a-de67-4a30-a045-bb9d6162f8ab +ScenarioName : TestMigrate +StartTime : 9/25/20 9:20:08 PM +State : InProgress +StateDescription : InProgress +TargetInstanceType : ProtectionEntity +TargetObjectId : 101883a0-23f7-538a-bbd5-6d8b4fa900e2 +TargetObjectName : prsadhu-TestVM +Task : {DisableProtectionOnPrimary, UpdateDraState} +Type : Microsoft.RecoveryServices/vaults/replicationJobs + +``` + +By machine id. + +### Example 2: By input object +```powershell +$obj = Get-AzMigrateServerReplication -TargetObjectID $env.srsMachineId -SubscriptionId $env.srsSubscriptionId +Start-AzMigrateTestMigration -InputObject $obj -TestNetworkId '/subscriptions/xxx-xxx-xxx/resourceGroups/AzMigratePWSHtargetRG/providers/Microsoft.Network/virtualNetworks/AzMigrateTargetNetwork' +``` + +```output +ActivityId : da958651-96b3-4e65-a41e-897d4b06f7dd ActivityId: 3a4c8d4d-920a-47cd-82c3-f3dcce90a588 +AllowedAction : {Cancel} +CustomDetailAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.JobDetailsAffectedObjectDetails +CustomDetailInstanceType : AsrJobDetails +EndTime : +Error : {} +FriendlyName : Test Migrate +Id : /Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.Recover + yServices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationJobs/931dde9a-de67-4a30-a045-bb9d6162f8ab +Location : +Name : 931dde9a-de67-4a30-a045-bb9d6162f8ab +ScenarioName : TestMigrate +StartTime : 9/25/20 9:20:08 PM +State : InProgress +StateDescription : InProgress +TargetInstanceType : ProtectionEntity +TargetObjectId : 101883a0-23f7-538a-bbd5-6d8b4fa900e2 +TargetObjectName : prsadhu-TestVM +Task : {DisableProtectionOnPrimary, UpdateDraState} +Type : Microsoft.RecoveryServices/vaults/replicationJobs + +``` + +By input object. + +## 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 +Specifies the replicating server for which the test migration needs to be initiated. +The server object can be retrieved using the Get-AzMigrateServerReplication cmdlet. +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem +Parameter Sets: ByInputObjectVMwareCbt +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NicToUpdate +Updates the NIC for the Azure VM to be created. +To construct, see NOTES section for NICTOUPDATE properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IVMwareCbtNicInput[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OsUpgradeVersion +Specifies the target version to which the Os has to be upgraded to. +The valid values can be selected from SupportedOSVersions retrieved using Get-AzMigrateServerReplication cmdlet. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure 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 +``` + +### -TargetObjectID +Specifies the replicating server for which the test migration needs to be initiated. +The ID should be retrieved using the Get-AzMigrateServerReplication cmdlet. + +```yaml +Type: System.String +Parameter Sets: ByIDVMwareCbt +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TestNetworkID +Updates the Virtual Network id within the destination Azure subscription to be used for test migration. + +```yaml +Type: System.String +Parameter Sets: (All) +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 + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IJob + +## NOTES + +## RELATED LINKS + diff --git a/src/Migrate/Migrate.Autorest/help/Start-AzMigrateTestMigrationCleanup.md b/src/Migrate/Migrate.Autorest/help/Start-AzMigrateTestMigrationCleanup.md new file mode 100644 index 000000000000..d45d35cffdde --- /dev/null +++ b/src/Migrate/Migrate.Autorest/help/Start-AzMigrateTestMigrationCleanup.md @@ -0,0 +1,174 @@ +--- +external help file: +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/start-azmigratetestmigrationcleanup +schema: 2.0.0 +--- + +# Start-AzMigrateTestMigrationCleanup + +## SYNOPSIS +Cleans up the test migration for the replicating server. + +## SYNTAX + +### ByIDVMwareCbt (Default) +``` +Start-AzMigrateTestMigrationCleanup -TargetObjectID [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### ByInputObjectVMwareCbt +``` +Start-AzMigrateTestMigrationCleanup -InputObject [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +## DESCRIPTION +The Start-AzMigrateTestMigrationCleanup cmdlet initiates the clean up of the test migration for the replicating server. + +## EXAMPLES + +### Example 1: By machine id. +```powershell +Start-AzMigrateTestMigrationCleanup -TargetObjectID '/Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.RecoveryServices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationFabrics/AzMigratePWSHTc8d1replicationfabric/replicationProtectionContainers/AzMigratePWSHTc8d1replicationcontainer/replicationMigrationItems/bcdr-vcenter-fareast-corp-micro-cfcc5a24-a40e-56b9-a6af-e206c9ca4f93_50063baa-9806-d6d6-7e09-c0ae87309b4f' +``` + +```output +ActivityId : da958651-96b3-4e65-a41e-897d4b06f7dd ActivityId: 3a4c8d4d-920a-47cd-82c3-f3dcce90a588 +AllowedAction : {Cancel} +CustomDetailAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.JobDetailsAffectedObjectDetails +CustomDetailInstanceType : AsrJobDetails +EndTime : +Error : {} +FriendlyName : Test Migrate Cleanup +Id : /Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.Recover + yServices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationJobs/931dde9a-de67-4a30-a045-bb9d6162f8ab +Location : +Name : 931dde9a-de67-4a30-a045-bb9d6162f8ab +ScenarioName : TestMigrateCleanup +StartTime : 9/25/20 9:20:08 PM +State : InProgress +StateDescription : InProgress +TargetInstanceType : ProtectionEntity +TargetObjectId : 101883a0-23f7-538a-bbd5-6d8b4fa900e2 +TargetObjectName : prsadhu-TestVM +Task : {DisableProtectionOnPrimary, UpdateDraState} +Type : Microsoft.RecoveryServices/vaults/replicationJobs + +``` + +By machine id. + +### Example 2: By input object +```powershell +$obj = Get-AzMigrateServerReplication -TargetObjectID $env.srsMachineId -SubscriptionId $env.srsSubscriptionId +Start-AzMigrateTestMigrationCleanup -InputObject $ob +``` + +```output +AllowedOperation : {DisableMigration, TestMigrate, Migrate} + +ActivityId : da958651-96b3-4e65-a41e-897d4b06f7dd ActivityId: 3a4c8d4d-920a-47cd-82c3-f3dcce90a588 +AllowedAction : {Cancel} +CustomDetailAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.JobDetailsAffectedObjectDetails +CustomDetailInstanceType : AsrJobDetails +EndTime : +Error : {} +FriendlyName : Test Migrate Cleanup +Id : /Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.Recover + yServices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationJobs/931dde9a-de67-4a30-a045-bb9d6162f8ab +Location : +Name : 931dde9a-de67-4a30-a045-bb9d6162f8ab +ScenarioName : TestMigrateCleanup +StartTime : 9/25/20 9:20:08 PM +State : InProgress +StateDescription : InProgress +TargetInstanceType : ProtectionEntity +TargetObjectId : 101883a0-23f7-538a-bbd5-6d8b4fa900e2 +TargetObjectName : prsadhu-TestVM +Task : {DisableProtectionOnPrimary, UpdateDraState} +Type : Microsoft.RecoveryServices/vaults/replicationJobs + +``` + +By input object. + +## 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 +Specifies the replicating server for which the test migration cleanup needs to be initiated. +The server object can be retrieved using the Get-AzMigrateServerReplication cmdlet +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem +Parameter Sets: ByInputObjectVMwareCbt +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure 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 +``` + +### -TargetObjectID +Specifies the replicating server for which the test migration cleanup needs to be initiated. +The ID should be retrieved using the Get-AzMigrateServerReplication cmdlet. + +```yaml +Type: System.String +Parameter Sets: ByIDVMwareCbt +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 + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IJob + +## NOTES + +## RELATED LINKS + diff --git a/src/Migrate/Migrate.Autorest/help/Suspend-AzMigrateServerReplication.md b/src/Migrate/Migrate.Autorest/help/Suspend-AzMigrateServerReplication.md new file mode 100644 index 000000000000..83941e017a03 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/help/Suspend-AzMigrateServerReplication.md @@ -0,0 +1,201 @@ +--- +external help file: +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/suspend-azmigrateserverreplication +schema: 2.0.0 +--- + +# Suspend-AzMigrateServerReplication + +## SYNOPSIS +Suspends the ongoing replication. + +## SYNTAX + +### ByIDVMwareCbt (Default) +``` +Suspend-AzMigrateServerReplication -TargetObjectID [-SubscriptionId ] + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### ByInputObjectVMwareCbt +``` +Suspend-AzMigrateServerReplication -InputObject [-SubscriptionId ] + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +The Suspend-AzMigrateServerReplication suspends the ongoing replication. + +## EXAMPLES + +### Example 1: By machine id. +```powershell +Suspend-AzMigrateServerReplication -TargetObjectID "/Subscriptions/xxx-xxx-xxxxxx-xxx-xxx/resourceGroups/cbtsignoff2201rg/providers/Microsoft.RecoveryServices/vaults/signoffccyapp3352vault/replicationFabrics/signoffccyappae52replicationfabric/replicationProtectionContainers/signoffccyappae52replicationcontainer/replicationMigrationItems/idclab-vcen67-fareast-corp-micr-0f144e99-ba36-4649-b92b-8b06854aa539_5015f6d8-fc84-afdf-de47-1eab79330f00" +``` + +```output +ActivityId : da61a495-48b7-40df-a251-f23f491b2566 ActivityId: e16e0301-be13-4c35-8242-1451cb057994 +AllowedAction : {} +CustomDetailAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.JobDetailsAffectedObjectDetails +CustomDetailInstanceType : AsrJobDetails +EndTime : +Error : {} +FriendlyName : Pause replication +Id : /Subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/cbtsignoff2201rg/providers/Microsoft.RecoveryServices/vaults/signoff + ccyapp3352vault/replicationJobs/6ded7417-b939-4c30-b622-d80a63865025 +Location : +Name : 6ded7417-b939-4c30-b622-d80a63865025 +ScenarioName : PauseReplication +StartTime : 9/25/2022 9:10:42 PM +State : InProgress +StateDescription : InProgress +TargetInstanceType : ProtectionEntity +TargetObjectId : 52896ea4-214d-5825-bc32-24169dfcc44c +TargetObjectName : Win2k16 +Task : {PauseReplicationPreflightChecksTask, PauseReplicationTask} +Type : Microsoft.RecoveryServices/vaults/replicationJobs +``` + +By machine id. + +### Example 2: By input object +```powershell +$obj = Get-AzMigrateServerReplication -ProjectName "signoffccyproj" -ResourceGroupName "cbtsignoff2201rg" -MachineName "Win2k16" +Suspend-AzMigrateServerReplication -InputObject $obj +``` + +```output +ActivityId : da61a495-48b7-40df-a251-f23f491b2566 ActivityId: e16e0301-be13-4c35-8242-1451cb057994 +AllowedAction : {} +CustomDetailAffectedObjectDetail : Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.JobDetailsAffectedObjectDetails +CustomDetailInstanceType : AsrJobDetails +EndTime : +Error : {} +FriendlyName : Pause replication +Id : /Subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/cbtsignoff2201rg/providers/Microsoft.RecoveryServices/vaults/signoff + ccyapp3352vault/replicationJobs/6ded7417-b939-4c30-b622-d80a63865025 +Location : +Name : 6ded7417-b939-4c30-b622-d80a63865025 +ScenarioName : PauseReplication +StartTime : 9/25/2022 9:10:42 PM +State : InProgress +StateDescription : InProgress +TargetInstanceType : ProtectionEntity +TargetObjectId : 52896ea4-214d-5825-bc32-24169dfcc44c +TargetObjectName : Win2k16 +Task : {PauseReplicationPreflightChecksTask, PauseReplicationTask} +Type : Microsoft.RecoveryServices/vaults/replicationJobs +``` + +By input object. + +## 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 +Specifies the replicating server for which the suspend replication needs to be initiated. +The server object can be retrieved using the Get-AzMigrateServerReplication cmdlet +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem +Parameter Sets: ByInputObjectVMwareCbt +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure 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 +``` + +### -TargetObjectID +Specifies the replicating server for which the suspend replication needs to be initiated. +The ID should be retrieved using the Get-AzMigrateServerReplication cmdlet. + +```yaml +Type: System.String +Parameter Sets: ByIDVMwareCbt +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.Migrate.Models.Api202301.IJob + +## NOTES + +## RELATED LINKS + diff --git a/src/Migrate/Migrate.Autorest/internal/Get-AzMigrateDra.ps1 b/src/Migrate/Migrate.Autorest/internal/Get-AzMigrateDra.ps1 new file mode 100644 index 000000000000..180f33aa8012 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/internal/Get-AzMigrateDra.ps1 @@ -0,0 +1,219 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# 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. +# 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 fabric agent. +.Description +Gets the details of the fabric agent. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModel +.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 + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratedra +#> +function Get-AzMigrateDra { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModel])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The fabric agent (Dra) name. + ${FabricAgentName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure Subscription Id in which migrate project was created. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # 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.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + Get = 'Az.Migrate.private\Get-AzMigrateDra_Get'; + GetViaIdentity = 'Az.Migrate.private\Get-AzMigrateDra_GetViaIdentity'; + List = 'Az.Migrate.private\Get-AzMigrateDra_List'; + } + if (('Get', '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/src/Migrate/Migrate.Autorest/internal/Get-AzMigrateHyperVMachine.ps1 b/src/Migrate/Migrate.Autorest/internal/Get-AzMigrateHyperVMachine.ps1 new file mode 100644 index 000000000000..09414c73a1bf --- /dev/null +++ b/src/Migrate/Migrate.Autorest/internal/Get-AzMigrateHyperVMachine.ps1 @@ -0,0 +1,179 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Method to get machine. +.Description +Method to get machine. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVMachine +.Link +https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratehypervmachine +#> +function Get-AzMigrateHyperVMachine { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVMachine])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Site name. + ${SiteName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Machine ARM name. + ${MachineName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')] + [System.String] + # Optional parameter for continuation token. + ${ContinuationToken}, + + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')] + [System.String] + # . + ${Filter}, + + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')] + [System.Int32] + # . + ${Top}, + + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')] + [System.Int32] + # Total count of machines in the given site. + ${TotalRecordCount}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + Get = 'Az.Migrate.private\Get-AzMigrateHyperVMachine_Get'; + List = 'Az.Migrate.private\Get-AzMigrateHyperVMachine_List'; + } + if (('Get', '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/src/Migrate/Migrate.Autorest/internal/Get-AzMigrateHyperVRunAsAccount.ps1 b/src/Migrate/Migrate.Autorest/internal/Get-AzMigrateHyperVRunAsAccount.ps1 new file mode 100644 index 000000000000..848eb37e00b7 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/internal/Get-AzMigrateHyperVRunAsAccount.ps1 @@ -0,0 +1,155 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Method to get run as account. +.Description +Method to get run as account. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVRunAsAccount +.Link +https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratehypervrunasaccount +#> +function Get-AzMigrateHyperVRunAsAccount { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVRunAsAccount])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Site name. + ${SiteName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Run as account ARM name. + ${AccountName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + Get = 'Az.Migrate.private\Get-AzMigrateHyperVRunAsAccount_Get'; + List = 'Az.Migrate.private\Get-AzMigrateHyperVRunAsAccount_List'; + } + if (('Get', '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/src/Migrate/Migrate.Autorest/internal/Get-AzMigrateHyperVSite.ps1 b/src/Migrate/Migrate.Autorest/internal/Get-AzMigrateHyperVSite.ps1 new file mode 100644 index 000000000000..cd9a2ea264bd --- /dev/null +++ b/src/Migrate/Migrate.Autorest/internal/Get-AzMigrateHyperVSite.ps1 @@ -0,0 +1,223 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Method to get a site. +.Description +Method to get a site. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVSite +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVSiteUsage +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.ISiteHealthSummary +.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 + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratehypervsite +#> +function Get-AzMigrateHyperVSite { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVSite], [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.ISiteHealthSummary], [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVSiteUsage])] +[CmdletBinding(DefaultParameterSetName='Get', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='Get1', Mandatory)] + [Parameter(ParameterSetName='Get2', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='Get1', Mandatory)] + [Parameter(ParameterSetName='Get2', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Site name. + ${SiteName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='Get1')] + [Parameter(ParameterSetName='Get2')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity1', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='GetViaIdentity2', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # 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.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + Get = 'Az.Migrate.private\Get-AzMigrateHyperVSite_Get'; + Get1 = 'Az.Migrate.private\Get-AzMigrateHyperVSite_Get1'; + Get2 = 'Az.Migrate.private\Get-AzMigrateHyperVSite_Get2'; + GetViaIdentity1 = 'Az.Migrate.private\Get-AzMigrateHyperVSite_GetViaIdentity1'; + GetViaIdentity2 = 'Az.Migrate.private\Get-AzMigrateHyperVSite_GetViaIdentity2'; + } + if (('Get', 'Get1', 'Get2') -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/src/Migrate/Migrate.Autorest/internal/Get-AzMigrateOperation.ps1 b/src/Migrate/Migrate.Autorest/internal/Get-AzMigrateOperation.ps1 index 184ef1c8012c..5033237e7310 100644 --- a/src/Migrate/Migrate.Autorest/internal/Get-AzMigrateOperation.ps1 +++ b/src/Migrate/Migrate.Autorest/internal/Get-AzMigrateOperation.ps1 @@ -28,11 +28,13 @@ Get list of operations supported in the API. Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IOperation .Outputs Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IOperationsDiscovery +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGenerated .Link https://learn.microsoft.com/powershell/module/az.migrate/get-azmigrateoperation #> function Get-AzMigrateOperation { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IOperation], [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IOperationsDiscovery])] +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IOperation], [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IOperationsDiscovery], [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGenerated])] [CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] param( [Parameter(ParameterSetName='List2', Mandatory)] @@ -109,6 +111,7 @@ begin { List = 'Az.Migrate.private\Get-AzMigrateOperation_List'; List1 = 'Az.Migrate.private\Get-AzMigrateOperation_List1'; List2 = 'Az.Migrate.private\Get-AzMigrateOperation_List2'; + List3 = 'Az.Migrate.private\Get-AzMigrateOperation_List3'; } if (('List2') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id diff --git a/src/Migrate/Migrate.Autorest/internal/Get-AzMigratePolicy.ps1 b/src/Migrate/Migrate.Autorest/internal/Get-AzMigratePolicy.ps1 new file mode 100644 index 000000000000..9183ac50fae5 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/internal/Get-AzMigratePolicy.ps1 @@ -0,0 +1,220 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# 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. +# 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 policy. +.Description +Gets the details of the policy. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel +.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 + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratepolicy +#> +function Get-AzMigratePolicy { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('PolicyName')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The policy name. + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure Subscription Id in which migrate project was created. + ${SubscriptionId}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The vault name. + ${VaultName}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # 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.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + Get = 'Az.Migrate.private\Get-AzMigratePolicy_Get'; + GetViaIdentity = 'Az.Migrate.private\Get-AzMigratePolicy_GetViaIdentity'; + List = 'Az.Migrate.private\Get-AzMigratePolicy_List'; + } + if (('Get', '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/src/Migrate/Migrate.Autorest/internal/Get-AzMigratePolicyOperationStatus.ps1 b/src/Migrate/Migrate.Autorest/internal/Get-AzMigratePolicyOperationStatus.ps1 new file mode 100644 index 000000000000..b4848979a950 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/internal/Get-AzMigratePolicyOperationStatus.ps1 @@ -0,0 +1,221 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Tracks the results of an asynchronous operation on the policy. +.Description +Tracks the results of an asynchronous operation on the policy. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationStatusAutoGenerated +.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 + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratepolicyoperationstatus +#> +function Get-AzMigratePolicyOperationStatus { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationStatusAutoGenerated])] +[CmdletBinding(DefaultParameterSetName='Get', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The ID of an ongoing async operation. + ${OperationId}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The policy name. + ${PolicyName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure Subscription Id in which migrate project was created. + ${SubscriptionId}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The vault name. + ${VaultName}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # 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.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + Get = 'Az.Migrate.private\Get-AzMigratePolicyOperationStatus_Get'; + GetViaIdentity = 'Az.Migrate.private\Get-AzMigratePolicyOperationStatus_GetViaIdentity'; + } + if (('Get') -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/src/Migrate/Migrate.Autorest/internal/Get-AzMigrateProtectedItem.ps1 b/src/Migrate/Migrate.Autorest/internal/Get-AzMigrateProtectedItem.ps1 new file mode 100644 index 000000000000..e831ae958556 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/internal/Get-AzMigrateProtectedItem.ps1 @@ -0,0 +1,220 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# 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. +# 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 protected item. +.Description +Gets the details of the protected item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel +.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 + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/get-azmigrateprotecteditem +#> +function Get-AzMigrateProtectedItem { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('ProtectedItemName')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The protected item name. + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure Subscription Id in which migrate project was created. + ${SubscriptionId}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The vault name. + ${VaultName}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # 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.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + Get = 'Az.Migrate.private\Get-AzMigrateProtectedItem_Get'; + GetViaIdentity = 'Az.Migrate.private\Get-AzMigrateProtectedItem_GetViaIdentity'; + List = 'Az.Migrate.private\Get-AzMigrateProtectedItem_List'; + } + if (('Get', '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/src/Migrate/Migrate.Autorest/internal/Get-AzMigrateReplicationExtension.ps1 b/src/Migrate/Migrate.Autorest/internal/Get-AzMigrateReplicationExtension.ps1 new file mode 100644 index 000000000000..dc07b006457a --- /dev/null +++ b/src/Migrate/Migrate.Autorest/internal/Get-AzMigrateReplicationExtension.ps1 @@ -0,0 +1,220 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# 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. +# 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 replication extension. +.Description +Gets the details of the replication extension. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel +.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 + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratereplicationextension +#> +function Get-AzMigrateReplicationExtension { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('ReplicationExtensionName')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The replication extension name. + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure Subscription Id in which migrate project was created. + ${SubscriptionId}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The vault name. + ${VaultName}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # 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.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + Get = 'Az.Migrate.private\Get-AzMigrateReplicationExtension_Get'; + GetViaIdentity = 'Az.Migrate.private\Get-AzMigrateReplicationExtension_GetViaIdentity'; + List = 'Az.Migrate.private\Get-AzMigrateReplicationExtension_List'; + } + if (('Get', '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/src/Migrate/Migrate.Autorest/internal/Get-AzMigrateReplicationExtensionOperationStatus.ps1 b/src/Migrate/Migrate.Autorest/internal/Get-AzMigrateReplicationExtensionOperationStatus.ps1 new file mode 100644 index 000000000000..69196e88ac10 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/internal/Get-AzMigrateReplicationExtensionOperationStatus.ps1 @@ -0,0 +1,221 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Tracks the results of an asynchronous operation on the replication extension. +.Description +Tracks the results of an asynchronous operation on the replication extension. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationStatusAutoGenerated +.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 + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratereplicationextensionoperationstatus +#> +function Get-AzMigrateReplicationExtensionOperationStatus { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationStatusAutoGenerated])] +[CmdletBinding(DefaultParameterSetName='Get', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The ID of an ongoing async operation. + ${OperationId}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The replication extension name. + ${ReplicationExtensionName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure Subscription Id in which migrate project was created. + ${SubscriptionId}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The vault name. + ${VaultName}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # 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.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + Get = 'Az.Migrate.private\Get-AzMigrateReplicationExtensionOperationStatus_Get'; + GetViaIdentity = 'Az.Migrate.private\Get-AzMigrateReplicationExtensionOperationStatus_GetViaIdentity'; + } + if (('Get') -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/src/Migrate/Migrate.Autorest/internal/Get-AzMigrateVCenter.ps1 b/src/Migrate/Migrate.Autorest/internal/Get-AzMigrateVCenter.ps1 index dc5039405ef0..bc9e2b8685f6 100644 --- a/src/Migrate/Migrate.Autorest/internal/Get-AzMigrateVCenter.ps1 +++ b/src/Migrate/Migrate.Autorest/internal/Get-AzMigrateVCenter.ps1 @@ -39,12 +39,16 @@ INPUTOBJECT : Identity Parameter [ClusterName ]: Cluster ARM name. [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. [FabricName ]: Fabric name. [HostName ]: Host ARM name. [Id ]: Resource identity path [IntentObjectName ]: Replication protection intent name. [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. [LogicalNetworkName ]: Logical network name. [MachineName ]: Machine ARM name. [MappingName ]: Protection Container mapping name. @@ -53,14 +57,17 @@ INPUTOBJECT : Identity Parameter [MigrationRecoveryPointName ]: The migration recovery point name. [NetworkMappingName ]: Network mapping name. [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. [OperationStatusName ]: Operation status ARM name. [PolicyName ]: Replication policy name. [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. [ProtectionContainerName ]: Protection container name. [ProviderName ]: Recovery services provider name. [RecoveryPlanName ]: Name of the recovery plan. [RecoveryPointName ]: The recovery point name. [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. [ResourceGroupName ]: The name of the resource group. The name is case insensitive. [ResourceName ]: The name of the recovery services vault. [SiteName ]: Site name. @@ -68,6 +75,7 @@ INPUTOBJECT : Identity Parameter [StorageClassificationMappingName ]: Storage classification mapping name. [StorageClassificationName ]: Storage classification name. [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. [VaultSettingName ]: Vault setting name. [VcenterName ]: VCenter ARM name. [VirtualMachineName ]: Virtual Machine name. diff --git a/src/Migrate/Migrate.Autorest/internal/Get-AzMigrateVault.ps1 b/src/Migrate/Migrate.Autorest/internal/Get-AzMigrateVault.ps1 new file mode 100644 index 000000000000..803e2156abdd --- /dev/null +++ b/src/Migrate/Migrate.Autorest/internal/Get-AzMigrateVault.ps1 @@ -0,0 +1,222 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# 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. +# 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 vault. +.Description +Gets the details of the vault. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModel +.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 + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratevault +#> +function Get-AzMigrateVault { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModel])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('VaultName')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The vault name. + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure Subscription Id in which migrate project was created. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # 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.Migrate.Category('Query')] + [System.String] + # Continuation token from the previous call. + ${ContinuationToken}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + Get = 'Az.Migrate.private\Get-AzMigrateVault_Get'; + GetViaIdentity = 'Az.Migrate.private\Get-AzMigrateVault_GetViaIdentity'; + List = 'Az.Migrate.private\Get-AzMigrateVault_List'; + List1 = 'Az.Migrate.private\Get-AzMigrateVault_List1'; + } + if (('Get', 'List', 'List1') -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/src/Migrate/Migrate.Autorest/internal/Get-AzMigrateWorkflow.ps1 b/src/Migrate/Migrate.Autorest/internal/Get-AzMigrateWorkflow.ps1 new file mode 100644 index 000000000000..f70154a7e761 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/internal/Get-AzMigrateWorkflow.ps1 @@ -0,0 +1,231 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# 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. +# 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 job. +.Description +Gets the details of the job. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel +.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 + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/get-azmigrateworkflow +#> +function Get-AzMigrateWorkflow { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The job (workflow) name. + ${JobName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure Subscription Id in which migrate project was created. + ${SubscriptionId}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The vault name. + ${VaultName}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')] + [System.String] + # Continuation token. + ${ContinuationToken}, + + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')] + [System.String] + # Filter string. + ${Filter}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + Get = 'Az.Migrate.private\Get-AzMigrateWorkflow_Get'; + GetViaIdentity = 'Az.Migrate.private\Get-AzMigrateWorkflow_GetViaIdentity'; + List = 'Az.Migrate.private\Get-AzMigrateWorkflow_List'; + } + if (('Get', '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/src/Migrate/Migrate.Autorest/internal/Invoke-AzMigratePlannedProtectedItemFailover.ps1 b/src/Migrate/Migrate.Autorest/internal/Invoke-AzMigratePlannedProtectedItemFailover.ps1 new file mode 100644 index 000000000000..192c1641c42e --- /dev/null +++ b/src/Migrate/Migrate.Autorest/internal/Invoke-AzMigratePlannedProtectedItemFailover.ps1 @@ -0,0 +1,261 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Performs the planned failover on the protected item. +.Description +Performs the planned failover on the protected item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModel +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelProperties +.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. + +BODY : Planned failover model. + Property : Planned failover model properties. + CustomProperty : Planned failover model custom properties. + InstanceType : Gets or sets the instance type. + +INPUTOBJECT : Identity Parameter + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. + +PROPERTY : Planned failover model properties. + CustomProperty : Planned failover model custom properties. + InstanceType : Gets or sets the instance type. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/invoke-azmigrateplannedprotecteditemfailover +#> +function Invoke-AzMigratePlannedProtectedItemFailover { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelProperties])] +[CmdletBinding(DefaultParameterSetName='PlannedViaIdentity', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Planned', Mandatory)] + [Parameter(ParameterSetName='PlannedExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The protected item name. + ${ProtectedItemName}, + + [Parameter(ParameterSetName='Planned', Mandatory)] + [Parameter(ParameterSetName='PlannedExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Planned')] + [Parameter(ParameterSetName='PlannedExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure Subscription Id in which migrate project was created. + ${SubscriptionId}, + + [Parameter(ParameterSetName='Planned', Mandatory)] + [Parameter(ParameterSetName='PlannedExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The vault name. + ${VaultName}, + + [Parameter(ParameterSetName='PlannedViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='PlannedViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # 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.Migrate.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModel] + # Planned failover model. + # To construct, see NOTES section for BODY properties and create a hash table. + ${Body}, + + [Parameter(ParameterSetName='PlannedExpanded', Mandatory)] + [Parameter(ParameterSetName='PlannedViaIdentityExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelProperties] + # Planned failover model properties. + # To construct, see NOTES section for PROPERTY properties and create a hash table. + ${Property}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + Planned = 'Az.Migrate.private\Invoke-AzMigratePlannedProtectedItemFailover_Planned'; + PlannedExpanded = 'Az.Migrate.private\Invoke-AzMigratePlannedProtectedItemFailover_PlannedExpanded'; + PlannedViaIdentity = 'Az.Migrate.private\Invoke-AzMigratePlannedProtectedItemFailover_PlannedViaIdentity'; + PlannedViaIdentityExpanded = 'Az.Migrate.private\Invoke-AzMigratePlannedProtectedItemFailover_PlannedViaIdentityExpanded'; + } + if (('Planned', 'PlannedExpanded') -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/src/Migrate/Migrate.Autorest/internal/New-AzMigratePolicy.ps1 b/src/Migrate/Migrate.Autorest/internal/New-AzMigratePolicy.ps1 new file mode 100644 index 000000000000..551463a7d088 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/internal/New-AzMigratePolicy.ps1 @@ -0,0 +1,268 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Creates the policy. +.Description +Creates the policy. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel +.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. + +BODY : Policy model. + Property : Policy model properties. + CustomProperty : Policy model custom properties. + InstanceType : Gets or sets the instance type. + [SystemDataCreatedAt ]: Gets or sets the timestamp of resource creation (UTC). + [SystemDataCreatedBy ]: Gets or sets identity that created the resource. + [SystemDataCreatedByType ]: Gets or sets the type of identity that created the resource: user, application, managedIdentity. + [SystemDataLastModifiedAt ]: Gets or sets the timestamp of resource last modification (UTC). + [SystemDataLastModifiedBy ]: Gets or sets the identity that last modified the resource. + [SystemDataLastModifiedByType ]: Gets or sets the type of identity that last modified the resource: user, application, managedIdentity. + +INPUTOBJECT : Identity Parameter + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. + +PROPERTY : Policy model properties. + CustomProperty : Policy model custom properties. + InstanceType : Gets or sets the instance type. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratepolicy +#> +function New-AzMigratePolicy { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel])] +[CmdletBinding(DefaultParameterSetName='CreateViaIdentity', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Create', Mandatory)] + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Alias('PolicyName')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The policy name. + ${Name}, + + [Parameter(ParameterSetName='Create', Mandatory)] + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Create')] + [Parameter(ParameterSetName='CreateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure Subscription Id in which migrate project was created. + ${SubscriptionId}, + + [Parameter(ParameterSetName='Create', Mandatory)] + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The vault name. + ${VaultName}, + + [Parameter(ParameterSetName='CreateViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='CreateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Create', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='CreateViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel] + # Policy model. + # To construct, see NOTES section for BODY properties and create a hash table. + ${Body}, + + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaIdentityExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelProperties] + # Policy model properties. + # To construct, see NOTES section for PROPERTY properties and create a hash table. + ${Property}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + Create = 'Az.Migrate.private\New-AzMigratePolicy_Create'; + CreateExpanded = 'Az.Migrate.private\New-AzMigratePolicy_CreateExpanded'; + CreateViaIdentity = 'Az.Migrate.private\New-AzMigratePolicy_CreateViaIdentity'; + CreateViaIdentityExpanded = 'Az.Migrate.private\New-AzMigratePolicy_CreateViaIdentityExpanded'; + } + if (('Create', 'CreateExpanded') -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/src/Migrate/Migrate.Autorest/internal/New-AzMigrateProtectedItem.ps1 b/src/Migrate/Migrate.Autorest/internal/New-AzMigrateProtectedItem.ps1 new file mode 100644 index 000000000000..57f61b90a7c0 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/internal/New-AzMigrateProtectedItem.ps1 @@ -0,0 +1,272 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Creates the protected item. +.Description +Creates the protected item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel +.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. + +BODY : Protected item model. + Property : Protected item model properties. + CustomProperty : Protected item model custom properties. + InstanceType : Gets or sets the instance type. + PolicyName : Gets or sets the policy name. + ReplicationExtensionName : Gets or sets the replication extension name. + [SystemDataCreatedAt ]: Gets or sets the timestamp of resource creation (UTC). + [SystemDataCreatedBy ]: Gets or sets identity that created the resource. + [SystemDataCreatedByType ]: Gets or sets the type of identity that created the resource: user, application, managedIdentity. + [SystemDataLastModifiedAt ]: Gets or sets the timestamp of resource last modification (UTC). + [SystemDataLastModifiedBy ]: Gets or sets the identity that last modified the resource. + [SystemDataLastModifiedByType ]: Gets or sets the type of identity that last modified the resource: user, application, managedIdentity. + +INPUTOBJECT : Identity Parameter + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. + +PROPERTY : Protected item model properties. + CustomProperty : Protected item model custom properties. + InstanceType : Gets or sets the instance type. + PolicyName : Gets or sets the policy name. + ReplicationExtensionName : Gets or sets the replication extension name. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/new-azmigrateprotecteditem +#> +function New-AzMigrateProtectedItem { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel])] +[CmdletBinding(DefaultParameterSetName='CreateViaIdentity', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Create', Mandatory)] + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Alias('ProtectedItemName')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The protected item name. + ${Name}, + + [Parameter(ParameterSetName='Create', Mandatory)] + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Create')] + [Parameter(ParameterSetName='CreateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure Subscription Id in which migrate project was created. + ${SubscriptionId}, + + [Parameter(ParameterSetName='Create', Mandatory)] + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The vault name. + ${VaultName}, + + [Parameter(ParameterSetName='CreateViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='CreateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Create', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='CreateViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel] + # Protected item model. + # To construct, see NOTES section for BODY properties and create a hash table. + ${Body}, + + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaIdentityExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelProperties] + # Protected item model properties. + # To construct, see NOTES section for PROPERTY properties and create a hash table. + ${Property}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + Create = 'Az.Migrate.private\New-AzMigrateProtectedItem_Create'; + CreateExpanded = 'Az.Migrate.private\New-AzMigrateProtectedItem_CreateExpanded'; + CreateViaIdentity = 'Az.Migrate.private\New-AzMigrateProtectedItem_CreateViaIdentity'; + CreateViaIdentityExpanded = 'Az.Migrate.private\New-AzMigrateProtectedItem_CreateViaIdentityExpanded'; + } + if (('Create', 'CreateExpanded') -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/src/Migrate/Migrate.Autorest/internal/New-AzMigrateReplicationExtension.ps1 b/src/Migrate/Migrate.Autorest/internal/New-AzMigrateReplicationExtension.ps1 new file mode 100644 index 000000000000..fbe4a71ced52 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/internal/New-AzMigrateReplicationExtension.ps1 @@ -0,0 +1,268 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Creates the replication extension in the given vault. +.Description +Creates the replication extension in the given vault. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel +.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. + +BODY : Replication extension model. + Property : Replication extension model properties. + CustomProperty : Replication extension model custom properties. + InstanceType : Gets or sets the instance type. + [SystemDataCreatedAt ]: Gets or sets the timestamp of resource creation (UTC). + [SystemDataCreatedBy ]: Gets or sets identity that created the resource. + [SystemDataCreatedByType ]: Gets or sets the type of identity that created the resource: user, application, managedIdentity. + [SystemDataLastModifiedAt ]: Gets or sets the timestamp of resource last modification (UTC). + [SystemDataLastModifiedBy ]: Gets or sets the identity that last modified the resource. + [SystemDataLastModifiedByType ]: Gets or sets the type of identity that last modified the resource: user, application, managedIdentity. + +INPUTOBJECT : Identity Parameter + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. + +PROPERTY : Replication extension model properties. + CustomProperty : Replication extension model custom properties. + InstanceType : Gets or sets the instance type. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratereplicationextension +#> +function New-AzMigrateReplicationExtension { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel])] +[CmdletBinding(DefaultParameterSetName='CreateViaIdentity', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Create', Mandatory)] + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Alias('ReplicationExtensionName')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The replication extension name. + ${Name}, + + [Parameter(ParameterSetName='Create', Mandatory)] + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Create')] + [Parameter(ParameterSetName='CreateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure Subscription Id in which migrate project was created. + ${SubscriptionId}, + + [Parameter(ParameterSetName='Create', Mandatory)] + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The vault name. + ${VaultName}, + + [Parameter(ParameterSetName='CreateViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='CreateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Create', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='CreateViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel] + # Replication extension model. + # To construct, see NOTES section for BODY properties and create a hash table. + ${Body}, + + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaIdentityExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelProperties] + # Replication extension model properties. + # To construct, see NOTES section for PROPERTY properties and create a hash table. + ${Property}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + Create = 'Az.Migrate.private\New-AzMigrateReplicationExtension_Create'; + CreateExpanded = 'Az.Migrate.private\New-AzMigrateReplicationExtension_CreateExpanded'; + CreateViaIdentity = 'Az.Migrate.private\New-AzMigrateReplicationExtension_CreateViaIdentity'; + CreateViaIdentityExpanded = 'Az.Migrate.private\New-AzMigrateReplicationExtension_CreateViaIdentityExpanded'; + } + if (('Create', 'CreateExpanded') -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/src/Migrate/Migrate.Autorest/internal/ProxyCmdletDefinitions.ps1 b/src/Migrate/Migrate.Autorest/internal/ProxyCmdletDefinitions.ps1 index 22f2c5a40dda..cb1b49ca64f8 100644 --- a/src/Migrate/Migrate.Autorest/internal/ProxyCmdletDefinitions.ps1 +++ b/src/Migrate/Migrate.Autorest/internal/ProxyCmdletDefinitions.ps1 @@ -16,73 +16,111 @@ <# .Synopsis -Method to get machine. +Gets the details of the fabric agent. .Description -Method to get machine. +Gets the details of the fabric agent. .Example {{ Add code here }} .Example {{ Add code here }} +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVMwareMachine +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModel +.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 + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. .Link -https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratemachine +https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratedra #> -function Get-AzMigrateMachine { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVMwareMachine])] +function Get-AzMigrateDra { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IDraModel])] [CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] param( - [Parameter(Mandatory)] + [Parameter(ParameterSetName='Get', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [System.String] - # The name of the resource group. - # The name is case insensitive. - ${ResourceGroupName}, + # The fabric agent (Dra) name. + ${FabricAgentName}, - [Parameter(Mandatory)] + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [System.String] - # Site name. - ${SiteName}, + # The fabric name. + ${FabricName}, [Parameter(ParameterSetName='Get', Mandatory)] - [Alias('MachineName')] + [Parameter(ParameterSetName='List', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [System.String] - # Machine ARM name. - ${Name}, + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, - [Parameter()] + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] [System.String[]] - # The ID of the target subscription. + # Azure Subscription Id in which migrate project was created. ${SubscriptionId}, - [Parameter(ParameterSetName='List')] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')] - [System.String] - # Optional parameter for continuation token. - ${ContinuationToken}, - - [Parameter(ParameterSetName='List')] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')] - [System.String] - # . - ${Filter}, - - [Parameter(ParameterSetName='List')] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')] - [System.Int32] - # . - ${Top}, - - [Parameter(ParameterSetName='List')] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')] - [System.Int32] - # Total count of machines in the given site. - ${TotalRecordCount}, + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] @@ -142,8 +180,9 @@ begin { $parameterSet = $PSCmdlet.ParameterSetName $mapping = @{ - Get = 'Az.Migrate.private\Get-AzMigrateMachine_Get'; - List = 'Az.Migrate.private\Get-AzMigrateMachine_List'; + Get = 'Az.Migrate.private\Get-AzMigrateDra_Get'; + GetViaIdentity = 'Az.Migrate.private\Get-AzMigrateDra_GetViaIdentity'; + List = 'Az.Migrate.private\Get-AzMigrateDra_List'; } if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id @@ -181,38 +220,73 @@ end { <# .Synopsis -Get list of operations supported in the API. +Method to get machine. .Description -Get list of operations supported in the API. +Method to get machine. .Example {{ Add code here }} .Example {{ Add code here }} .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IOperation -.Outputs -Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IOperationsDiscovery +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVMachine .Link -https://learn.microsoft.com/powershell/module/az.migrate/get-azmigrateoperation +https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratehypervmachine #> -function Get-AzMigrateOperation { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IOperation], [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IOperationsDiscovery])] +function Get-AzMigrateHyperVMachine { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVMachine])] [CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] param( - [Parameter(ParameterSetName='List2', Mandatory)] + [Parameter(Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [System.String] - # The name of the resource group where the recovery services vault is present. + # The name of the resource group. + # The name is case insensitive. ${ResourceGroupName}, - [Parameter(ParameterSetName='List2')] + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Site name. + ${SiteName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Machine ARM name. + ${MachineName}, + + [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] [System.String[]] - # Azure Subscription Id in which migrate project was created. + # The ID of the target subscription. ${SubscriptionId}, + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')] + [System.String] + # Optional parameter for continuation token. + ${ContinuationToken}, + + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')] + [System.String] + # . + ${Filter}, + + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')] + [System.Int32] + # . + ${Top}, + + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')] + [System.Int32] + # Total count of machines in the given site. + ${TotalRecordCount}, + [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] @@ -271,11 +345,10 @@ begin { $parameterSet = $PSCmdlet.ParameterSetName $mapping = @{ - List = 'Az.Migrate.private\Get-AzMigrateOperation_List'; - List1 = 'Az.Migrate.private\Get-AzMigrateOperation_List1'; - List2 = 'Az.Migrate.private\Get-AzMigrateOperation_List2'; + Get = 'Az.Migrate.private\Get-AzMigrateHyperVMachine_Get'; + List = 'Az.Migrate.private\Get-AzMigrateHyperVMachine_List'; } - if (('List2') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id } @@ -311,54 +384,49 @@ end { <# .Synopsis -Get the details of an Azure Site Recovery job. +Method to get run as account. .Description -Get the details of an Azure Site Recovery job. +Method to get run as account. .Example {{ Add code here }} .Example {{ Add code here }} .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IJob +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVRunAsAccount .Link -https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratereplicationjob +https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratehypervrunasaccount #> -function Get-AzMigrateReplicationJob { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IJob])] +function Get-AzMigrateHyperVRunAsAccount { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVRunAsAccount])] [CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] param( [Parameter(Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [System.String] - # The name of the resource group where the recovery services vault is present. + # The name of the resource group. + # The name is case insensitive. ${ResourceGroupName}, [Parameter(Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [System.String] - # The name of the recovery services vault. - ${ResourceName}, + # Site name. + ${SiteName}, [Parameter(ParameterSetName='Get', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [System.String] - # Job identifier. - ${JobName}, + # Run as account ARM name. + ${AccountName}, [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] [System.String[]] - # Azure Subscription Id in which migrate project was created. + # The ID of the target subscription. ${SubscriptionId}, - [Parameter(ParameterSetName='List')] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')] - [System.String] - # OData filter options. - ${Filter}, - [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] @@ -417,8 +485,8 @@ begin { $parameterSet = $PSCmdlet.ParameterSetName $mapping = @{ - Get = 'Az.Migrate.private\Get-AzMigrateReplicationJob_Get'; - List = 'Az.Migrate.private\Get-AzMigrateReplicationJob_List'; + Get = 'Az.Migrate.private\Get-AzMigrateHyperVRunAsAccount_Get'; + List = 'Az.Migrate.private\Get-AzMigrateHyperVRunAsAccount_List'; } if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id @@ -456,82 +524,4357 @@ end { <# .Synopsis -Gets the details of a migration item. +Method to get a site. .Description -Gets the details of a migration item. +Method to get a site. .Example {{ Add code here }} .Example {{ Add code here }} +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVSite +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVSiteUsage +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.ISiteHealthSummary +.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 + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. .Link -https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratereplicationmigrationitem +https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratehypervsite #> -function Get-AzMigrateReplicationMigrationItem { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem])] -[CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] +function Get-AzMigrateHyperVSite { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVSite], [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.ISiteHealthSummary], [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVSiteUsage])] +[CmdletBinding(DefaultParameterSetName='Get', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='Get1', Mandatory)] + [Parameter(ParameterSetName='Get2', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='Get1', Mandatory)] + [Parameter(ParameterSetName='Get2', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Site name. + ${SiteName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='Get1')] + [Parameter(ParameterSetName='Get2')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity1', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='GetViaIdentity2', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # 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.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + Get = 'Az.Migrate.private\Get-AzMigrateHyperVSite_Get'; + Get1 = 'Az.Migrate.private\Get-AzMigrateHyperVSite_Get1'; + Get2 = 'Az.Migrate.private\Get-AzMigrateHyperVSite_Get2'; + GetViaIdentity1 = 'Az.Migrate.private\Get-AzMigrateHyperVSite_GetViaIdentity1'; + GetViaIdentity2 = 'Az.Migrate.private\Get-AzMigrateHyperVSite_GetViaIdentity2'; + } + if (('Get', 'Get1', 'Get2') -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 + } +} +} + +<# +.Synopsis +Method to get machine. +.Description +Method to get machine. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVMwareMachine +.Link +https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratemachine +#> +function Get-AzMigrateMachine { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVMwareMachine])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Site name. + ${SiteName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('MachineName')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Machine ARM name. + ${Name}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')] + [System.String] + # Optional parameter for continuation token. + ${ContinuationToken}, + + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')] + [System.String] + # . + ${Filter}, + + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')] + [System.Int32] + # . + ${Top}, + + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')] + [System.Int32] + # Total count of machines in the given site. + ${TotalRecordCount}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + Get = 'Az.Migrate.private\Get-AzMigrateMachine_Get'; + List = 'Az.Migrate.private\Get-AzMigrateMachine_List'; + } + if (('Get', '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 + } +} +} + +<# +.Synopsis +Get list of operations supported in the API. +.Description +Get list of operations supported in the API. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IOperation +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IOperationsDiscovery +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGenerated +.Link +https://learn.microsoft.com/powershell/module/az.migrate/get-azmigrateoperation +#> +function Get-AzMigrateOperation { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IOperation], [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IOperationsDiscovery], [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api40.IOperationAutoGenerated])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='List2', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='List2')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure Subscription Id in which migrate project was created. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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.Migrate.private\Get-AzMigrateOperation_List'; + List1 = 'Az.Migrate.private\Get-AzMigrateOperation_List1'; + List2 = 'Az.Migrate.private\Get-AzMigrateOperation_List2'; + List3 = 'Az.Migrate.private\Get-AzMigrateOperation_List3'; + } + if (('List2') -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 + } +} +} + +<# +.Synopsis +Tracks the results of an asynchronous operation on the policy. +.Description +Tracks the results of an asynchronous operation on the policy. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationStatusAutoGenerated +.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 + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratepolicyoperationstatus +#> +function Get-AzMigratePolicyOperationStatus { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationStatusAutoGenerated])] +[CmdletBinding(DefaultParameterSetName='Get', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The ID of an ongoing async operation. + ${OperationId}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The policy name. + ${PolicyName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure Subscription Id in which migrate project was created. + ${SubscriptionId}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The vault name. + ${VaultName}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # 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.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + Get = 'Az.Migrate.private\Get-AzMigratePolicyOperationStatus_Get'; + GetViaIdentity = 'Az.Migrate.private\Get-AzMigratePolicyOperationStatus_GetViaIdentity'; + } + if (('Get') -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 + } +} +} + +<# +.Synopsis +Gets the details of the policy. +.Description +Gets the details of the policy. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel +.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 + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratepolicy +#> +function Get-AzMigratePolicy { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('PolicyName')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The policy name. + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure Subscription Id in which migrate project was created. + ${SubscriptionId}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The vault name. + ${VaultName}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # 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.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + Get = 'Az.Migrate.private\Get-AzMigratePolicy_Get'; + GetViaIdentity = 'Az.Migrate.private\Get-AzMigratePolicy_GetViaIdentity'; + List = 'Az.Migrate.private\Get-AzMigratePolicy_List'; + } + if (('Get', '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 + } +} +} + +<# +.Synopsis +Gets the details of the protected item. +.Description +Gets the details of the protected item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel +.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 + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/get-azmigrateprotecteditem +#> +function Get-AzMigrateProtectedItem { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('ProtectedItemName')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The protected item name. + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure Subscription Id in which migrate project was created. + ${SubscriptionId}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The vault name. + ${VaultName}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # 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.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + Get = 'Az.Migrate.private\Get-AzMigrateProtectedItem_Get'; + GetViaIdentity = 'Az.Migrate.private\Get-AzMigrateProtectedItem_GetViaIdentity'; + List = 'Az.Migrate.private\Get-AzMigrateProtectedItem_List'; + } + if (('Get', '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 + } +} +} + +<# +.Synopsis +Tracks the results of an asynchronous operation on the replication extension. +.Description +Tracks the results of an asynchronous operation on the replication extension. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationStatusAutoGenerated +.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 + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratereplicationextensionoperationstatus +#> +function Get-AzMigrateReplicationExtensionOperationStatus { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IOperationStatusAutoGenerated])] +[CmdletBinding(DefaultParameterSetName='Get', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The ID of an ongoing async operation. + ${OperationId}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The replication extension name. + ${ReplicationExtensionName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure Subscription Id in which migrate project was created. + ${SubscriptionId}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The vault name. + ${VaultName}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # 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.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + Get = 'Az.Migrate.private\Get-AzMigrateReplicationExtensionOperationStatus_Get'; + GetViaIdentity = 'Az.Migrate.private\Get-AzMigrateReplicationExtensionOperationStatus_GetViaIdentity'; + } + if (('Get') -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 + } +} +} + +<# +.Synopsis +Gets the details of the replication extension. +.Description +Gets the details of the replication extension. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel +.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 + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratereplicationextension +#> +function Get-AzMigrateReplicationExtension { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('ReplicationExtensionName')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The replication extension name. + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure Subscription Id in which migrate project was created. + ${SubscriptionId}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The vault name. + ${VaultName}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # 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.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + Get = 'Az.Migrate.private\Get-AzMigrateReplicationExtension_Get'; + GetViaIdentity = 'Az.Migrate.private\Get-AzMigrateReplicationExtension_GetViaIdentity'; + List = 'Az.Migrate.private\Get-AzMigrateReplicationExtension_List'; + } + if (('Get', '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 + } +} +} + +<# +.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 }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IJob +.Link +https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratereplicationjob +#> +function Get-AzMigrateReplicationJob { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IJob])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Job identifier. + ${JobName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure Subscription Id in which migrate project was created. + ${SubscriptionId}, + + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')] + [System.String] + # OData filter options. + ${Filter}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + Get = 'Az.Migrate.private\Get-AzMigrateReplicationJob_Get'; + List = 'Az.Migrate.private\Get-AzMigrateReplicationJob_List'; + } + if (('Get', '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 + } +} +} + +<# +.Synopsis +Gets the details of a migration item. +.Description +Gets the details of a migration item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem +.Link +https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratereplicationmigrationitem +#> +function Get-AzMigrateReplicationMigrationItem { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem])] +[CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Fabric unique name. + ${FabricName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Migration item name. + ${MigrationItemName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure Subscription Id in which migrate project was created. + ${SubscriptionId}, + + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')] + [System.String] + # OData filter options. + ${Filter}, + + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')] + [System.String] + # The pagination token. + ${SkipToken}, + + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')] + [System.String] + # The page size. + ${TakeToken}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + Get = 'Az.Migrate.private\Get-AzMigrateReplicationMigrationItem_Get'; + List = 'Az.Migrate.private\Get-AzMigrateReplicationMigrationItem_List'; + List1 = 'Az.Migrate.private\Get-AzMigrateReplicationMigrationItem_List1'; + } + if (('Get', 'List', 'List1') -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 + } +} +} + +<# +.Synopsis +Gets the details of the vault. +.Description +Gets the details of the vault. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModel +.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 + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratevault +#> +function Get-AzMigrateVault { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IVaultModel])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('VaultName')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The vault name. + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure Subscription Id in which migrate project was created. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # 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.Migrate.Category('Query')] + [System.String] + # Continuation token from the previous call. + ${ContinuationToken}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + Get = 'Az.Migrate.private\Get-AzMigrateVault_Get'; + GetViaIdentity = 'Az.Migrate.private\Get-AzMigrateVault_GetViaIdentity'; + List = 'Az.Migrate.private\Get-AzMigrateVault_List'; + List1 = 'Az.Migrate.private\Get-AzMigrateVault_List1'; + } + if (('Get', 'List', 'List1') -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 + } +} +} + +<# +.Synopsis +Method to get a vCenter. +.Description +Method to get a vCenter. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.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 + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratevcenter +#> +function Get-AzMigrateVCenter { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVCenter])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('VcenterName')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # VCenter ARM name. + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Site name. + ${SiteName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')] + [System.String] + # . + ${Filter}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + Get = 'Az.Migrate.private\Get-AzMigrateVCenter_Get'; + GetViaIdentity = 'Az.Migrate.private\Get-AzMigrateVCenter_GetViaIdentity'; + List = 'Az.Migrate.private\Get-AzMigrateVCenter_List'; + } + if (('Get', '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 + } +} +} + +<# +.Synopsis +Gets the details of the job. +.Description +Gets the details of the job. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel +.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 + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/get-azmigrateworkflow +#> +function Get-AzMigrateWorkflow { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The job (workflow) name. + ${JobName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure Subscription Id in which migrate project was created. + ${SubscriptionId}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The vault name. + ${VaultName}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')] + [System.String] + # Continuation token. + ${ContinuationToken}, + + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')] + [System.String] + # Filter string. + ${Filter}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + Get = 'Az.Migrate.private\Get-AzMigrateWorkflow_Get'; + GetViaIdentity = 'Az.Migrate.private\Get-AzMigrateWorkflow_GetViaIdentity'; + List = 'Az.Migrate.private\Get-AzMigrateWorkflow_List'; + } + if (('Get', '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 + } +} +} + +<# +.Synopsis +Performs the planned failover on the protected item. +.Description +Performs the planned failover on the protected item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModel +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelProperties +.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. + +BODY : Planned failover model. + Property : Planned failover model properties. + CustomProperty : Planned failover model custom properties. + InstanceType : Gets or sets the instance type. + +INPUTOBJECT : Identity Parameter + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. + +PROPERTY : Planned failover model properties. + CustomProperty : Planned failover model custom properties. + InstanceType : Gets or sets the instance type. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/invoke-azmigrateplannedprotecteditemfailover +#> +function Invoke-AzMigratePlannedProtectedItemFailover { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelProperties])] +[CmdletBinding(DefaultParameterSetName='PlannedViaIdentity', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Planned', Mandatory)] + [Parameter(ParameterSetName='PlannedExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The protected item name. + ${ProtectedItemName}, + + [Parameter(ParameterSetName='Planned', Mandatory)] + [Parameter(ParameterSetName='PlannedExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Planned')] + [Parameter(ParameterSetName='PlannedExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure Subscription Id in which migrate project was created. + ${SubscriptionId}, + + [Parameter(ParameterSetName='Planned', Mandatory)] + [Parameter(ParameterSetName='PlannedExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The vault name. + ${VaultName}, + + [Parameter(ParameterSetName='PlannedViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='PlannedViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # 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.Migrate.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModel] + # Planned failover model. + # To construct, see NOTES section for BODY properties and create a hash table. + ${Body}, + + [Parameter(ParameterSetName='PlannedExpanded', Mandatory)] + [Parameter(ParameterSetName='PlannedViaIdentityExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPlannedFailoverModelProperties] + # Planned failover model properties. + # To construct, see NOTES section for PROPERTY properties and create a hash table. + ${Property}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + Planned = 'Az.Migrate.private\Invoke-AzMigratePlannedProtectedItemFailover_Planned'; + PlannedExpanded = 'Az.Migrate.private\Invoke-AzMigratePlannedProtectedItemFailover_PlannedExpanded'; + PlannedViaIdentity = 'Az.Migrate.private\Invoke-AzMigratePlannedProtectedItemFailover_PlannedViaIdentity'; + PlannedViaIdentityExpanded = 'Az.Migrate.private\Invoke-AzMigratePlannedProtectedItemFailover_PlannedViaIdentityExpanded'; + } + if (('Planned', 'PlannedExpanded') -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 + } +} +} + +<# +.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 }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + +PROVIDERSPECIFICDETAIL : The provider specific details. + InstanceType : The class type. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/invoke-azmigrateresyncreplicationmigrationitem +#> +function Invoke-AzMigrateResyncReplicationMigrationItem { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem])] +[CmdletBinding(DefaultParameterSetName='ResyncExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Migration item name. + ${MigrationItemName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure Subscription Id in which migrate project was created. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IResyncProviderSpecificInput] + # The provider specific details. + # To construct, see NOTES section for PROVIDERSPECIFICDETAIL properties and create a hash table. + ${ProviderSpecificDetail}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + ResyncExpanded = 'Az.Migrate.private\Invoke-AzMigrateResyncReplicationMigrationItem_ResyncExpanded'; + } + if (('ResyncExpanded') -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 + } +} +} + +<# +.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 }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + +PROVIDERSPECIFICDETAIL : The provider specific details. + InstanceType : The class type. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/move-azmigratereplicationmigrationitem +#> +function Move-AzMigrateReplicationMigrationItem { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem])] +[CmdletBinding(DefaultParameterSetName='MigrateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Migration item name. + ${MigrationItemName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure Subscription Id in which migrate project was created. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrateProviderSpecificInput] + # The provider specific details. + # To construct, see NOTES section for PROVIDERSPECIFICDETAIL properties and create a hash table. + ${ProviderSpecificDetail}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + MigrateExpanded = 'Az.Migrate.private\Move-AzMigrateReplicationMigrationItem_MigrateExpanded'; + } + if (('MigrateExpanded') -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 + } +} +} + +<# +.Synopsis +Creates the policy. +.Description +Creates the policy. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel +.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. + +BODY : Policy model. + Property : Policy model properties. + CustomProperty : Policy model custom properties. + InstanceType : Gets or sets the instance type. + [SystemDataCreatedAt ]: Gets or sets the timestamp of resource creation (UTC). + [SystemDataCreatedBy ]: Gets or sets identity that created the resource. + [SystemDataCreatedByType ]: Gets or sets the type of identity that created the resource: user, application, managedIdentity. + [SystemDataLastModifiedAt ]: Gets or sets the timestamp of resource last modification (UTC). + [SystemDataLastModifiedBy ]: Gets or sets the identity that last modified the resource. + [SystemDataLastModifiedByType ]: Gets or sets the type of identity that last modified the resource: user, application, managedIdentity. + +INPUTOBJECT : Identity Parameter + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. + +PROPERTY : Policy model properties. + CustomProperty : Policy model custom properties. + InstanceType : Gets or sets the instance type. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratepolicy +#> +function New-AzMigratePolicy { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel])] +[CmdletBinding(DefaultParameterSetName='CreateViaIdentity', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Create', Mandatory)] + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Alias('PolicyName')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The policy name. + ${Name}, + + [Parameter(ParameterSetName='Create', Mandatory)] + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Create')] + [Parameter(ParameterSetName='CreateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure Subscription Id in which migrate project was created. + ${SubscriptionId}, + + [Parameter(ParameterSetName='Create', Mandatory)] + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The vault name. + ${VaultName}, + + [Parameter(ParameterSetName='CreateViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='CreateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Create', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='CreateViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModel] + # Policy model. + # To construct, see NOTES section for BODY properties and create a hash table. + ${Body}, + + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaIdentityExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IPolicyModelProperties] + # Policy model properties. + # To construct, see NOTES section for PROPERTY properties and create a hash table. + ${Property}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + Create = 'Az.Migrate.private\New-AzMigratePolicy_Create'; + CreateExpanded = 'Az.Migrate.private\New-AzMigratePolicy_CreateExpanded'; + CreateViaIdentity = 'Az.Migrate.private\New-AzMigratePolicy_CreateViaIdentity'; + CreateViaIdentityExpanded = 'Az.Migrate.private\New-AzMigratePolicy_CreateViaIdentityExpanded'; + } + if (('Create', 'CreateExpanded') -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 + } +} +} + +<# +.Synopsis +Creates the protected item. +.Description +Creates the protected item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel +.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. + +BODY : Protected item model. + Property : Protected item model properties. + CustomProperty : Protected item model custom properties. + InstanceType : Gets or sets the instance type. + PolicyName : Gets or sets the policy name. + ReplicationExtensionName : Gets or sets the replication extension name. + [SystemDataCreatedAt ]: Gets or sets the timestamp of resource creation (UTC). + [SystemDataCreatedBy ]: Gets or sets identity that created the resource. + [SystemDataCreatedByType ]: Gets or sets the type of identity that created the resource: user, application, managedIdentity. + [SystemDataLastModifiedAt ]: Gets or sets the timestamp of resource last modification (UTC). + [SystemDataLastModifiedBy ]: Gets or sets the identity that last modified the resource. + [SystemDataLastModifiedByType ]: Gets or sets the type of identity that last modified the resource: user, application, managedIdentity. + +INPUTOBJECT : Identity Parameter + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. + +PROPERTY : Protected item model properties. + CustomProperty : Protected item model custom properties. + InstanceType : Gets or sets the instance type. + PolicyName : Gets or sets the policy name. + ReplicationExtensionName : Gets or sets the replication extension name. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/new-azmigrateprotecteditem +#> +function New-AzMigrateProtectedItem { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel])] +[CmdletBinding(DefaultParameterSetName='CreateViaIdentity', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Create', Mandatory)] + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Alias('ProtectedItemName')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The protected item name. + ${Name}, + + [Parameter(ParameterSetName='Create', Mandatory)] + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Create')] + [Parameter(ParameterSetName='CreateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure Subscription Id in which migrate project was created. + ${SubscriptionId}, + + [Parameter(ParameterSetName='Create', Mandatory)] + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The vault name. + ${VaultName}, + + [Parameter(ParameterSetName='CreateViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='CreateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Create', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='CreateViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel] + # Protected item model. + # To construct, see NOTES section for BODY properties and create a hash table. + ${Body}, + + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaIdentityExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModelProperties] + # Protected item model properties. + # To construct, see NOTES section for PROPERTY properties and create a hash table. + ${Property}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + Create = 'Az.Migrate.private\New-AzMigrateProtectedItem_Create'; + CreateExpanded = 'Az.Migrate.private\New-AzMigrateProtectedItem_CreateExpanded'; + CreateViaIdentity = 'Az.Migrate.private\New-AzMigrateProtectedItem_CreateViaIdentity'; + CreateViaIdentityExpanded = 'Az.Migrate.private\New-AzMigrateProtectedItem_CreateViaIdentityExpanded'; + } + if (('Create', 'CreateExpanded') -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 + } +} +} + +<# +.Synopsis +Creates the replication extension in the given vault. +.Description +Creates the replication extension in the given vault. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel +.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. + +BODY : Replication extension model. + Property : Replication extension model properties. + CustomProperty : Replication extension model custom properties. + InstanceType : Gets or sets the instance type. + [SystemDataCreatedAt ]: Gets or sets the timestamp of resource creation (UTC). + [SystemDataCreatedBy ]: Gets or sets identity that created the resource. + [SystemDataCreatedByType ]: Gets or sets the type of identity that created the resource: user, application, managedIdentity. + [SystemDataLastModifiedAt ]: Gets or sets the timestamp of resource last modification (UTC). + [SystemDataLastModifiedBy ]: Gets or sets the identity that last modified the resource. + [SystemDataLastModifiedByType ]: Gets or sets the type of identity that last modified the resource: user, application, managedIdentity. + +INPUTOBJECT : Identity Parameter + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. + +PROPERTY : Replication extension model properties. + CustomProperty : Replication extension model custom properties. + InstanceType : Gets or sets the instance type. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratereplicationextension +#> +function New-AzMigrateReplicationExtension { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel])] +[CmdletBinding(DefaultParameterSetName='CreateViaIdentity', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Create', Mandatory)] + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Alias('ReplicationExtensionName')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The replication extension name. + ${Name}, + + [Parameter(ParameterSetName='Create', Mandatory)] + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Create')] + [Parameter(ParameterSetName='CreateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure Subscription Id in which migrate project was created. + ${SubscriptionId}, + + [Parameter(ParameterSetName='Create', Mandatory)] + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The vault name. + ${VaultName}, + + [Parameter(ParameterSetName='CreateViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='CreateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='Create', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='CreateViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModel] + # Replication extension model. + # To construct, see NOTES section for BODY properties and create a hash table. + ${Body}, + + [Parameter(ParameterSetName='CreateExpanded', Mandatory)] + [Parameter(ParameterSetName='CreateViaIdentityExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IReplicationExtensionModelProperties] + # Replication extension model properties. + # To construct, see NOTES section for PROPERTY properties and create a hash table. + ${Property}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + Create = 'Az.Migrate.private\New-AzMigrateReplicationExtension_Create'; + CreateExpanded = 'Az.Migrate.private\New-AzMigrateReplicationExtension_CreateExpanded'; + CreateViaIdentity = 'Az.Migrate.private\New-AzMigrateReplicationExtension_CreateViaIdentity'; + CreateViaIdentityExpanded = 'Az.Migrate.private\New-AzMigrateReplicationExtension_CreateViaIdentityExpanded'; + } + if (('Create', 'CreateExpanded') -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 + } +} +} + +<# +.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.Migrate.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. + +PROVIDERSPECIFICDETAIL : The provider specific details. + InstanceType : The class type. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratereplicationmigrationitem +#> +function New-AzMigrateReplicationMigrationItem { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Fabric name. + ${FabricName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Migration item name. + ${MigrationItemName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Protection container name. + ${ProtectionContainerName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group where the recovery services vault is present. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the recovery services vault. + ${ResourceName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure Subscription Id in which migrate project was created. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [System.String] + # The policy Id. + ${PolicyId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IEnableMigrationProviderSpecificInput] + # The provider specific details. + # To construct, see NOTES section for PROVIDERSPECIFICDETAIL properties and create a hash table. + ${ProviderSpecificDetail}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + CreateExpanded = 'Az.Migrate.private\New-AzMigrateReplicationMigrationItem_CreateExpanded'; + } + if (('CreateExpanded') -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 + } +} +} + +<# +.Synopsis +Deletes the fabric agent. +.Description +Deletes the fabric agent. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity +.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 + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/remove-azmigratedra +#> +function Remove-AzMigrateDra { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The fabric agent (Dra) name. + ${FabricAgentName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure Subscription Id in which migrate project was created. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # 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.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + Delete = 'Az.Migrate.private\Remove-AzMigrateDra_Delete'; + DeleteViaIdentity = 'Az.Migrate.private\Remove-AzMigrateDra_DeleteViaIdentity'; + } + if (('Delete') -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 + } +} +} + +<# +.Synopsis +Removes the policy. +.Description +Removes the policy. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity +.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 + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/remove-azmigratepolicy +#> +function Remove-AzMigratePolicy { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( - [Parameter(Mandatory)] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] - [System.String] - # The name of the resource group where the recovery services vault is present. - ${ResourceGroupName}, - - [Parameter(Mandatory)] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] - [System.String] - # The name of the recovery services vault. - ${ResourceName}, - - [Parameter(ParameterSetName='Get', Mandatory)] - [Parameter(ParameterSetName='List', Mandatory)] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] - [System.String] - # Fabric unique name. - ${FabricName}, - - [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('PolicyName')] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [System.String] - # Migration item name. - ${MigrationItemName}, + # The policy name. + ${Name}, - [Parameter(ParameterSetName='Get', Mandatory)] - [Parameter(ParameterSetName='List', Mandatory)] + [Parameter(ParameterSetName='Delete', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [System.String] - # Protection container name. - ${ProtectionContainerName}, + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, - [Parameter()] + [Parameter(ParameterSetName='Delete')] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] - [System.String[]] + [System.String] # Azure Subscription Id in which migrate project was created. ${SubscriptionId}, - [Parameter(ParameterSetName='List')] - [Parameter(ParameterSetName='List1')] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')] - [System.String] - # OData filter options. - ${Filter}, - - [Parameter(ParameterSetName='List')] - [Parameter(ParameterSetName='List1')] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')] + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [System.String] - # The pagination token. - ${SkipToken}, + # The vault name. + ${VaultName}, - [Parameter(ParameterSetName='List')] - [Parameter(ParameterSetName='List1')] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')] - [System.String] - # The page size. - ${TakeToken}, + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] @@ -542,6 +4885,12 @@ param( # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + [Parameter(DontShow)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] [System.Management.Automation.SwitchParameter] @@ -562,6 +4911,18 @@ param( # SendAsync Pipeline Steps to be prepended to the front of the pipeline ${HttpPipelinePrepend}, + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + [Parameter(DontShow)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] [System.Uri] @@ -591,11 +4952,10 @@ begin { $parameterSet = $PSCmdlet.ParameterSetName $mapping = @{ - Get = 'Az.Migrate.private\Get-AzMigrateReplicationMigrationItem_Get'; - List = 'Az.Migrate.private\Get-AzMigrateReplicationMigrationItem_List'; - List1 = 'Az.Migrate.private\Get-AzMigrateReplicationMigrationItem_List1'; + Delete = 'Az.Migrate.private\Remove-AzMigratePolicy_Delete'; + DeleteViaIdentity = 'Az.Migrate.private\Remove-AzMigratePolicy_DeleteViaIdentity'; } - if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id } @@ -631,9 +4991,9 @@ end { <# .Synopsis -Method to get a vCenter. +Removes the protected item. .Description -Method to get a vCenter. +Removes the protected item. .Example {{ Add code here }} .Example @@ -642,7 +5002,7 @@ Method to get a vCenter. .Inputs Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVCenter +System.Boolean .Notes COMPLEX PARAMETER PROPERTIES @@ -654,12 +5014,16 @@ INPUTOBJECT : Identity Parameter [ClusterName ]: Cluster ARM name. [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. [FabricName ]: Fabric name. [HostName ]: Host ARM name. [Id ]: Resource identity path [IntentObjectName ]: Replication protection intent name. [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. [LogicalNetworkName ]: Logical network name. [MachineName ]: Machine ARM name. [MappingName ]: Protection Container mapping name. @@ -668,14 +5032,17 @@ INPUTOBJECT : Identity Parameter [MigrationRecoveryPointName ]: The migration recovery point name. [NetworkMappingName ]: Network mapping name. [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. [OperationStatusName ]: Operation status ARM name. [PolicyName ]: Replication policy name. [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. [ProtectionContainerName ]: Protection container name. [ProviderName ]: Recovery services provider name. [RecoveryPlanName ]: Name of the recovery plan. [RecoveryPointName ]: The recovery point name. [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. [ResourceGroupName ]: The name of the resource group. The name is case insensitive. [ResourceName ]: The name of the recovery services vault. [SiteName ]: Site name. @@ -683,58 +5050,56 @@ INPUTOBJECT : Identity Parameter [StorageClassificationMappingName ]: Storage classification mapping name. [StorageClassificationName ]: Storage classification name. [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. [VaultSettingName ]: Vault setting name. [VcenterName ]: VCenter ARM name. [VirtualMachineName ]: Virtual Machine name. .Link -https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratevcenter +https://learn.microsoft.com/powershell/module/az.migrate/remove-azmigrateprotecteditem #> -function Get-AzMigrateVCenter { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVCenter])] -[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +function Remove-AzMigrateProtectedItem { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( - [Parameter(ParameterSetName='Get', Mandatory)] - [Alias('VcenterName')] + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('ProtectedItemName')] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [System.String] - # VCenter ARM name. + # The protected item name. ${Name}, - [Parameter(ParameterSetName='Get', Mandatory)] - [Parameter(ParameterSetName='List', Mandatory)] + [Parameter(ParameterSetName='Delete', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [System.String] # The name of the resource group. # The name is case insensitive. ${ResourceGroupName}, - [Parameter(ParameterSetName='Get', Mandatory)] - [Parameter(ParameterSetName='List', Mandatory)] + [Parameter(ParameterSetName='Delete')] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] [System.String] - # Site name. - ${SiteName}, + # Azure Subscription Id in which migrate project was created. + ${SubscriptionId}, - [Parameter(ParameterSetName='Get')] - [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='Delete', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] - [System.String[]] - # The ID of the target subscription. - ${SubscriptionId}, + [System.String] + # The vault name. + ${VaultName}, - [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] # Identity Parameter # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, - [Parameter(ParameterSetName='List')] + [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')] - [System.String] - # . - ${Filter}, + [System.Management.Automation.SwitchParameter] + # A flag indicating whether to do force delete or not. + ${ForceDelete}, [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] @@ -745,6 +5110,12 @@ param( # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + [Parameter(DontShow)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] [System.Management.Automation.SwitchParameter] @@ -765,6 +5136,18 @@ param( # SendAsync Pipeline Steps to be prepended to the front of the pipeline ${HttpPipelinePrepend}, + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + [Parameter(DontShow)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] [System.Uri] @@ -794,11 +5177,10 @@ begin { $parameterSet = $PSCmdlet.ParameterSetName $mapping = @{ - Get = 'Az.Migrate.private\Get-AzMigrateVCenter_Get'; - GetViaIdentity = 'Az.Migrate.private\Get-AzMigrateVCenter_GetViaIdentity'; - List = 'Az.Migrate.private\Get-AzMigrateVCenter_List'; + Delete = 'Az.Migrate.private\Remove-AzMigrateProtectedItem_Delete'; + DeleteViaIdentity = 'Az.Migrate.private\Remove-AzMigrateProtectedItem_DeleteViaIdentity'; } - if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id } @@ -834,73 +5216,109 @@ end { <# .Synopsis -The operation to resynchronize replication of an ASR migration item. +Deletes the replication extension in the given vault. .Description -The operation to resynchronize replication of an ASR migration item. +Deletes the replication extension in the given vault. .Example {{ Add code here }} .Example {{ Add code here }} +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem +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. -PROVIDERSPECIFICDETAIL : The provider specific details. - InstanceType : The class type. +INPUTOBJECT : Identity Parameter + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. .Link -https://learn.microsoft.com/powershell/module/az.migrate/invoke-azmigrateresyncreplicationmigrationitem +https://learn.microsoft.com/powershell/module/az.migrate/remove-azmigratereplicationextension #> -function Invoke-AzMigrateResyncReplicationMigrationItem { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem])] -[CmdletBinding(DefaultParameterSetName='ResyncExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +function Remove-AzMigrateReplicationExtension { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( - [Parameter(Mandatory)] + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('ReplicationExtensionName')] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [System.String] - # Fabric name. - ${FabricName}, - - [Parameter(Mandatory)] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] - [System.String] - # Migration item name. - ${MigrationItemName}, - - [Parameter(Mandatory)] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] - [System.String] - # Protection container name. - ${ProtectionContainerName}, + # The replication extension name. + ${Name}, - [Parameter(Mandatory)] + [Parameter(ParameterSetName='Delete', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [System.String] - # The name of the resource group where the recovery services vault is present. + # The name of the resource group. + # The name is case insensitive. ${ResourceGroupName}, - [Parameter(Mandatory)] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] - [System.String] - # The name of the recovery services vault. - ${ResourceName}, - - [Parameter()] + [Parameter(ParameterSetName='Delete')] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] [System.String] # Azure Subscription Id in which migrate project was created. ${SubscriptionId}, - [Parameter(Mandatory)] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IResyncProviderSpecificInput] - # The provider specific details. - # To construct, see NOTES section for PROVIDERSPECIFICDETAIL properties and create a hash table. - ${ProviderSpecificDetail}, + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The vault name. + ${VaultName}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] @@ -943,6 +5361,12 @@ param( # Run the command asynchronously ${NoWait}, + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + [Parameter(DontShow)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] [System.Uri] @@ -972,9 +5396,10 @@ begin { $parameterSet = $PSCmdlet.ParameterSetName $mapping = @{ - ResyncExpanded = 'Az.Migrate.private\Invoke-AzMigrateResyncReplicationMigrationItem_ResyncExpanded'; + Delete = 'Az.Migrate.private\Remove-AzMigrateReplicationExtension_Delete'; + DeleteViaIdentity = 'Az.Migrate.private\Remove-AzMigrateReplicationExtension_DeleteViaIdentity'; } - if (('ResyncExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id } @@ -1010,29 +5435,22 @@ end { <# .Synopsis -The operation to initiate migration of the item. +The operation to delete an ASR migration item. .Description -The operation to initiate migration of the item. +The operation to delete an ASR migration item. .Example {{ Add code here }} .Example {{ Add code here }} .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. - -PROVIDERSPECIFICDETAIL : The provider specific details. - InstanceType : The class type. +System.Boolean .Link -https://learn.microsoft.com/powershell/module/az.migrate/move-azmigratereplicationmigrationitem +https://learn.microsoft.com/powershell/module/az.migrate/remove-azmigratereplicationmigrationitem #> -function Move-AzMigrateReplicationMigrationItem { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem])] -[CmdletBinding(DefaultParameterSetName='MigrateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +function Remove-AzMigrateReplicationMigrationItem { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] @@ -1071,12 +5489,11 @@ param( # Azure Subscription Id in which migrate project was created. ${SubscriptionId}, - [Parameter(Mandatory)] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrateProviderSpecificInput] - # The provider specific details. - # To construct, see NOTES section for PROVIDERSPECIFICDETAIL properties and create a hash table. - ${ProviderSpecificDetail}, + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')] + [System.String] + # The delete option. + ${DeleteOption}, [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] @@ -1119,6 +5536,12 @@ param( # Run the command asynchronously ${NoWait}, + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + [Parameter(DontShow)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] [System.Uri] @@ -1148,9 +5571,9 @@ begin { $parameterSet = $PSCmdlet.ParameterSetName $mapping = @{ - MigrateExpanded = 'Az.Migrate.private\Move-AzMigrateReplicationMigrationItem_MigrateExpanded'; + Delete = 'Az.Migrate.private\Remove-AzMigrateReplicationMigrationItem_Delete'; } - if (('MigrateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id } @@ -1186,79 +5609,103 @@ end { <# .Synopsis -The operation to create an ASR migration item (enable migration). +Removes the vault. .Description -The operation to create an ASR migration item (enable migration). +Removes the vault. .Example {{ Add code here }} .Example {{ Add code here }} +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem +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. -PROVIDERSPECIFICDETAIL : The provider specific details. - InstanceType : The class type. +INPUTOBJECT : Identity Parameter + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. .Link -https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratereplicationmigrationitem +https://learn.microsoft.com/powershell/module/az.migrate/remove-azmigratevault #> -function New-AzMigrateReplicationMigrationItem { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem])] -[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +function Remove-AzMigrateVault { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( - [Parameter(Mandatory)] + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('VaultName')] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [System.String] - # Fabric name. - ${FabricName}, - - [Parameter(Mandatory)] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] - [System.String] - # Migration item name. - ${MigrationItemName}, - - [Parameter(Mandatory)] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] - [System.String] - # Protection container name. - ${ProtectionContainerName}, + # The vault name. + ${Name}, - [Parameter(Mandatory)] + [Parameter(ParameterSetName='Delete', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [System.String] - # The name of the resource group where the recovery services vault is present. + # The name of the resource group. + # The name is case insensitive. ${ResourceGroupName}, - [Parameter(Mandatory)] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] - [System.String] - # The name of the recovery services vault. - ${ResourceName}, - - [Parameter()] + [Parameter(ParameterSetName='Delete')] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] [System.String] # Azure Subscription Id in which migrate project was created. ${SubscriptionId}, - [Parameter(Mandatory)] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] - [System.String] - # The policy Id. - ${PolicyId}, - - [Parameter(Mandatory)] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IEnableMigrationProviderSpecificInput] - # The provider specific details. - # To construct, see NOTES section for PROVIDERSPECIFICDETAIL properties and create a hash table. - ${ProviderSpecificDetail}, + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] @@ -1301,6 +5748,12 @@ param( # Run the command asynchronously ${NoWait}, + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + [Parameter(DontShow)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] [System.Uri] @@ -1330,9 +5783,10 @@ begin { $parameterSet = $PSCmdlet.ParameterSetName $mapping = @{ - CreateExpanded = 'Az.Migrate.private\New-AzMigrateReplicationMigrationItem_CreateExpanded'; + Delete = 'Az.Migrate.private\Remove-AzMigrateVault_Delete'; + DeleteViaIdentity = 'Az.Migrate.private\Remove-AzMigrateVault_DeleteViaIdentity'; } - if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id } @@ -1368,22 +5822,29 @@ end { <# .Synopsis -The operation to delete an ASR migration item. +The operation to initiate resume replication of the item. .Description -The operation to delete an ASR migration item. +The operation to initiate resume replication of the item. .Example {{ Add code here }} .Example {{ Add code here }} .Outputs -System.Boolean +Microsoft.Azure.PowerShell.Cmdlets.Migrate.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. + +PROVIDERSPECIFICDETAIL : The provider specific input for resume replication. + InstanceType : The class type. .Link -https://learn.microsoft.com/powershell/module/az.migrate/remove-azmigratereplicationmigrationitem +https://learn.microsoft.com/powershell/module/az.migrate/resume-azmigratereplicationmigrationitemreplication #> -function Remove-AzMigrateReplicationMigrationItem { -[OutputType([System.Boolean])] -[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +function Resume-AzMigrateReplicationMigrationItemReplication { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem])] +[CmdletBinding(DefaultParameterSetName='ResumeExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] @@ -1422,11 +5883,12 @@ param( # Azure Subscription Id in which migrate project was created. ${SubscriptionId}, - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')] - [System.String] - # The delete option. - ${DeleteOption}, + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IResumeReplicationProviderSpecificInput] + # The provider specific input for resume replication. + # To construct, see NOTES section for PROVIDERSPECIFICDETAIL properties and create a hash table. + ${ProviderSpecificDetail}, [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] @@ -1469,12 +5931,6 @@ param( # Run the command asynchronously ${NoWait}, - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] - [System.Management.Automation.SwitchParameter] - # Returns true when the command succeeds - ${PassThru}, - [Parameter(DontShow)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] [System.Uri] @@ -1504,9 +5960,9 @@ begin { $parameterSet = $PSCmdlet.ParameterSetName $mapping = @{ - Delete = 'Az.Migrate.private\Remove-AzMigrateReplicationMigrationItem_Delete'; + ResumeExpanded = 'Az.Migrate.private\Resume-AzMigrateReplicationMigrationItemReplication_ResumeExpanded'; } - if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + if (('ResumeExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id } @@ -1542,73 +5998,157 @@ end { <# .Synopsis -The operation to initiate resume replication of the item. +Method to create or update a site. .Description -The operation to initiate resume replication of the item. +Method to create or update a site. .Example {{ Add code here }} .Example {{ Add code here }} +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVSite .Outputs -Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVSite .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. +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +BODY : Site REST Resource. + [AgentDetailKeyVaultId ]: Key vault ARM Id. + [AgentDetailKeyVaultUri ]: Key vault URI. + [ApplianceName ]: Appliance Name. + [DiscoverySolutionId ]: ARM ID of migration hub solution for SDS. + [ETag ]: eTag for concurrency control. + [Location ]: Azure location in which Sites is created. + [Name ]: Name of the Hyper-V site. + [ServicePrincipalIdentityDetailAadAuthority ]: AAD Authority URL which was used to request the token for the service principal. + [ServicePrincipalIdentityDetailApplicationId ]: Application/client Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services. + [ServicePrincipalIdentityDetailAudience ]: Intended audience for the service principal. + [ServicePrincipalIdentityDetailObjectId ]: Object Id of the service principal with which the on-premise management/data plane components would communicate with our Azure services. + [ServicePrincipalIdentityDetailRawCertData ]: Raw certificate data for building certificate expiry flows. + [ServicePrincipalIdentityDetailTenantId ]: Tenant Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services. + [Tag ]: Dictionary of + [(Any) ]: This indicates any property can be added to this object. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/set-azmigratehypervsite +#> +function Set-AzMigrateHyperVSite { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVSite])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Site name. + ${SiteName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='Update', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVSite] + # Site REST Resource. + # To construct, see NOTES section for BODY properties and create a hash table. + ${Body}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [System.String] + # Key vault ARM Id. + ${AgentDetailKeyVaultId}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [System.String] + # Key vault URI. + ${AgentDetailKeyVaultUri}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [System.String] + # Appliance Name. + ${ApplianceName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [System.String] + # ARM ID of migration hub solution for SDS. + ${DiscoverySolutionId}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [System.String] + # eTag for concurrency control. + ${ETag}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [System.String] + # Azure location in which Sites is created. + ${Location}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [System.String] + # Name of the Hyper-V site. + ${Name}, -PROVIDERSPECIFICDETAIL : The provider specific input for resume replication. - InstanceType : The class type. -.Link -https://learn.microsoft.com/powershell/module/az.migrate/resume-azmigratereplicationmigrationitemreplication -#> -function Resume-AzMigrateReplicationMigrationItemReplication { -[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IMigrationItem])] -[CmdletBinding(DefaultParameterSetName='ResumeExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] -param( - [Parameter(Mandatory)] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] [System.String] - # Fabric name. - ${FabricName}, + # AAD Authority URL which was used to request the token for the service principal. + ${ServicePrincipalIdentityDetailAadAuthority}, - [Parameter(Mandatory)] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] [System.String] - # Migration item name. - ${MigrationItemName}, + # Application/client Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services. + ${ServicePrincipalIdentityDetailApplicationId}, - [Parameter(Mandatory)] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] [System.String] - # Protection container name. - ${ProtectionContainerName}, + # Intended audience for the service principal. + ${ServicePrincipalIdentityDetailAudience}, - [Parameter(Mandatory)] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] [System.String] - # The name of the resource group where the recovery services vault is present. - ${ResourceGroupName}, + # Object Id of the service principal with which the on-premise management/data plane components would communicate with our Azure services. + ${ServicePrincipalIdentityDetailObjectId}, - [Parameter(Mandatory)] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] [System.String] - # The name of the recovery services vault. - ${ResourceName}, + # Raw certificate data for building certificate expiry flows. + ${ServicePrincipalIdentityDetailRawCertData}, - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] [System.String] - # Azure Subscription Id in which migrate project was created. - ${SubscriptionId}, + # Tenant Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services. + ${ServicePrincipalIdentityDetailTenantId}, - [Parameter(Mandatory)] + [Parameter(ParameterSetName='UpdateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202301.IResumeReplicationProviderSpecificInput] - # The provider specific input for resume replication. - # To construct, see NOTES section for PROVIDERSPECIFICDETAIL properties and create a hash table. - ${ProviderSpecificDetail}, + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVSiteTags]))] + [System.Collections.Hashtable] + # Dictionary of + ${Tag}, [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] @@ -1619,12 +6159,6 @@ param( # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] - [System.Management.Automation.SwitchParameter] - # Run the command as a job - ${AsJob}, - [Parameter(DontShow)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] [System.Management.Automation.SwitchParameter] @@ -1645,12 +6179,6 @@ param( # SendAsync Pipeline Steps to be prepended to the front of the pipeline ${HttpPipelinePrepend}, - [Parameter()] - [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] - [System.Management.Automation.SwitchParameter] - # Run the command asynchronously - ${NoWait}, - [Parameter(DontShow)] [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] [System.Uri] @@ -1680,9 +6208,10 @@ begin { $parameterSet = $PSCmdlet.ParameterSetName $mapping = @{ - ResumeExpanded = 'Az.Migrate.private\Resume-AzMigrateReplicationMigrationItemReplication_ResumeExpanded'; + Update = 'Az.Migrate.private\Set-AzMigrateHyperVSite_Update'; + UpdateExpanded = 'Az.Migrate.private\Set-AzMigrateHyperVSite_UpdateExpanded'; } - if (('ResumeExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + if (('Update', 'UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id } @@ -2138,6 +6667,226 @@ end { } } +<# +.Synopsis +Creates a solution in the migrate project. +.Description +Creates a solution in the migrate project. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.ISolution +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.ISolution +.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. + +SOLUTIONINPUT : Solution REST Resource. + [CleanupState ]: Gets or sets the cleanup state of the solution. + [DetailAssessmentCount ]: Gets or sets the count of assessments reported by the solution. + [DetailExtendedDetail ]: Gets or sets the extended details reported by the solution. + [(Any) ]: This indicates any property can be added to this object. + [DetailGroupCount ]: Gets or sets the count of groups reported by the solution. + [Etag ]: Gets or sets the ETAG for optimistic concurrency control. + [Goal ]: Gets or sets the goal of the solution. + [Purpose ]: Gets or sets the purpose of the solution. + [Status ]: Gets or sets the current status of the solution. + [Tool ]: Gets or sets the tool being used in the solution. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/set-azmigratesolution +#> +function Set-AzMigrateSolution { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.ISolution])] +[CmdletBinding(DefaultParameterSetName='PutExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Name of the Azure Migrate project. + ${MigrateProjectName}, + + [Parameter(Mandatory)] + [Alias('SolutionName')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Unique name of a migration solution within a migrate project. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Name of the Azure Resource Group that migrate project is part of. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure Subscription Id in which migrate project was created. + ${SubscriptionId}, + + [Parameter(ParameterSetName='Put', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.ISolution] + # Solution REST Resource. + # To construct, see NOTES section for SOLUTIONINPUT properties and create a hash table. + ${SolutionInput}, + + [Parameter(ParameterSetName='PutExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [System.String] + # Gets or sets the cleanup state of the solution. + ${CleanupState}, + + [Parameter(ParameterSetName='PutExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [System.Int32] + # Gets or sets the count of assessments reported by the solution. + ${DetailAssessmentCount}, + + [Parameter(ParameterSetName='PutExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.ISolutionDetailsExtendedDetails]))] + [System.Collections.Hashtable] + # Gets or sets the extended details reported by the solution. + ${DetailExtendedDetail}, + + [Parameter(ParameterSetName='PutExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [System.Int32] + # Gets or sets the count of groups reported by the solution. + ${DetailGroupCount}, + + [Parameter(ParameterSetName='PutExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [System.String] + # Gets or sets the ETAG for optimistic concurrency control. + ${Etag}, + + [Parameter(ParameterSetName='PutExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [System.String] + # Gets or sets the goal of the solution. + ${Goal}, + + [Parameter(ParameterSetName='PutExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [System.String] + # Gets or sets the purpose of the solution. + ${Purpose}, + + [Parameter(ParameterSetName='PutExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [System.String] + # Gets or sets the current status of the solution. + ${Status}, + + [Parameter(ParameterSetName='PutExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [System.String] + # Gets or sets the tool being used in the solution. + ${Tool}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + Put = 'Az.Migrate.private\Set-AzMigrateSolution_Put'; + PutExpanded = 'Az.Migrate.private\Set-AzMigrateSolution_PutExpanded'; + } + if (('Put', 'PutExpanded') -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 + } +} +} + <# .Synopsis The operation to initiate pause replication of the item. diff --git a/src/Migrate/Migrate.Autorest/internal/Remove-AzMigrateDra.ps1 b/src/Migrate/Migrate.Autorest/internal/Remove-AzMigrateDra.ps1 new file mode 100644 index 000000000000..f562aeb825ce --- /dev/null +++ b/src/Migrate/Migrate.Autorest/internal/Remove-AzMigrateDra.ps1 @@ -0,0 +1,233 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Deletes the fabric agent. +.Description +Deletes the fabric agent. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity +.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 + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/remove-azmigratedra +#> +function Remove-AzMigrateDra { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The fabric agent (Dra) name. + ${FabricAgentName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The fabric name. + ${FabricName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure Subscription Id in which migrate project was created. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # 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.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + Delete = 'Az.Migrate.private\Remove-AzMigrateDra_Delete'; + DeleteViaIdentity = 'Az.Migrate.private\Remove-AzMigrateDra_DeleteViaIdentity'; + } + if (('Delete') -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/src/Migrate/Migrate.Autorest/internal/Remove-AzMigratePolicy.ps1 b/src/Migrate/Migrate.Autorest/internal/Remove-AzMigratePolicy.ps1 new file mode 100644 index 000000000000..69d2c02bf313 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/internal/Remove-AzMigratePolicy.ps1 @@ -0,0 +1,234 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Removes the policy. +.Description +Removes the policy. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity +.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 + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/remove-azmigratepolicy +#> +function Remove-AzMigratePolicy { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('PolicyName')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The policy name. + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure Subscription Id in which migrate project was created. + ${SubscriptionId}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The vault name. + ${VaultName}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # 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.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + Delete = 'Az.Migrate.private\Remove-AzMigratePolicy_Delete'; + DeleteViaIdentity = 'Az.Migrate.private\Remove-AzMigratePolicy_DeleteViaIdentity'; + } + if (('Delete') -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/src/Migrate/Migrate.Autorest/internal/Remove-AzMigrateProtectedItem.ps1 b/src/Migrate/Migrate.Autorest/internal/Remove-AzMigrateProtectedItem.ps1 new file mode 100644 index 000000000000..7dfa0c70a385 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/internal/Remove-AzMigrateProtectedItem.ps1 @@ -0,0 +1,240 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Removes the protected item. +.Description +Removes the protected item. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity +.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 + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/remove-azmigrateprotecteditem +#> +function Remove-AzMigrateProtectedItem { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('ProtectedItemName')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The protected item name. + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure Subscription Id in which migrate project was created. + ${SubscriptionId}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The vault name. + ${VaultName}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Query')] + [System.Management.Automation.SwitchParameter] + # A flag indicating whether to do force delete or not. + ${ForceDelete}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + Delete = 'Az.Migrate.private\Remove-AzMigrateProtectedItem_Delete'; + DeleteViaIdentity = 'Az.Migrate.private\Remove-AzMigrateProtectedItem_DeleteViaIdentity'; + } + if (('Delete') -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/src/Migrate/Migrate.Autorest/internal/Remove-AzMigrateReplicationExtension.ps1 b/src/Migrate/Migrate.Autorest/internal/Remove-AzMigrateReplicationExtension.ps1 new file mode 100644 index 000000000000..2da54a5f4062 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/internal/Remove-AzMigrateReplicationExtension.ps1 @@ -0,0 +1,234 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Deletes the replication extension in the given vault. +.Description +Deletes the replication extension in the given vault. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity +.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 + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/remove-azmigratereplicationextension +#> +function Remove-AzMigrateReplicationExtension { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('ReplicationExtensionName')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The replication extension name. + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure Subscription Id in which migrate project was created. + ${SubscriptionId}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The vault name. + ${VaultName}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # 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.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + Delete = 'Az.Migrate.private\Remove-AzMigrateReplicationExtension_Delete'; + DeleteViaIdentity = 'Az.Migrate.private\Remove-AzMigrateReplicationExtension_DeleteViaIdentity'; + } + if (('Delete') -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/src/Migrate/Migrate.Autorest/internal/Remove-AzMigrateVault.ps1 b/src/Migrate/Migrate.Autorest/internal/Remove-AzMigrateVault.ps1 new file mode 100644 index 000000000000..c509e28105e1 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/internal/Remove-AzMigrateVault.ps1 @@ -0,0 +1,228 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Removes the vault. +.Description +Removes the vault. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity +.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 + [AccountName ]: Run as account ARM name. + [AlertSettingName ]: The name of the email notification configuration. + [ClusterName ]: Cluster ARM name. + [DatabaseInstanceName ]: Unique name of a database instance in Azure migration hub. + [DatabaseName ]: Unique name of a database in Azure migration hub. + [DeploymentId ]: Deployment Id. + [EmailConfigurationName ]: The email configuration name. + [EventName ]: Unique name of an event within a migrate project. + [FabricAgentName ]: The fabric agent (Dra) name. + [FabricName ]: Fabric name. + [HostName ]: Host ARM name. + [Id ]: Resource identity path + [IntentObjectName ]: Replication protection intent name. + [JobName ]: Job ARM name. + [Location ]: The name of the Azure region. + [LogicalNetworkName ]: Logical network name. + [MachineName ]: Machine ARM name. + [MappingName ]: Protection Container mapping name. + [MigrateProjectName ]: Name of the Azure Migrate project. + [MigrationItemName ]: Migration item name. + [MigrationRecoveryPointName ]: The migration recovery point name. + [NetworkMappingName ]: Network mapping name. + [NetworkName ]: Primary network name. + [OperationId ]: The ID of an ongoing async operation. + [OperationStatusName ]: Operation status ARM name. + [PolicyName ]: Replication policy name. + [ProtectableItemName ]: Protectable item name. + [ProtectedItemName ]: The protected item name. + [ProtectionContainerName ]: Protection container name. + [ProviderName ]: Recovery services provider name. + [RecoveryPlanName ]: Name of the recovery plan. + [RecoveryPointName ]: The recovery point name. + [ReplicatedProtectedItemName ]: Replication protected item name. + [ReplicationExtensionName ]: The replication extension name. + [ResourceGroupName ]: The name of the resource group. The name is case insensitive. + [ResourceName ]: The name of the recovery services vault. + [SiteName ]: Site name. + [SolutionName ]: Unique name of a migration solution within a migrate project. + [StorageClassificationMappingName ]: Storage classification mapping name. + [StorageClassificationName ]: Storage classification name. + [SubscriptionId ]: The ID of the target subscription. + [VaultName ]: The vault name. + [VaultSettingName ]: Vault setting name. + [VcenterName ]: VCenter ARM name. + [VirtualMachineName ]: Virtual Machine name. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/remove-azmigratevault +#> +function Remove-AzMigrateVault { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('VaultName')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The vault name. + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure Subscription Id in which migrate project was created. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IMigrateIdentity] + # 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.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + Delete = 'Az.Migrate.private\Remove-AzMigrateVault_Delete'; + DeleteViaIdentity = 'Az.Migrate.private\Remove-AzMigrateVault_DeleteViaIdentity'; + } + if (('Delete') -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/src/Migrate/Migrate.Autorest/internal/Set-AzMigrateHyperVSite.ps1 b/src/Migrate/Migrate.Autorest/internal/Set-AzMigrateHyperVSite.ps1 new file mode 100644 index 000000000000..c7a5f5b46294 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/internal/Set-AzMigrateHyperVSite.ps1 @@ -0,0 +1,264 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Method to create or update a site. +.Description +Method to create or update a site. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVSite +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVSite +.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. + +BODY : Site REST Resource. + [AgentDetailKeyVaultId ]: Key vault ARM Id. + [AgentDetailKeyVaultUri ]: Key vault URI. + [ApplianceName ]: Appliance Name. + [DiscoverySolutionId ]: ARM ID of migration hub solution for SDS. + [ETag ]: eTag for concurrency control. + [Location ]: Azure location in which Sites is created. + [Name ]: Name of the Hyper-V site. + [ServicePrincipalIdentityDetailAadAuthority ]: AAD Authority URL which was used to request the token for the service principal. + [ServicePrincipalIdentityDetailApplicationId ]: Application/client Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services. + [ServicePrincipalIdentityDetailAudience ]: Intended audience for the service principal. + [ServicePrincipalIdentityDetailObjectId ]: Object Id of the service principal with which the on-premise management/data plane components would communicate with our Azure services. + [ServicePrincipalIdentityDetailRawCertData ]: Raw certificate data for building certificate expiry flows. + [ServicePrincipalIdentityDetailTenantId ]: Tenant Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services. + [Tag ]: Dictionary of + [(Any) ]: This indicates any property can be added to this object. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/set-azmigratehypervsite +#> +function Set-AzMigrateHyperVSite { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVSite])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Site name. + ${SiteName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName='Update', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVSite] + # Site REST Resource. + # To construct, see NOTES section for BODY properties and create a hash table. + ${Body}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [System.String] + # Key vault ARM Id. + ${AgentDetailKeyVaultId}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [System.String] + # Key vault URI. + ${AgentDetailKeyVaultUri}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [System.String] + # Appliance Name. + ${ApplianceName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [System.String] + # ARM ID of migration hub solution for SDS. + ${DiscoverySolutionId}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [System.String] + # eTag for concurrency control. + ${ETag}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [System.String] + # Azure location in which Sites is created. + ${Location}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [System.String] + # Name of the Hyper-V site. + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [System.String] + # AAD Authority URL which was used to request the token for the service principal. + ${ServicePrincipalIdentityDetailAadAuthority}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [System.String] + # Application/client Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services. + ${ServicePrincipalIdentityDetailApplicationId}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [System.String] + # Intended audience for the service principal. + ${ServicePrincipalIdentityDetailAudience}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [System.String] + # Object Id of the service principal with which the on-premise management/data plane components would communicate with our Azure services. + ${ServicePrincipalIdentityDetailObjectId}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [System.String] + # Raw certificate data for building certificate expiry flows. + ${ServicePrincipalIdentityDetailRawCertData}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [System.String] + # Tenant Id for the service principal with which the on-premise management/data plane components would communicate with our Azure services. + ${ServicePrincipalIdentityDetailTenantId}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVSiteTags]))] + [System.Collections.Hashtable] + # Dictionary of + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + Update = 'Az.Migrate.private\Set-AzMigrateHyperVSite_Update'; + UpdateExpanded = 'Az.Migrate.private\Set-AzMigrateHyperVSite_UpdateExpanded'; + } + if (('Update', 'UpdateExpanded') -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/src/Migrate/Migrate.Autorest/internal/Set-AzMigrateSolution.ps1 b/src/Migrate/Migrate.Autorest/internal/Set-AzMigrateSolution.ps1 new file mode 100644 index 000000000000..55e9c539dd51 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/internal/Set-AzMigrateSolution.ps1 @@ -0,0 +1,235 @@ + +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Creates a solution in the migrate project. +.Description +Creates a solution in the migrate project. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.ISolution +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.ISolution +.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. + +SOLUTIONINPUT : Solution REST Resource. + [CleanupState ]: Gets or sets the cleanup state of the solution. + [DetailAssessmentCount ]: Gets or sets the count of assessments reported by the solution. + [DetailExtendedDetail ]: Gets or sets the extended details reported by the solution. + [(Any) ]: This indicates any property can be added to this object. + [DetailGroupCount ]: Gets or sets the count of groups reported by the solution. + [Etag ]: Gets or sets the ETAG for optimistic concurrency control. + [Goal ]: Gets or sets the goal of the solution. + [Purpose ]: Gets or sets the purpose of the solution. + [Status ]: Gets or sets the current status of the solution. + [Tool ]: Gets or sets the tool being used in the solution. +.Link +https://learn.microsoft.com/powershell/module/az.migrate/set-azmigratesolution +#> +function Set-AzMigrateSolution { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.ISolution])] +[CmdletBinding(DefaultParameterSetName='PutExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Name of the Azure Migrate project. + ${MigrateProjectName}, + + [Parameter(Mandatory)] + [Alias('SolutionName')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Unique name of a migration solution within a migrate project. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [System.String] + # Name of the Azure Resource Group that migrate project is part of. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Azure Subscription Id in which migrate project was created. + ${SubscriptionId}, + + [Parameter(ParameterSetName='Put', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.ISolution] + # Solution REST Resource. + # To construct, see NOTES section for SOLUTIONINPUT properties and create a hash table. + ${SolutionInput}, + + [Parameter(ParameterSetName='PutExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [System.String] + # Gets or sets the cleanup state of the solution. + ${CleanupState}, + + [Parameter(ParameterSetName='PutExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [System.Int32] + # Gets or sets the count of assessments reported by the solution. + ${DetailAssessmentCount}, + + [Parameter(ParameterSetName='PutExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.ISolutionDetailsExtendedDetails]))] + [System.Collections.Hashtable] + # Gets or sets the extended details reported by the solution. + ${DetailExtendedDetail}, + + [Parameter(ParameterSetName='PutExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [System.Int32] + # Gets or sets the count of groups reported by the solution. + ${DetailGroupCount}, + + [Parameter(ParameterSetName='PutExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [System.String] + # Gets or sets the ETAG for optimistic concurrency control. + ${Etag}, + + [Parameter(ParameterSetName='PutExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [System.String] + # Gets or sets the goal of the solution. + ${Goal}, + + [Parameter(ParameterSetName='PutExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [System.String] + # Gets or sets the purpose of the solution. + ${Purpose}, + + [Parameter(ParameterSetName='PutExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [System.String] + # Gets or sets the current status of the solution. + ${Status}, + + [Parameter(ParameterSetName='PutExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Body')] + [System.String] + # Gets or sets the tool being used in the solution. + ${Tool}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Azure')] + [System.Management.Automation.PSObject] + # The DefaultProfile parameter is not functional. + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Migrate.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 = @{ + Put = 'Az.Migrate.private\Set-AzMigrateSolution_Put'; + PutExpanded = 'Az.Migrate.private\Set-AzMigrateSolution_PutExpanded'; + } + if (('Put', 'PutExpanded') -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/src/Migrate/Migrate.Autorest/test/Get-AzMigrateHCIJob.Recording.json b/src/Migrate/Migrate.Autorest/test/Get-AzMigrateHCIJob.Recording.json new file mode 100644 index 000000000000..83a6ec1cd73f --- /dev/null +++ b/src/Migrate/Migrate.Autorest/test/Get-AzMigrateHCIJob.Recording.json @@ -0,0 +1,428 @@ +{ + "Get-AzMigrateHCIJob+[NoContext]+ListByName+$GET+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.Migrate/migrateProjects/samlee3proj4/solutions/Servers-Migration-ServerMigration_DataReplication?api-version=2018-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.Migrate/migrateProjects/samlee3proj4/solutions/Servers-Migration-ServerMigration_DataReplication?api-version=2018-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "1" ], + "x-ms-client-request-id": [ "0fc37bbe-d59c-405d-b643-9db8c243e982" ], + "CommandName": [ "Az.Migrate\\Get-AzMigrateSolution" ], + "FullCommandName": [ "Get-AzMigrateSolution_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.6", "Az.Migrate/1.0.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "698923d7-0034-4c59-8bbe-8bf8cdcae78c" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-correlation-request-id": [ "02fb27cc-c201-4de6-bb0f-e5dc0106c4b8" ], + "x-ms-routing-request-id": [ "CENTRALUS:20230822T212402Z:02fb27cc-c201-4de6-bb0f-e5dc0106c4b8" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 79BBBF94FC7E4B5FAEDDE6DF7F67E3FB Ref B: CO6AA3150219049 Ref C: 2023-08-22T21:24:00Z" ], + "Date": [ "Tue, 22 Aug 2023 21:24:02 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1119" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.Migrate/MigrateProjects/samlee3proj4/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"name\":\"Servers-Migration-ServerMigration_DataReplication\",\"type\":\"Microsoft.Migrate/MigrateProjects/Solutions\",\"etag\":\"\\\"0b00be81-0000-1800-0000-64e525810000\\\"\",\"properties\":{\"tool\":\"ServerMigration_DataReplication\",\"purpose\":\"Migration\",\"goal\":\"Servers\",\"status\":\"Inactive\",\"cleanupState\":\"None\",\"summary\":{\"instanceType\":\"Servers\",\"discoveredCount\":0,\"assessedCount\":0,\"replicatingCount\":0,\"testMigratedCount\":0,\"migratedCount\":0},\"details\":{\"groupCount\":0,\"assessmentCount\":0,\"extendedDetails\":{\"serversOnWindows\":\"0\",\"serversOnLinux\":\"0\",\"serversOnOther\":\"0\",\"dependencyEnabledMachines\":\"0\",\"machinesHavingSqlServers\":\"0\",\"machinesHavingWebServers\":\"0\",\"vaultId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault\",\"aszreplicatingCount\":\"9\",\"asztestMigratedCount\":\"0\",\"aszmigratedCount\":\"0\"}}}}", + "isContentBase64": false + } + }, + "Get-AzMigrateHCIJob+[NoContext]+ListByName+$GET+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs?api-version=2021-02-16-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs?api-version=2021-02-16-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "2" ], + "x-ms-client-request-id": [ "c62c0bb7-6439-40f0-83f8-4222dc0f4f31" ], + "CommandName": [ "Az.Migrate.Internal\\Get-AzMigrateWorkflow" ], + "FullCommandName": [ "Get-AzMigrateWorkflow_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.6", "Az.Migrate/1.0.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "api-supported-versions": [ "2021-02-16-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-request-id": [ "1fb192f8-c283-47a3-8b81-869880c9addc" ], + "x-ms-correlation-request-id": [ "1fb192f8-c283-47a3-8b81-869880c9addc" ], + "x-ms-routing-request-id": [ "CENTRALUS:20230822T212404Z:1fb192f8-c283-47a3-8b81-869880c9addc" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 241389143F1B46B4986639D0E0F87EF4 Ref B: CO6AA3150219049 Ref C: 2023-08-22T21:24:02Z" ], + "Date": [ "Tue, 22 Aug 2023 21:24:04 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "93935" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"properties\":{\"displayName\":\"Delete protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-22T21:15:43.1838695Z\",\"endTime\":\"2023-08-22T21:16:46Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/0eb54043-3a9c-454e-be52-70aaaacf5e59\",\"name\":\"0eb54043-3a9c-454e-be52-70aaaacf5e59\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Planned failover\",\"state\":\"Failed\",\"startTime\":\"2023-08-22T20:51:19.6026718Z\",\"endTime\":\"2023-08-22T20:58:38Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851/plannedFailover\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/684cc56e-2ee9-40b3-89f9-5efd3d87c1e8\",\"name\":\"684cc56e-2ee9-40b3-89f9-5efd3d87c1e8\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Complete initial replication\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-22T19:58:19.7353059Z\",\"endTime\":\"2023-08-22T19:58:20Z\",\"objectId\":null,\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/eb6335f4-c7cf-4ba4-a5f7-4f32aad8bda6\",\"name\":\"eb6335f4-c7cf-4ba4-a5f7-4f32aad8bda6\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Planned failover\",\"state\":\"Failed\",\"startTime\":\"2023-08-22T19:19:27.0515062Z\",\"endTime\":\"2023-08-22T19:29:13Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b/plannedFailover\",\"objectName\":\"3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectInternalId\":\"5eec484f-c573-54cc-a516-ea584dd9ec33\",\"objectInternalName\":\"testsamlee1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/f3d48482-98ac-49d0-8fa0-e4deb5464109\",\"name\":\"f3d48482-98ac-49d0-8fa0-e4deb5464109\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-22T19:04:12.4472858Z\",\"endTime\":\"2023-08-22T19:04:16Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectName\":\"3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectInternalId\":\"5eec484f-c573-54cc-a516-ea584dd9ec33\",\"objectInternalName\":\"testsamlee1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/2a1cd367-5ed2-4268-8671-2495d952984e\",\"name\":\"2a1cd367-5ed2-4268-8671-2495d952984e\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Complete initial replication\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-22T18:52:20.1870846Z\",\"endTime\":\"2023-08-22T18:52:21Z\",\"objectId\":null,\"objectName\":\"3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectInternalId\":\"5eec484f-c573-54cc-a516-ea584dd9ec33\",\"objectInternalName\":\"testsamlee1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/5e675be8-bb32-4228-9f8d-aaeac2973def\",\"name\":\"5e675be8-bb32-4228-9f8d-aaeac2973def\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-22T18:45:43.4218455Z\",\"endTime\":\"2023-08-22T18:47:52Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectName\":\"3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectInternalId\":\"5eec484f-c573-54cc-a516-ea584dd9ec33\",\"objectInternalName\":\"testsamlee1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/aa446c58-ddd8-4ff5-ab81-a329b27f7273\",\"name\":\"aa446c58-ddd8-4ff5-ab81-a329b27f7273\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-22T18:44:22.6269537Z\",\"endTime\":\"2023-08-22T18:45:24Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/5c6223fd-1f9d-47d8-9314-1ee6cd544295\",\"name\":\"5c6223fd-1f9d-47d8-9314-1ee6cd544295\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Delete protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-22T18:42:46.2652743Z\",\"endTime\":\"2023-08-22T18:42:48Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectName\":\"3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectInternalId\":\"5eec484f-c573-54cc-a516-ea584dd9ec33\",\"objectInternalName\":\"testsamlee1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/5a9aa7a4-0127-4449-a489-d5825435fff0\",\"name\":\"5a9aa7a4-0127-4449-a489-d5825435fff0\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Delete protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-22T18:42:41.6445916Z\",\"endTime\":\"2023-08-22T18:42:44Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/0361de7f-2634-414c-af4e-84909af6cd42\",\"name\":\"0361de7f-2634-414c-af4e-84909af6cd42\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-22T18:37:59.5249858Z\",\"endTime\":\"2023-08-22T18:39:35Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectName\":\"3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectInternalId\":\"5eec484f-c573-54cc-a516-ea584dd9ec33\",\"objectInternalName\":\"testsamlee1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/cb76d23f-533f-4c16-b86b-8b0746ebdc67\",\"name\":\"cb76d23f-533f-4c16-b86b-8b0746ebdc67\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-22T18:29:13.5169836Z\",\"endTime\":\"2023-08-22T18:32:35Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/6d323c4d-ec25-4a4e-a5e8-76dd7100db75\",\"name\":\"6d323c4d-ec25-4a4e-a5e8-76dd7100db75\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Delete protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-22T18:18:53.0000945Z\",\"endTime\":\"2023-08-22T18:18:55Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/b0239c70-71b8-41a3-9e77-ebd46046c9cb\",\"name\":\"b0239c70-71b8-41a3-9e77-ebd46046c9cb\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-22T18:05:20.4268109Z\",\"endTime\":\"2023-08-22T18:08:37Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/958c3431-b409-40e8-b2d0-21ba33da2198\",\"name\":\"958c3431-b409-40e8-b2d0-21ba33da2198\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Delete protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-22T18:04:18.4195958Z\",\"endTime\":\"2023-08-22T18:04:20Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/13680258-0e07-4b18-9886-e7c6db979710\",\"name\":\"13680258-0e07-4b18-9886-e7c6db979710\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-22T18:03:39.0061229Z\",\"endTime\":\"2023-08-22T18:03:41Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectName\":\"c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectInternalId\":\"51354a7f-b5a0-562b-9865-752c03022e30\",\"objectInternalName\":\"testmayada2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/41fd6194-073d-4a0f-9408-0a7595cffd9b\",\"name\":\"41fd6194-073d-4a0f-9408-0a7595cffd9b\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Delete protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-22T18:00:57.7928969Z\",\"endTime\":\"2023-08-22T18:02:28Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/2cb313ba-0219-4c96-9181-a8b55487bef3\",\"name\":\"2cb313ba-0219-4c96-9181-a8b55487bef3\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-22T18:00:34.5615968Z\",\"endTime\":\"2023-08-22T18:02:04Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/13306547-6699-499d-a6eb-8d7edf2074d8\",\"name\":\"13306547-6699-499d-a6eb-8d7edf2074d8\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Delete protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-22T17:59:27.3955116Z\",\"endTime\":\"2023-08-22T18:03:50Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/bf0ddf14-8087-4a02-9b97-ecc86553517e\",\"name\":\"bf0ddf14-8087-4a02-9b97-ecc86553517e\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Delete protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-22T17:59:21.2457809Z\",\"endTime\":\"2023-08-22T17:59:22Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectName\":\"3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectInternalId\":\"5eec484f-c573-54cc-a516-ea584dd9ec33\",\"objectInternalName\":\"testsamlee1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/efd96701-db1b-4a60-9026-8b508e261497\",\"name\":\"efd96701-db1b-4a60-9026-8b508e261497\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-22T17:44:22.3874102Z\",\"endTime\":\"2023-08-22T17:44:26Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectName\":\"c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectInternalId\":\"51354a7f-b5a0-562b-9865-752c03022e30\",\"objectInternalName\":\"testmayada2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/a67416fc-bf99-46b2-9287-bcce1a2f1da4\",\"name\":\"a67416fc-bf99-46b2-9287-bcce1a2f1da4\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-22T17:37:43.7785496Z\",\"endTime\":\"2023-08-22T17:37:48Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectName\":\"c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectInternalId\":\"51354a7f-b5a0-562b-9865-752c03022e30\",\"objectInternalName\":\"testmayada2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/fce3a036-8eb1-48df-9c27-0d4493132387\",\"name\":\"fce3a036-8eb1-48df-9c27-0d4493132387\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-22T17:33:28.21386Z\",\"endTime\":\"2023-08-22T17:33:31Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectName\":\"3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectInternalId\":\"5eec484f-c573-54cc-a516-ea584dd9ec33\",\"objectInternalName\":\"testsamlee1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/bb6d533f-3b38-4320-ad61-a471c615cd56\",\"name\":\"bb6d533f-3b38-4320-ad61-a471c615cd56\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-22T17:10:47.565435Z\",\"endTime\":\"2023-08-22T17:10:49Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectName\":\"3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectInternalId\":\"5eec484f-c573-54cc-a516-ea584dd9ec33\",\"objectInternalName\":\"testsamlee1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/3b12799c-face-4bbe-b31a-b901d5186a00\",\"name\":\"3b12799c-face-4bbe-b31a-b901d5186a00\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-22T16:44:24.1021316Z\",\"endTime\":\"2023-08-22T16:44:27Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectName\":\"c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectInternalId\":\"51354a7f-b5a0-562b-9865-752c03022e30\",\"objectInternalName\":\"testmayada2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/be994c7d-8131-4ca9-8a16-571b873d6ea4\",\"name\":\"be994c7d-8131-4ca9-8a16-571b873d6ea4\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-22T16:39:02.0482295Z\",\"endTime\":\"2023-08-22T16:39:04Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectName\":\"3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectInternalId\":\"5eec484f-c573-54cc-a516-ea584dd9ec33\",\"objectInternalName\":\"testsamlee1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/b73d3bbe-ce64-4513-a127-9faa3cd51d24\",\"name\":\"b73d3bbe-ce64-4513-a127-9faa3cd51d24\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-22T16:35:31.6382074Z\",\"endTime\":\"2023-08-22T16:35:33Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectName\":\"3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectInternalId\":\"5eec484f-c573-54cc-a516-ea584dd9ec33\",\"objectInternalName\":\"testsamlee1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/611dee57-45cd-4317-8e7b-2c93ad553e0b\",\"name\":\"611dee57-45cd-4317-8e7b-2c93ad553e0b\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-22T16:21:49.874412Z\",\"endTime\":\"2023-08-22T16:23:52Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/ce64b30e-c079-43fa-b355-79a7cfc872db\",\"name\":\"ce64b30e-c079-43fa-b355-79a7cfc872db\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Delete protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-22T16:19:32.8364177Z\",\"endTime\":\"2023-08-22T16:19:35Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/3cc3dd1f-af4a-4168-a5dc-48496e033dff\",\"name\":\"3cc3dd1f-af4a-4168-a5dc-48496e033dff\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-22T16:12:21.1185973Z\",\"endTime\":\"2023-08-22T16:14:58Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/c75ad76d-1687-4df2-aa61-307c832da280\",\"name\":\"c75ad76d-1687-4df2-aa61-307c832da280\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Delete protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-22T15:58:52.9962488Z\",\"endTime\":\"2023-08-22T15:58:55Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectName\":\"3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectInternalId\":\"5eec484f-c573-54cc-a516-ea584dd9ec33\",\"objectInternalName\":\"testsamlee1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/4977dfc0-8e13-41e7-9c9b-eb18f04b92f0\",\"name\":\"4977dfc0-8e13-41e7-9c9b-eb18f04b92f0\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Delete protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-22T15:58:40.5090951Z\",\"endTime\":\"2023-08-22T15:58:43Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/a5870212-2303-4336-b7f0-5193aa6d98f9\",\"name\":\"a5870212-2303-4336-b7f0-5193aa6d98f9\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Delete protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-22T15:57:29.4176675Z\",\"endTime\":\"2023-08-22T15:58:13Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectName\":\"3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectInternalId\":\"5eec484f-c573-54cc-a516-ea584dd9ec33\",\"objectInternalName\":\"testsamlee1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/a94b3ee7-b24e-481b-9f69-60c2c40ffd83\",\"name\":\"a94b3ee7-b24e-481b-9f69-60c2c40ffd83\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Delete protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-22T15:56:54.2247093Z\",\"endTime\":\"2023-08-22T15:58:08Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/d51fea4e-dce9-44da-abd0-43e907f479b7\",\"name\":\"d51fea4e-dce9-44da-abd0-43e907f479b7\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Delete protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-22T14:15:21.6494187Z\",\"endTime\":\"2023-08-22T14:16:35Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/e2dfdfd5-31c2-4b1f-b215-fd8270aad2d0\",\"objectName\":\"e2dfdfd5-31c2-4b1f-b215-fd8270aad2d0\",\"objectInternalId\":\"eed85d04-2f19-56c9-bd93-28067e585a35\",\"objectInternalName\":\"testmayada1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/c50dbc41-6705-4445-9230-07a495af7e29\",\"name\":\"c50dbc41-6705-4445-9230-07a495af7e29\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Delete protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-22T14:15:12.5738456Z\",\"endTime\":\"2023-08-22T14:16:35Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectName\":\"3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectInternalId\":\"5eec484f-c573-54cc-a516-ea584dd9ec33\",\"objectInternalName\":\"testsamlee1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/b9456e03-08f9-4581-bc70-2cbacfdbaedd\",\"name\":\"b9456e03-08f9-4581-bc70-2cbacfdbaedd\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Delete protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-22T14:15:04.0073683Z\",\"endTime\":\"2023-08-22T14:16:36Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/c5e72166-b1f9-484a-96fd-71b1e58dd97e\",\"name\":\"c5e72166-b1f9-484a-96fd-71b1e58dd97e\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-22T01:28:47.4270654Z\",\"endTime\":\"2023-08-22T01:28:50Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectName\":\"c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectInternalId\":\"51354a7f-b5a0-562b-9865-752c03022e30\",\"objectInternalName\":\"testmayada2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/9f84302d-e489-4831-b765-7a05ea45aa00\",\"name\":\"9f84302d-e489-4831-b765-7a05ea45aa00\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-22T00:48:04.8761435Z\",\"endTime\":\"2023-08-22T00:48:06Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectName\":\"c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectInternalId\":\"51354a7f-b5a0-562b-9865-752c03022e30\",\"objectInternalName\":\"testmayada2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/533427f0-c7c3-43f3-b9cc-3ef5de66c765\",\"name\":\"533427f0-c7c3-43f3-b9cc-3ef5de66c765\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-21T17:35:18.501399Z\",\"endTime\":\"2023-08-21T17:35:20Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectName\":\"c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectInternalId\":\"51354a7f-b5a0-562b-9865-752c03022e30\",\"objectInternalName\":\"testmayada2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/473e721f-09b2-44d6-b415-e80db8552667\",\"name\":\"473e721f-09b2-44d6-b415-e80db8552667\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-21T17:12:51.7214082Z\",\"endTime\":\"2023-08-21T17:12:53Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectName\":\"c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectInternalId\":\"51354a7f-b5a0-562b-9865-752c03022e30\",\"objectInternalName\":\"testmayada2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/4575caf2-4a11-4423-8a36-0e3d784fbcd8\",\"name\":\"4575caf2-4a11-4423-8a36-0e3d784fbcd8\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-21T17:09:23.4347107Z\",\"endTime\":\"2023-08-21T17:12:36Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectName\":\"c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectInternalId\":\"51354a7f-b5a0-562b-9865-752c03022e30\",\"objectInternalName\":\"testmayada2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/76406cc7-119e-4c08-8fb7-bf82c36530e0\",\"name\":\"76406cc7-119e-4c08-8fb7-bf82c36530e0\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Complete initial replication\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-21T16:54:16.5929474Z\",\"endTime\":\"2023-08-21T16:54:17Z\",\"objectId\":null,\"objectName\":\"e2dfdfd5-31c2-4b1f-b215-fd8270aad2d0\",\"objectInternalId\":\"eed85d04-2f19-56c9-bd93-28067e585a35\",\"objectInternalName\":\"testmayada1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/8b86ba51-e680-4e7b-b0be-83c44a932564\",\"name\":\"8b86ba51-e680-4e7b-b0be-83c44a932564\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-21T16:53:13.9418056Z\",\"endTime\":\"2023-08-21T16:53:16Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/c44473d0-a8ce-41bc-8638-14a0bd956ddd\",\"objectName\":\"c44473d0-a8ce-41bc-8638-14a0bd956ddd\",\"objectInternalId\":\"90288fee-74a0-5073-89ca-838b62dc68bc\",\"objectInternalName\":\"testmayada6\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/8a8fa4d3-1e6c-4271-84eb-ecf46a3c2be0\",\"name\":\"8a8fa4d3-1e6c-4271-84eb-ecf46a3c2be0\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Delete protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-21T16:52:21.8212532Z\",\"endTime\":\"2023-08-21T16:53:44Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectName\":\"3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectInternalId\":\"5eec484f-c573-54cc-a516-ea584dd9ec33\",\"objectInternalName\":\"testsamlee1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/e1c1d281-5688-44e5-9a1a-e2d66b6d02b9\",\"name\":\"e1c1d281-5688-44e5-9a1a-e2d66b6d02b9\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-21T16:49:48.0989788Z\",\"endTime\":\"2023-08-21T16:49:49Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/c44473d0-a8ce-41bc-8638-14a0bd956ddd\",\"objectName\":\"c44473d0-a8ce-41bc-8638-14a0bd956ddd\",\"objectInternalId\":\"90288fee-74a0-5073-89ca-838b62dc68bc\",\"objectInternalName\":\"testmayada6\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/41b28e3a-3b31-4950-8eb4-91c1249c6ae3\",\"name\":\"41b28e3a-3b31-4950-8eb4-91c1249c6ae3\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-21T16:40:30.6659618Z\",\"endTime\":\"2023-08-21T16:43:30Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/e2dfdfd5-31c2-4b1f-b215-fd8270aad2d0\",\"objectName\":\"e2dfdfd5-31c2-4b1f-b215-fd8270aad2d0\",\"objectInternalId\":\"eed85d04-2f19-56c9-bd93-28067e585a35\",\"objectInternalName\":\"testmayada1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/b370c87a-6762-4ae5-bb93-3157ca827e14\",\"name\":\"b370c87a-6762-4ae5-bb93-3157ca827e14\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-21T15:22:04.4645019Z\",\"endTime\":\"2023-08-21T15:22:07Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/3244075c-81b0-49bc-8631-74d682f08285\",\"name\":\"3244075c-81b0-49bc-8631-74d682f08285\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-21T08:12:08.0513149Z\",\"endTime\":\"2023-08-21T08:12:09Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/c44473d0-a8ce-41bc-8638-14a0bd956ddd\",\"objectName\":\"c44473d0-a8ce-41bc-8638-14a0bd956ddd\",\"objectInternalId\":\"90288fee-74a0-5073-89ca-838b62dc68bc\",\"objectInternalName\":\"testmayada6\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/623f72f9-1afd-43f2-8e45-f0ac8ada0ea7\",\"name\":\"623f72f9-1afd-43f2-8e45-f0ac8ada0ea7\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-19T17:45:02.4664216Z\",\"endTime\":\"2023-08-19T17:45:05Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/c44473d0-a8ce-41bc-8638-14a0bd956ddd\",\"objectName\":\"c44473d0-a8ce-41bc-8638-14a0bd956ddd\",\"objectInternalId\":\"90288fee-74a0-5073-89ca-838b62dc68bc\",\"objectInternalName\":\"testmayada6\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/a29474b0-7944-47ec-8112-3f4992b39e66\",\"name\":\"a29474b0-7944-47ec-8112-3f4992b39e66\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Planned failover\",\"state\":\"Failed\",\"startTime\":\"2023-08-19T17:20:53.0756674Z\",\"endTime\":\"2023-08-19T17:30:28Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b/plannedFailover\",\"objectName\":\"3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectInternalId\":\"5eec484f-c573-54cc-a516-ea584dd9ec33\",\"objectInternalName\":\"testsamlee1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/78ddc07c-a70e-4dde-8f89-759e3e0e71de\",\"name\":\"78ddc07c-a70e-4dde-8f89-759e3e0e71de\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Complete initial replication\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-19T10:21:31.1598809Z\",\"endTime\":\"2023-08-19T10:21:32Z\",\"objectId\":null,\"objectName\":\"3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectInternalId\":\"5eec484f-c573-54cc-a516-ea584dd9ec33\",\"objectInternalName\":\"testsamlee1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/ff64dfec-cc49-4072-bf1b-601dc5238791\",\"name\":\"ff64dfec-cc49-4072-bf1b-601dc5238791\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-19T09:48:35.0514006Z\",\"endTime\":\"2023-08-19T09:50:41Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectName\":\"3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectInternalId\":\"5eec484f-c573-54cc-a516-ea584dd9ec33\",\"objectInternalName\":\"testsamlee1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/0503cbeb-58c4-4fa5-b1ff-090b3521a954\",\"name\":\"0503cbeb-58c4-4fa5-b1ff-090b3521a954\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Complete initial replication\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-19T05:04:29.7674604Z\",\"endTime\":\"2023-08-19T05:04:31Z\",\"objectId\":null,\"objectName\":\"c44473d0-a8ce-41bc-8638-14a0bd956ddd\",\"objectInternalId\":\"90288fee-74a0-5073-89ca-838b62dc68bc\",\"objectInternalName\":\"testmayada6\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/81578cce-919f-445d-b8c1-07869bae8b38\",\"name\":\"81578cce-919f-445d-b8c1-07869bae8b38\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-19T04:18:40.0736603Z\",\"endTime\":\"2023-08-19T04:20:54Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/c44473d0-a8ce-41bc-8638-14a0bd956ddd\",\"objectName\":\"c44473d0-a8ce-41bc-8638-14a0bd956ddd\",\"objectInternalId\":\"90288fee-74a0-5073-89ca-838b62dc68bc\",\"objectInternalName\":\"testmayada6\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/29620f72-f849-473a-83f6-9453ba097eb9\",\"name\":\"29620f72-f849-473a-83f6-9453ba097eb9\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-18T22:23:09.3684133Z\",\"endTime\":\"2023-08-18T22:23:11Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/122d7dbf-2e2b-4912-88bd-6d52775cc9cd\",\"name\":\"122d7dbf-2e2b-4912-88bd-6d52775cc9cd\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Complete initial replication\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-18T22:05:27.1644308Z\",\"endTime\":\"2023-08-18T22:05:28Z\",\"objectId\":null,\"objectName\":\"cd0b80c6-074f-474d-86e4-733ded0e0819\",\"objectInternalId\":\"68153b29-d298-54f7-a324-58209db3f78a\",\"objectInternalName\":\"testmayada5\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/397a5379-7628-4325-a65d-30107d469d28\",\"name\":\"397a5379-7628-4325-a65d-30107d469d28\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-18T21:46:45.828483Z\",\"endTime\":\"2023-08-18T21:52:22Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/cd0b80c6-074f-474d-86e4-733ded0e0819\",\"objectName\":\"cd0b80c6-074f-474d-86e4-733ded0e0819\",\"objectInternalId\":\"68153b29-d298-54f7-a324-58209db3f78a\",\"objectInternalName\":\"testmayada5\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/94d83dfd-c609-432c-a095-0d46d1b9bfbb\",\"name\":\"94d83dfd-c609-432c-a095-0d46d1b9bfbb\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-18T19:44:24.7669997Z\",\"endTime\":\"2023-08-18T19:44:25Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/840ec58b-8980-4030-9b0e-1a6a3d3957ac\",\"name\":\"840ec58b-8980-4030-9b0e-1a6a3d3957ac\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-18T19:30:07.6737569Z\",\"endTime\":\"2023-08-18T19:30:12Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/611139c5-82ab-4618-8c65-06bc97cf106a\",\"name\":\"611139c5-82ab-4618-8c65-06bc97cf106a\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-18T19:24:58.6325983Z\",\"endTime\":\"2023-08-18T19:25:03Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/cd0b80c6-074f-474d-86e4-733ded0e0819\",\"objectName\":\"cd0b80c6-074f-474d-86e4-733ded0e0819\",\"objectInternalId\":\"68153b29-d298-54f7-a324-58209db3f78a\",\"objectInternalName\":\"testmayada5\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/717881c3-1c0c-4b6d-95f4-6ca15fe370c8\",\"name\":\"717881c3-1c0c-4b6d-95f4-6ca15fe370c8\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-18T12:37:34.3424172Z\",\"endTime\":\"2023-08-18T12:37:35Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/2d756633-eab0-400c-8e66-a3e141fda6a3\",\"name\":\"2d756633-eab0-400c-8e66-a3e141fda6a3\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-18T07:16:10.3653368Z\",\"endTime\":\"2023-08-18T07:16:11Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/cd0b80c6-074f-474d-86e4-733ded0e0819\",\"objectName\":\"cd0b80c6-074f-474d-86e4-733ded0e0819\",\"objectInternalId\":\"68153b29-d298-54f7-a324-58209db3f78a\",\"objectInternalName\":\"testmayada5\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/171c6729-57bc-4fd0-af67-f72d1c00ec5c\",\"name\":\"171c6729-57bc-4fd0-af67-f72d1c00ec5c\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-17T21:25:44.1345093Z\",\"endTime\":\"2023-08-17T21:25:45Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/1339dbfa-6823-4d3d-b9a8-a9b661a9ffa1\",\"name\":\"1339dbfa-6823-4d3d-b9a8-a9b661a9ffa1\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-17T19:37:07.1330143Z\",\"endTime\":\"2023-08-17T19:37:09Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/24c712b4-dc3f-480a-8abf-93ca01f7dbee\",\"name\":\"24c712b4-dc3f-480a-8abf-93ca01f7dbee\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-17T18:44:41.3202933Z\",\"endTime\":\"2023-08-17T18:44:44Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/a2631c58-a580-4adc-a979-59f25993b1a0\",\"name\":\"a2631c58-a580-4adc-a979-59f25993b1a0\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-17T18:33:47.9738601Z\",\"endTime\":\"2023-08-17T18:33:50Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/62302eba-6e29-4127-a468-14a95035f98f\",\"name\":\"62302eba-6e29-4127-a468-14a95035f98f\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-17T18:31:17.6174922Z\",\"endTime\":\"2023-08-17T18:31:19Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/f1249350-184d-4886-aea7-5a7c43522611\",\"name\":\"f1249350-184d-4886-aea7-5a7c43522611\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Complete initial replication\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-17T14:49:17.005277Z\",\"endTime\":\"2023-08-17T14:49:47.005277Z\",\"objectId\":null,\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/8ac48f51-1753-4c60-9c87-43fc3a35bcdf\",\"name\":\"8ac48f51-1753-4c60-9c87-43fc3a35bcdf\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-17T14:12:47.6687128Z\",\"endTime\":\"2023-08-17T14:18:03Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/dca5d244-5348-40e7-91dd-2942ef1aafd5\",\"name\":\"dca5d244-5348-40e7-91dd-2942ef1aafd5\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Delete protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-17T13:58:22.676376Z\",\"endTime\":\"2023-08-17T13:58:24Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/6b802b72-36bc-4b4f-9572-d477c6e3916e\",\"name\":\"6b802b72-36bc-4b4f-9572-d477c6e3916e\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Delete protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-17T13:57:54.5550871Z\",\"endTime\":\"2023-08-17T13:57:56Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectName\":\"c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectInternalId\":\"51354a7f-b5a0-562b-9865-752c03022e30\",\"objectInternalName\":\"testmayada2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/f37c15df-b879-45d0-8857-02e2bb3a0435\",\"name\":\"f37c15df-b879-45d0-8857-02e2bb3a0435\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Delete protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-17T13:54:22.5349141Z\",\"endTime\":\"2023-08-17T13:56:26Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectName\":\"c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectInternalId\":\"51354a7f-b5a0-562b-9865-752c03022e30\",\"objectInternalName\":\"testmayada2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/c8bb81d5-9e9a-425d-bc33-f82bf459622b\",\"name\":\"c8bb81d5-9e9a-425d-bc33-f82bf459622b\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Complete initial replication\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-16T22:01:14.722684Z\",\"endTime\":\"2023-08-16T22:01:16Z\",\"objectId\":null,\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/daea637c-468a-4563-a0a2-370267bccd24\",\"name\":\"daea637c-468a-4563-a0a2-370267bccd24\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-16T20:55:25.720599Z\",\"endTime\":\"2023-08-16T21:02:06Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/45623004-07cf-491a-86da-fbf6e22234a7\",\"name\":\"45623004-07cf-491a-86da-fbf6e22234a7\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Delete protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-16T19:38:04.3587937Z\",\"endTime\":\"2023-08-16T19:45:18Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectName\":\"c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectInternalId\":\"51354a7f-b5a0-562b-9865-752c03022e30\",\"objectInternalName\":\"testmayada2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/8aa76292-04a6-4b09-a4e7-9201391f7223\",\"name\":\"8aa76292-04a6-4b09-a4e7-9201391f7223\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-16T18:31:37.0721002Z\",\"endTime\":\"2023-08-16T18:38:03Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectName\":\"c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectInternalId\":\"51354a7f-b5a0-562b-9865-752c03022e30\",\"objectInternalName\":\"testmayada2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/c6f5ac4d-60af-459b-8ca1-bc9bd9814d3b\",\"name\":\"c6f5ac4d-60af-459b-8ca1-bc9bd9814d3b\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null}],\"nextLink\":null}", + "isContentBase64": false + } + }, + "Get-AzMigrateHCIJob+[NoContext]+GetByName+$GET+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.Migrate/migrateProjects/samlee3proj4/solutions/Servers-Migration-ServerMigration_DataReplication?api-version=2018-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.Migrate/migrateProjects/samlee3proj4/solutions/Servers-Migration-ServerMigration_DataReplication?api-version=2018-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "3" ], + "x-ms-client-request-id": [ "4e5bde84-ed80-4643-96c0-b10c49fdfa4e" ], + "CommandName": [ "Az.Migrate\\Get-AzMigrateSolution" ], + "FullCommandName": [ "Get-AzMigrateSolution_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.6", "Az.Migrate/1.0.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "1cbe5296-298b-434f-9354-69c371530669" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-correlation-request-id": [ "aaad121e-49f2-4ca6-b3e5-d8ae78c91591" ], + "x-ms-routing-request-id": [ "CENTRALUS:20230822T212406Z:aaad121e-49f2-4ca6-b3e5-d8ae78c91591" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: D2CBD24DC2DF4B1CB0A18C33E61507AF Ref B: CO6AA3150219049 Ref C: 2023-08-22T21:24:04Z" ], + "Date": [ "Tue, 22 Aug 2023 21:24:06 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1119" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.Migrate/MigrateProjects/samlee3proj4/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"name\":\"Servers-Migration-ServerMigration_DataReplication\",\"type\":\"Microsoft.Migrate/MigrateProjects/Solutions\",\"etag\":\"\\\"0b00be81-0000-1800-0000-64e525810000\\\"\",\"properties\":{\"tool\":\"ServerMigration_DataReplication\",\"purpose\":\"Migration\",\"goal\":\"Servers\",\"status\":\"Inactive\",\"cleanupState\":\"None\",\"summary\":{\"instanceType\":\"Servers\",\"discoveredCount\":0,\"assessedCount\":0,\"replicatingCount\":0,\"testMigratedCount\":0,\"migratedCount\":0},\"details\":{\"groupCount\":0,\"assessmentCount\":0,\"extendedDetails\":{\"serversOnWindows\":\"0\",\"serversOnLinux\":\"0\",\"serversOnOther\":\"0\",\"dependencyEnabledMachines\":\"0\",\"machinesHavingSqlServers\":\"0\",\"machinesHavingWebServers\":\"0\",\"vaultId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault\",\"aszreplicatingCount\":\"9\",\"asztestMigratedCount\":\"0\",\"aszmigratedCount\":\"0\"}}}}", + "isContentBase64": false + } + }, + "Get-AzMigrateHCIJob+[NoContext]+GetByName+$GET+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/f8941ed0-5563-400b-b93c-24dcba833dbb?api-version=2021-02-16-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/f8941ed0-5563-400b-b93c-24dcba833dbb?api-version=2021-02-16-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "4" ], + "x-ms-client-request-id": [ "22951a0d-8cc4-431a-a773-8cfd6795e0c8" ], + "CommandName": [ "Az.Migrate.Internal\\Get-AzMigrateWorkflow" ], + "FullCommandName": [ "Get-AzMigrateWorkflow_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.6", "Az.Migrate/1.0.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "api-supported-versions": [ "2021-02-16-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-request-id": [ "a6620c25-f583-4889-bde1-d37e26c4a648" ], + "x-ms-correlation-request-id": [ "a6620c25-f583-4889-bde1-d37e26c4a648" ], + "x-ms-routing-request-id": [ "CENTRALUS:20230822T212408Z:a6620c25-f583-4889-bde1-d37e26c4a648" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: D72972806C8A444D8D8508C6CCB3974D Ref B: CO6AA3150219049 Ref C: 2023-08-22T21:24:06Z" ], + "Date": [ "Tue, 22 Aug 2023 21:24:08 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "2209" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"displayName\":\"Create or update replication extension\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-09T23:28:01.7449882Z\",\"endTime\":\"2023-08-09T23:31:04Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/replicationExtensions/samlee3src48adfreplicationfabric-samlee3te2acreplicationfabric-MigReplicationExtn\",\"objectName\":\"samlee3src48adfreplicationfabric-samlee3te2acreplicationfabric-MigReplicationExtn\",\"objectInternalId\":\"samlee3src48adfreplicationfabric-samlee3te2acreplicationfabric-MigReplicationExtn\",\"objectInternalName\":\"samlee3src48adfreplicationfabric-samlee3te2acreplicationfabric-MigReplicationExtn\",\"objectType\":\"ReplicationExtension\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":null,\"targetFabricProviderId\":null,\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":[{\"taskName\":\"Creating or updating replication extension\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-09T23:28:03.7770335Z\",\"endTime\":\"2023-08-09T23:28:03.9089976Z\",\"customProperties\":{\"instanceType\":\"TaskDetails\"},\"childrenWorkflows\":[]},{\"taskName\":\"Configuring replication extension on primary\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-09T23:28:03.9089976Z\",\"endTime\":\"2023-08-09T23:29:04.1667009Z\",\"customProperties\":{\"instanceType\":\"TaskDetails\"},\"childrenWorkflows\":[]},{\"taskName\":\"Configuring replication extension on recovery\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-09T23:29:04.1667009Z\",\"endTime\":\"2023-08-09T23:31:04.5065107Z\",\"customProperties\":{\"instanceType\":\"TaskDetails\"},\"childrenWorkflows\":[]}],\"errors\":[],\"customProperties\":{\"instanceType\":\"WorkflowDetails\",\"affectedObjectDetails\":{\"VaultId\":\"62ef9ab2-1017-434a-ac4e-2f2ec988323d\"}}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/f8941ed0-5563-400b-b93c-24dcba833dbb\",\"name\":\"f8941ed0-5563-400b-b93c-24dcba833dbb\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null}", + "isContentBase64": false + } + }, + "Get-AzMigrateHCIJob+[NoContext]+GetById+$GET+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/f8941ed0-5563-400b-b93c-24dcba833dbb?api-version=2021-02-16-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/f8941ed0-5563-400b-b93c-24dcba833dbb?api-version=2021-02-16-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "5" ], + "x-ms-client-request-id": [ "eaa13a23-9ed5-4a12-a1ca-61d7be714e45" ], + "CommandName": [ "Az.Migrate.Internal\\Get-AzMigrateWorkflow" ], + "FullCommandName": [ "Get-AzMigrateWorkflow_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.6", "Az.Migrate/1.0.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "api-supported-versions": [ "2021-02-16-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-request-id": [ "df4f613f-b035-4010-8d8f-5047e91ccc7f" ], + "x-ms-correlation-request-id": [ "df4f613f-b035-4010-8d8f-5047e91ccc7f" ], + "x-ms-routing-request-id": [ "CENTRALUS:20230822T212410Z:df4f613f-b035-4010-8d8f-5047e91ccc7f" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: EC6A8C75FD46459A8ADAA054E3E0A1B6 Ref B: CO6AA3150219049 Ref C: 2023-08-22T21:24:08Z" ], + "Date": [ "Tue, 22 Aug 2023 21:24:09 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "2209" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"displayName\":\"Create or update replication extension\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-09T23:28:01.7449882Z\",\"endTime\":\"2023-08-09T23:31:04Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/replicationExtensions/samlee3src48adfreplicationfabric-samlee3te2acreplicationfabric-MigReplicationExtn\",\"objectName\":\"samlee3src48adfreplicationfabric-samlee3te2acreplicationfabric-MigReplicationExtn\",\"objectInternalId\":\"samlee3src48adfreplicationfabric-samlee3te2acreplicationfabric-MigReplicationExtn\",\"objectInternalName\":\"samlee3src48adfreplicationfabric-samlee3te2acreplicationfabric-MigReplicationExtn\",\"objectType\":\"ReplicationExtension\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":null,\"targetFabricProviderId\":null,\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":[{\"taskName\":\"Creating or updating replication extension\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-09T23:28:03.7770335Z\",\"endTime\":\"2023-08-09T23:28:03.9089976Z\",\"customProperties\":{\"instanceType\":\"TaskDetails\"},\"childrenWorkflows\":[]},{\"taskName\":\"Configuring replication extension on primary\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-09T23:28:03.9089976Z\",\"endTime\":\"2023-08-09T23:29:04.1667009Z\",\"customProperties\":{\"instanceType\":\"TaskDetails\"},\"childrenWorkflows\":[]},{\"taskName\":\"Configuring replication extension on recovery\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-09T23:29:04.1667009Z\",\"endTime\":\"2023-08-09T23:31:04.5065107Z\",\"customProperties\":{\"instanceType\":\"TaskDetails\"},\"childrenWorkflows\":[]}],\"errors\":[],\"customProperties\":{\"instanceType\":\"WorkflowDetails\",\"affectedObjectDetails\":{\"VaultId\":\"62ef9ab2-1017-434a-ac4e-2f2ec988323d\"}}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/f8941ed0-5563-400b-b93c-24dcba833dbb\",\"name\":\"f8941ed0-5563-400b-b93c-24dcba833dbb\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null}", + "isContentBase64": false + } + }, + "Get-AzMigrateHCIJob+[NoContext]+GetByInputObject+$GET+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.Migrate/migrateProjects/samlee3proj4/solutions/Servers-Migration-ServerMigration_DataReplication?api-version=2018-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.Migrate/migrateProjects/samlee3proj4/solutions/Servers-Migration-ServerMigration_DataReplication?api-version=2018-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "6" ], + "x-ms-client-request-id": [ "ffec0563-da4e-46ba-9504-4348b06417da" ], + "CommandName": [ "Az.Migrate\\Get-AzMigrateSolution" ], + "FullCommandName": [ "Get-AzMigrateSolution_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.6", "Az.Migrate/1.0.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "ee21d3fa-85f3-4169-960b-193e7af1ff75" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11998" ], + "x-ms-correlation-request-id": [ "63484581-d72c-4eed-a10a-acf6bd4e2ea8" ], + "x-ms-routing-request-id": [ "CENTRALUS:20230822T212411Z:63484581-d72c-4eed-a10a-acf6bd4e2ea8" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: A4E8A1F960FA4C58AE49F92A23F9AB9E Ref B: CO6AA3150219049 Ref C: 2023-08-22T21:24:10Z" ], + "Date": [ "Tue, 22 Aug 2023 21:24:11 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1119" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.Migrate/MigrateProjects/samlee3proj4/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"name\":\"Servers-Migration-ServerMigration_DataReplication\",\"type\":\"Microsoft.Migrate/MigrateProjects/Solutions\",\"etag\":\"\\\"0b00be81-0000-1800-0000-64e525810000\\\"\",\"properties\":{\"tool\":\"ServerMigration_DataReplication\",\"purpose\":\"Migration\",\"goal\":\"Servers\",\"status\":\"Inactive\",\"cleanupState\":\"None\",\"summary\":{\"instanceType\":\"Servers\",\"discoveredCount\":0,\"assessedCount\":0,\"replicatingCount\":0,\"testMigratedCount\":0,\"migratedCount\":0},\"details\":{\"groupCount\":0,\"assessmentCount\":0,\"extendedDetails\":{\"serversOnWindows\":\"0\",\"serversOnLinux\":\"0\",\"serversOnOther\":\"0\",\"dependencyEnabledMachines\":\"0\",\"machinesHavingSqlServers\":\"0\",\"machinesHavingWebServers\":\"0\",\"vaultId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault\",\"aszreplicatingCount\":\"9\",\"asztestMigratedCount\":\"0\",\"aszmigratedCount\":\"0\"}}}}", + "isContentBase64": false + } + }, + "Get-AzMigrateHCIJob+[NoContext]+GetByInputObject+$GET+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/f8941ed0-5563-400b-b93c-24dcba833dbb?api-version=2021-02-16-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/f8941ed0-5563-400b-b93c-24dcba833dbb?api-version=2021-02-16-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "7" ], + "x-ms-client-request-id": [ "26a83b2c-2d80-4490-b9ae-601439d9f22c" ], + "CommandName": [ "Az.Migrate.Internal\\Get-AzMigrateWorkflow" ], + "FullCommandName": [ "Get-AzMigrateWorkflow_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.6", "Az.Migrate/1.0.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "api-supported-versions": [ "2021-02-16-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11998" ], + "x-ms-request-id": [ "bf1ecc7b-24ed-4b42-be39-c1d62230f692" ], + "x-ms-correlation-request-id": [ "bf1ecc7b-24ed-4b42-be39-c1d62230f692" ], + "x-ms-routing-request-id": [ "CENTRALUS:20230822T212413Z:bf1ecc7b-24ed-4b42-be39-c1d62230f692" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: A8A2ACD72E434043BFD9B9C76EAEB15A Ref B: CO6AA3150219049 Ref C: 2023-08-22T21:24:11Z" ], + "Date": [ "Tue, 22 Aug 2023 21:24:13 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "2209" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"displayName\":\"Create or update replication extension\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-09T23:28:01.7449882Z\",\"endTime\":\"2023-08-09T23:31:04Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/replicationExtensions/samlee3src48adfreplicationfabric-samlee3te2acreplicationfabric-MigReplicationExtn\",\"objectName\":\"samlee3src48adfreplicationfabric-samlee3te2acreplicationfabric-MigReplicationExtn\",\"objectInternalId\":\"samlee3src48adfreplicationfabric-samlee3te2acreplicationfabric-MigReplicationExtn\",\"objectInternalName\":\"samlee3src48adfreplicationfabric-samlee3te2acreplicationfabric-MigReplicationExtn\",\"objectType\":\"ReplicationExtension\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":null,\"targetFabricProviderId\":null,\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":[{\"taskName\":\"Creating or updating replication extension\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-09T23:28:03.7770335Z\",\"endTime\":\"2023-08-09T23:28:03.9089976Z\",\"customProperties\":{\"instanceType\":\"TaskDetails\"},\"childrenWorkflows\":[]},{\"taskName\":\"Configuring replication extension on primary\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-09T23:28:03.9089976Z\",\"endTime\":\"2023-08-09T23:29:04.1667009Z\",\"customProperties\":{\"instanceType\":\"TaskDetails\"},\"childrenWorkflows\":[]},{\"taskName\":\"Configuring replication extension on recovery\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-09T23:29:04.1667009Z\",\"endTime\":\"2023-08-09T23:31:04.5065107Z\",\"customProperties\":{\"instanceType\":\"TaskDetails\"},\"childrenWorkflows\":[]}],\"errors\":[],\"customProperties\":{\"instanceType\":\"WorkflowDetails\",\"affectedObjectDetails\":{\"VaultId\":\"62ef9ab2-1017-434a-ac4e-2f2ec988323d\"}}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/f8941ed0-5563-400b-b93c-24dcba833dbb\",\"name\":\"f8941ed0-5563-400b-b93c-24dcba833dbb\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null}", + "isContentBase64": false + } + }, + "Get-AzMigrateHCIJob+[NoContext]+GetByInputObject+$GET+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/f8941ed0-5563-400b-b93c-24dcba833dbb?api-version=2021-02-16-preview+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/f8941ed0-5563-400b-b93c-24dcba833dbb?api-version=2021-02-16-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "8" ], + "x-ms-client-request-id": [ "ac462a71-443f-4663-997a-f671d03e73f6" ], + "CommandName": [ "Az.Migrate.Internal\\Get-AzMigrateWorkflow" ], + "FullCommandName": [ "Get-AzMigrateWorkflow_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.6", "Az.Migrate/1.0.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "api-supported-versions": [ "2021-02-16-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-request-id": [ "2061d33b-bbee-40a4-8b21-437a930e562b" ], + "x-ms-correlation-request-id": [ "2061d33b-bbee-40a4-8b21-437a930e562b" ], + "x-ms-routing-request-id": [ "CENTRALUS:20230822T212415Z:2061d33b-bbee-40a4-8b21-437a930e562b" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: FA06127C5836477DBDEC06B3A7CEA8FF Ref B: CO6AA3150219049 Ref C: 2023-08-22T21:24:13Z" ], + "Date": [ "Tue, 22 Aug 2023 21:24:14 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "2209" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"displayName\":\"Create or update replication extension\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-09T23:28:01.7449882Z\",\"endTime\":\"2023-08-09T23:31:04Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/replicationExtensions/samlee3src48adfreplicationfabric-samlee3te2acreplicationfabric-MigReplicationExtn\",\"objectName\":\"samlee3src48adfreplicationfabric-samlee3te2acreplicationfabric-MigReplicationExtn\",\"objectInternalId\":\"samlee3src48adfreplicationfabric-samlee3te2acreplicationfabric-MigReplicationExtn\",\"objectInternalName\":\"samlee3src48adfreplicationfabric-samlee3te2acreplicationfabric-MigReplicationExtn\",\"objectType\":\"ReplicationExtension\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":null,\"targetFabricProviderId\":null,\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":[{\"taskName\":\"Creating or updating replication extension\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-09T23:28:03.7770335Z\",\"endTime\":\"2023-08-09T23:28:03.9089976Z\",\"customProperties\":{\"instanceType\":\"TaskDetails\"},\"childrenWorkflows\":[]},{\"taskName\":\"Configuring replication extension on primary\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-09T23:28:03.9089976Z\",\"endTime\":\"2023-08-09T23:29:04.1667009Z\",\"customProperties\":{\"instanceType\":\"TaskDetails\"},\"childrenWorkflows\":[]},{\"taskName\":\"Configuring replication extension on recovery\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-09T23:29:04.1667009Z\",\"endTime\":\"2023-08-09T23:31:04.5065107Z\",\"customProperties\":{\"instanceType\":\"TaskDetails\"},\"childrenWorkflows\":[]}],\"errors\":[],\"customProperties\":{\"instanceType\":\"WorkflowDetails\",\"affectedObjectDetails\":{\"VaultId\":\"62ef9ab2-1017-434a-ac4e-2f2ec988323d\"}}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/f8941ed0-5563-400b-b93c-24dcba833dbb\",\"name\":\"f8941ed0-5563-400b-b93c-24dcba833dbb\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null}", + "isContentBase64": false + } + }, + "Get-AzMigrateHCIJob+[NoContext]+ListById+$GET+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.Migrate/migrateProjects/samlee3proj4/solutions/Servers-Migration-ServerMigration_DataReplication?api-version=2018-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.Migrate/migrateProjects/samlee3proj4/solutions/Servers-Migration-ServerMigration_DataReplication?api-version=2018-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "9" ], + "x-ms-client-request-id": [ "c925df2d-ea2d-4091-b913-6bd94bd9f23e" ], + "CommandName": [ "Az.Migrate\\Get-AzMigrateSolution" ], + "FullCommandName": [ "Get-AzMigrateSolution_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.6", "Az.Migrate/1.0.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "81b97dec-6f36-49dd-aaed-d573a0e42ee1" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-correlation-request-id": [ "f94ff2dd-d80e-4c81-8d6e-6797d008c897" ], + "x-ms-routing-request-id": [ "CANADACENTRAL:20230822T212418Z:f94ff2dd-d80e-4c81-8d6e-6797d008c897" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 20AA6CB2CCF84E8DA997AC2FF98FD8B3 Ref B: CO6AA3150219049 Ref C: 2023-08-22T21:24:16Z" ], + "Date": [ "Tue, 22 Aug 2023 21:24:17 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1119" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.Migrate/MigrateProjects/samlee3proj4/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"name\":\"Servers-Migration-ServerMigration_DataReplication\",\"type\":\"Microsoft.Migrate/MigrateProjects/Solutions\",\"etag\":\"\\\"0b00be81-0000-1800-0000-64e525810000\\\"\",\"properties\":{\"tool\":\"ServerMigration_DataReplication\",\"purpose\":\"Migration\",\"goal\":\"Servers\",\"status\":\"Inactive\",\"cleanupState\":\"None\",\"summary\":{\"instanceType\":\"Servers\",\"discoveredCount\":0,\"assessedCount\":0,\"replicatingCount\":0,\"testMigratedCount\":0,\"migratedCount\":0},\"details\":{\"groupCount\":0,\"assessmentCount\":0,\"extendedDetails\":{\"serversOnWindows\":\"0\",\"serversOnLinux\":\"0\",\"serversOnOther\":\"0\",\"dependencyEnabledMachines\":\"0\",\"machinesHavingSqlServers\":\"0\",\"machinesHavingWebServers\":\"0\",\"vaultId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault\",\"aszreplicatingCount\":\"9\",\"asztestMigratedCount\":\"0\",\"aszmigratedCount\":\"0\"}}}}", + "isContentBase64": false + } + }, + "Get-AzMigrateHCIJob+[NoContext]+ListById+$GET+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs?api-version=2021-02-16-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs?api-version=2021-02-16-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "10" ], + "x-ms-client-request-id": [ "a7f5519d-dfc1-48fb-acda-249fc1b93407" ], + "CommandName": [ "Az.Migrate.Internal\\Get-AzMigrateWorkflow" ], + "FullCommandName": [ "Get-AzMigrateWorkflow_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.6", "Az.Migrate/1.0.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "api-supported-versions": [ "2021-02-16-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-request-id": [ "14406476-8dc7-46b9-8b08-d037eb5571c1" ], + "x-ms-correlation-request-id": [ "14406476-8dc7-46b9-8b08-d037eb5571c1" ], + "x-ms-routing-request-id": [ "CANADACENTRAL:20230822T212420Z:14406476-8dc7-46b9-8b08-d037eb5571c1" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 413C5AB587314BC084603D37C26E6827 Ref B: CO6AA3150219049 Ref C: 2023-08-22T21:24:18Z" ], + "Date": [ "Tue, 22 Aug 2023 21:24:19 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "93935" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"properties\":{\"displayName\":\"Delete protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-22T21:15:43.1838695Z\",\"endTime\":\"2023-08-22T21:16:46Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/0eb54043-3a9c-454e-be52-70aaaacf5e59\",\"name\":\"0eb54043-3a9c-454e-be52-70aaaacf5e59\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Planned failover\",\"state\":\"Failed\",\"startTime\":\"2023-08-22T20:51:19.6026718Z\",\"endTime\":\"2023-08-22T20:58:38Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851/plannedFailover\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/684cc56e-2ee9-40b3-89f9-5efd3d87c1e8\",\"name\":\"684cc56e-2ee9-40b3-89f9-5efd3d87c1e8\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Complete initial replication\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-22T19:58:19.7353059Z\",\"endTime\":\"2023-08-22T19:58:20Z\",\"objectId\":null,\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/eb6335f4-c7cf-4ba4-a5f7-4f32aad8bda6\",\"name\":\"eb6335f4-c7cf-4ba4-a5f7-4f32aad8bda6\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Planned failover\",\"state\":\"Failed\",\"startTime\":\"2023-08-22T19:19:27.0515062Z\",\"endTime\":\"2023-08-22T19:29:13Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b/plannedFailover\",\"objectName\":\"3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectInternalId\":\"5eec484f-c573-54cc-a516-ea584dd9ec33\",\"objectInternalName\":\"testsamlee1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/f3d48482-98ac-49d0-8fa0-e4deb5464109\",\"name\":\"f3d48482-98ac-49d0-8fa0-e4deb5464109\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-22T19:04:12.4472858Z\",\"endTime\":\"2023-08-22T19:04:16Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectName\":\"3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectInternalId\":\"5eec484f-c573-54cc-a516-ea584dd9ec33\",\"objectInternalName\":\"testsamlee1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/2a1cd367-5ed2-4268-8671-2495d952984e\",\"name\":\"2a1cd367-5ed2-4268-8671-2495d952984e\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Complete initial replication\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-22T18:52:20.1870846Z\",\"endTime\":\"2023-08-22T18:52:21Z\",\"objectId\":null,\"objectName\":\"3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectInternalId\":\"5eec484f-c573-54cc-a516-ea584dd9ec33\",\"objectInternalName\":\"testsamlee1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/5e675be8-bb32-4228-9f8d-aaeac2973def\",\"name\":\"5e675be8-bb32-4228-9f8d-aaeac2973def\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-22T18:45:43.4218455Z\",\"endTime\":\"2023-08-22T18:47:52Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectName\":\"3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectInternalId\":\"5eec484f-c573-54cc-a516-ea584dd9ec33\",\"objectInternalName\":\"testsamlee1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/aa446c58-ddd8-4ff5-ab81-a329b27f7273\",\"name\":\"aa446c58-ddd8-4ff5-ab81-a329b27f7273\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-22T18:44:22.6269537Z\",\"endTime\":\"2023-08-22T18:45:24Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/5c6223fd-1f9d-47d8-9314-1ee6cd544295\",\"name\":\"5c6223fd-1f9d-47d8-9314-1ee6cd544295\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Delete protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-22T18:42:46.2652743Z\",\"endTime\":\"2023-08-22T18:42:48Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectName\":\"3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectInternalId\":\"5eec484f-c573-54cc-a516-ea584dd9ec33\",\"objectInternalName\":\"testsamlee1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/5a9aa7a4-0127-4449-a489-d5825435fff0\",\"name\":\"5a9aa7a4-0127-4449-a489-d5825435fff0\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Delete protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-22T18:42:41.6445916Z\",\"endTime\":\"2023-08-22T18:42:44Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/0361de7f-2634-414c-af4e-84909af6cd42\",\"name\":\"0361de7f-2634-414c-af4e-84909af6cd42\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-22T18:37:59.5249858Z\",\"endTime\":\"2023-08-22T18:39:35Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectName\":\"3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectInternalId\":\"5eec484f-c573-54cc-a516-ea584dd9ec33\",\"objectInternalName\":\"testsamlee1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/cb76d23f-533f-4c16-b86b-8b0746ebdc67\",\"name\":\"cb76d23f-533f-4c16-b86b-8b0746ebdc67\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-22T18:29:13.5169836Z\",\"endTime\":\"2023-08-22T18:32:35Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/6d323c4d-ec25-4a4e-a5e8-76dd7100db75\",\"name\":\"6d323c4d-ec25-4a4e-a5e8-76dd7100db75\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Delete protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-22T18:18:53.0000945Z\",\"endTime\":\"2023-08-22T18:18:55Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/b0239c70-71b8-41a3-9e77-ebd46046c9cb\",\"name\":\"b0239c70-71b8-41a3-9e77-ebd46046c9cb\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-22T18:05:20.4268109Z\",\"endTime\":\"2023-08-22T18:08:37Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/958c3431-b409-40e8-b2d0-21ba33da2198\",\"name\":\"958c3431-b409-40e8-b2d0-21ba33da2198\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Delete protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-22T18:04:18.4195958Z\",\"endTime\":\"2023-08-22T18:04:20Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/13680258-0e07-4b18-9886-e7c6db979710\",\"name\":\"13680258-0e07-4b18-9886-e7c6db979710\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-22T18:03:39.0061229Z\",\"endTime\":\"2023-08-22T18:03:41Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectName\":\"c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectInternalId\":\"51354a7f-b5a0-562b-9865-752c03022e30\",\"objectInternalName\":\"testmayada2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/41fd6194-073d-4a0f-9408-0a7595cffd9b\",\"name\":\"41fd6194-073d-4a0f-9408-0a7595cffd9b\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Delete protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-22T18:00:57.7928969Z\",\"endTime\":\"2023-08-22T18:02:28Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/2cb313ba-0219-4c96-9181-a8b55487bef3\",\"name\":\"2cb313ba-0219-4c96-9181-a8b55487bef3\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-22T18:00:34.5615968Z\",\"endTime\":\"2023-08-22T18:02:04Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/13306547-6699-499d-a6eb-8d7edf2074d8\",\"name\":\"13306547-6699-499d-a6eb-8d7edf2074d8\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Delete protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-22T17:59:27.3955116Z\",\"endTime\":\"2023-08-22T18:03:50Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/bf0ddf14-8087-4a02-9b97-ecc86553517e\",\"name\":\"bf0ddf14-8087-4a02-9b97-ecc86553517e\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Delete protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-22T17:59:21.2457809Z\",\"endTime\":\"2023-08-22T17:59:22Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectName\":\"3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectInternalId\":\"5eec484f-c573-54cc-a516-ea584dd9ec33\",\"objectInternalName\":\"testsamlee1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/efd96701-db1b-4a60-9026-8b508e261497\",\"name\":\"efd96701-db1b-4a60-9026-8b508e261497\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-22T17:44:22.3874102Z\",\"endTime\":\"2023-08-22T17:44:26Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectName\":\"c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectInternalId\":\"51354a7f-b5a0-562b-9865-752c03022e30\",\"objectInternalName\":\"testmayada2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/a67416fc-bf99-46b2-9287-bcce1a2f1da4\",\"name\":\"a67416fc-bf99-46b2-9287-bcce1a2f1da4\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-22T17:37:43.7785496Z\",\"endTime\":\"2023-08-22T17:37:48Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectName\":\"c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectInternalId\":\"51354a7f-b5a0-562b-9865-752c03022e30\",\"objectInternalName\":\"testmayada2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/fce3a036-8eb1-48df-9c27-0d4493132387\",\"name\":\"fce3a036-8eb1-48df-9c27-0d4493132387\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-22T17:33:28.21386Z\",\"endTime\":\"2023-08-22T17:33:31Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectName\":\"3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectInternalId\":\"5eec484f-c573-54cc-a516-ea584dd9ec33\",\"objectInternalName\":\"testsamlee1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/bb6d533f-3b38-4320-ad61-a471c615cd56\",\"name\":\"bb6d533f-3b38-4320-ad61-a471c615cd56\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-22T17:10:47.565435Z\",\"endTime\":\"2023-08-22T17:10:49Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectName\":\"3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectInternalId\":\"5eec484f-c573-54cc-a516-ea584dd9ec33\",\"objectInternalName\":\"testsamlee1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/3b12799c-face-4bbe-b31a-b901d5186a00\",\"name\":\"3b12799c-face-4bbe-b31a-b901d5186a00\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-22T16:44:24.1021316Z\",\"endTime\":\"2023-08-22T16:44:27Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectName\":\"c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectInternalId\":\"51354a7f-b5a0-562b-9865-752c03022e30\",\"objectInternalName\":\"testmayada2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/be994c7d-8131-4ca9-8a16-571b873d6ea4\",\"name\":\"be994c7d-8131-4ca9-8a16-571b873d6ea4\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-22T16:39:02.0482295Z\",\"endTime\":\"2023-08-22T16:39:04Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectName\":\"3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectInternalId\":\"5eec484f-c573-54cc-a516-ea584dd9ec33\",\"objectInternalName\":\"testsamlee1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/b73d3bbe-ce64-4513-a127-9faa3cd51d24\",\"name\":\"b73d3bbe-ce64-4513-a127-9faa3cd51d24\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-22T16:35:31.6382074Z\",\"endTime\":\"2023-08-22T16:35:33Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectName\":\"3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectInternalId\":\"5eec484f-c573-54cc-a516-ea584dd9ec33\",\"objectInternalName\":\"testsamlee1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/611dee57-45cd-4317-8e7b-2c93ad553e0b\",\"name\":\"611dee57-45cd-4317-8e7b-2c93ad553e0b\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-22T16:21:49.874412Z\",\"endTime\":\"2023-08-22T16:23:52Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/ce64b30e-c079-43fa-b355-79a7cfc872db\",\"name\":\"ce64b30e-c079-43fa-b355-79a7cfc872db\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Delete protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-22T16:19:32.8364177Z\",\"endTime\":\"2023-08-22T16:19:35Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/3cc3dd1f-af4a-4168-a5dc-48496e033dff\",\"name\":\"3cc3dd1f-af4a-4168-a5dc-48496e033dff\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-22T16:12:21.1185973Z\",\"endTime\":\"2023-08-22T16:14:58Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/c75ad76d-1687-4df2-aa61-307c832da280\",\"name\":\"c75ad76d-1687-4df2-aa61-307c832da280\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Delete protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-22T15:58:52.9962488Z\",\"endTime\":\"2023-08-22T15:58:55Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectName\":\"3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectInternalId\":\"5eec484f-c573-54cc-a516-ea584dd9ec33\",\"objectInternalName\":\"testsamlee1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/4977dfc0-8e13-41e7-9c9b-eb18f04b92f0\",\"name\":\"4977dfc0-8e13-41e7-9c9b-eb18f04b92f0\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Delete protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-22T15:58:40.5090951Z\",\"endTime\":\"2023-08-22T15:58:43Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/a5870212-2303-4336-b7f0-5193aa6d98f9\",\"name\":\"a5870212-2303-4336-b7f0-5193aa6d98f9\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Delete protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-22T15:57:29.4176675Z\",\"endTime\":\"2023-08-22T15:58:13Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectName\":\"3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectInternalId\":\"5eec484f-c573-54cc-a516-ea584dd9ec33\",\"objectInternalName\":\"testsamlee1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/a94b3ee7-b24e-481b-9f69-60c2c40ffd83\",\"name\":\"a94b3ee7-b24e-481b-9f69-60c2c40ffd83\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Delete protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-22T15:56:54.2247093Z\",\"endTime\":\"2023-08-22T15:58:08Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/d51fea4e-dce9-44da-abd0-43e907f479b7\",\"name\":\"d51fea4e-dce9-44da-abd0-43e907f479b7\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Delete protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-22T14:15:21.6494187Z\",\"endTime\":\"2023-08-22T14:16:35Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/e2dfdfd5-31c2-4b1f-b215-fd8270aad2d0\",\"objectName\":\"e2dfdfd5-31c2-4b1f-b215-fd8270aad2d0\",\"objectInternalId\":\"eed85d04-2f19-56c9-bd93-28067e585a35\",\"objectInternalName\":\"testmayada1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/c50dbc41-6705-4445-9230-07a495af7e29\",\"name\":\"c50dbc41-6705-4445-9230-07a495af7e29\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Delete protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-22T14:15:12.5738456Z\",\"endTime\":\"2023-08-22T14:16:35Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectName\":\"3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectInternalId\":\"5eec484f-c573-54cc-a516-ea584dd9ec33\",\"objectInternalName\":\"testsamlee1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/b9456e03-08f9-4581-bc70-2cbacfdbaedd\",\"name\":\"b9456e03-08f9-4581-bc70-2cbacfdbaedd\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Delete protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-22T14:15:04.0073683Z\",\"endTime\":\"2023-08-22T14:16:36Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/c5e72166-b1f9-484a-96fd-71b1e58dd97e\",\"name\":\"c5e72166-b1f9-484a-96fd-71b1e58dd97e\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-22T01:28:47.4270654Z\",\"endTime\":\"2023-08-22T01:28:50Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectName\":\"c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectInternalId\":\"51354a7f-b5a0-562b-9865-752c03022e30\",\"objectInternalName\":\"testmayada2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/9f84302d-e489-4831-b765-7a05ea45aa00\",\"name\":\"9f84302d-e489-4831-b765-7a05ea45aa00\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-22T00:48:04.8761435Z\",\"endTime\":\"2023-08-22T00:48:06Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectName\":\"c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectInternalId\":\"51354a7f-b5a0-562b-9865-752c03022e30\",\"objectInternalName\":\"testmayada2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/533427f0-c7c3-43f3-b9cc-3ef5de66c765\",\"name\":\"533427f0-c7c3-43f3-b9cc-3ef5de66c765\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-21T17:35:18.501399Z\",\"endTime\":\"2023-08-21T17:35:20Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectName\":\"c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectInternalId\":\"51354a7f-b5a0-562b-9865-752c03022e30\",\"objectInternalName\":\"testmayada2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/473e721f-09b2-44d6-b415-e80db8552667\",\"name\":\"473e721f-09b2-44d6-b415-e80db8552667\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-21T17:12:51.7214082Z\",\"endTime\":\"2023-08-21T17:12:53Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectName\":\"c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectInternalId\":\"51354a7f-b5a0-562b-9865-752c03022e30\",\"objectInternalName\":\"testmayada2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/4575caf2-4a11-4423-8a36-0e3d784fbcd8\",\"name\":\"4575caf2-4a11-4423-8a36-0e3d784fbcd8\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-21T17:09:23.4347107Z\",\"endTime\":\"2023-08-21T17:12:36Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectName\":\"c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectInternalId\":\"51354a7f-b5a0-562b-9865-752c03022e30\",\"objectInternalName\":\"testmayada2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/76406cc7-119e-4c08-8fb7-bf82c36530e0\",\"name\":\"76406cc7-119e-4c08-8fb7-bf82c36530e0\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Complete initial replication\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-21T16:54:16.5929474Z\",\"endTime\":\"2023-08-21T16:54:17Z\",\"objectId\":null,\"objectName\":\"e2dfdfd5-31c2-4b1f-b215-fd8270aad2d0\",\"objectInternalId\":\"eed85d04-2f19-56c9-bd93-28067e585a35\",\"objectInternalName\":\"testmayada1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/8b86ba51-e680-4e7b-b0be-83c44a932564\",\"name\":\"8b86ba51-e680-4e7b-b0be-83c44a932564\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-21T16:53:13.9418056Z\",\"endTime\":\"2023-08-21T16:53:16Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/c44473d0-a8ce-41bc-8638-14a0bd956ddd\",\"objectName\":\"c44473d0-a8ce-41bc-8638-14a0bd956ddd\",\"objectInternalId\":\"90288fee-74a0-5073-89ca-838b62dc68bc\",\"objectInternalName\":\"testmayada6\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/8a8fa4d3-1e6c-4271-84eb-ecf46a3c2be0\",\"name\":\"8a8fa4d3-1e6c-4271-84eb-ecf46a3c2be0\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Delete protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-21T16:52:21.8212532Z\",\"endTime\":\"2023-08-21T16:53:44Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectName\":\"3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectInternalId\":\"5eec484f-c573-54cc-a516-ea584dd9ec33\",\"objectInternalName\":\"testsamlee1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/e1c1d281-5688-44e5-9a1a-e2d66b6d02b9\",\"name\":\"e1c1d281-5688-44e5-9a1a-e2d66b6d02b9\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-21T16:49:48.0989788Z\",\"endTime\":\"2023-08-21T16:49:49Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/c44473d0-a8ce-41bc-8638-14a0bd956ddd\",\"objectName\":\"c44473d0-a8ce-41bc-8638-14a0bd956ddd\",\"objectInternalId\":\"90288fee-74a0-5073-89ca-838b62dc68bc\",\"objectInternalName\":\"testmayada6\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/41b28e3a-3b31-4950-8eb4-91c1249c6ae3\",\"name\":\"41b28e3a-3b31-4950-8eb4-91c1249c6ae3\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-21T16:40:30.6659618Z\",\"endTime\":\"2023-08-21T16:43:30Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/e2dfdfd5-31c2-4b1f-b215-fd8270aad2d0\",\"objectName\":\"e2dfdfd5-31c2-4b1f-b215-fd8270aad2d0\",\"objectInternalId\":\"eed85d04-2f19-56c9-bd93-28067e585a35\",\"objectInternalName\":\"testmayada1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/b370c87a-6762-4ae5-bb93-3157ca827e14\",\"name\":\"b370c87a-6762-4ae5-bb93-3157ca827e14\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-21T15:22:04.4645019Z\",\"endTime\":\"2023-08-21T15:22:07Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/3244075c-81b0-49bc-8631-74d682f08285\",\"name\":\"3244075c-81b0-49bc-8631-74d682f08285\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-21T08:12:08.0513149Z\",\"endTime\":\"2023-08-21T08:12:09Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/c44473d0-a8ce-41bc-8638-14a0bd956ddd\",\"objectName\":\"c44473d0-a8ce-41bc-8638-14a0bd956ddd\",\"objectInternalId\":\"90288fee-74a0-5073-89ca-838b62dc68bc\",\"objectInternalName\":\"testmayada6\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/623f72f9-1afd-43f2-8e45-f0ac8ada0ea7\",\"name\":\"623f72f9-1afd-43f2-8e45-f0ac8ada0ea7\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-19T17:45:02.4664216Z\",\"endTime\":\"2023-08-19T17:45:05Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/c44473d0-a8ce-41bc-8638-14a0bd956ddd\",\"objectName\":\"c44473d0-a8ce-41bc-8638-14a0bd956ddd\",\"objectInternalId\":\"90288fee-74a0-5073-89ca-838b62dc68bc\",\"objectInternalName\":\"testmayada6\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/a29474b0-7944-47ec-8112-3f4992b39e66\",\"name\":\"a29474b0-7944-47ec-8112-3f4992b39e66\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Planned failover\",\"state\":\"Failed\",\"startTime\":\"2023-08-19T17:20:53.0756674Z\",\"endTime\":\"2023-08-19T17:30:28Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b/plannedFailover\",\"objectName\":\"3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectInternalId\":\"5eec484f-c573-54cc-a516-ea584dd9ec33\",\"objectInternalName\":\"testsamlee1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/78ddc07c-a70e-4dde-8f89-759e3e0e71de\",\"name\":\"78ddc07c-a70e-4dde-8f89-759e3e0e71de\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Complete initial replication\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-19T10:21:31.1598809Z\",\"endTime\":\"2023-08-19T10:21:32Z\",\"objectId\":null,\"objectName\":\"3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectInternalId\":\"5eec484f-c573-54cc-a516-ea584dd9ec33\",\"objectInternalName\":\"testsamlee1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/ff64dfec-cc49-4072-bf1b-601dc5238791\",\"name\":\"ff64dfec-cc49-4072-bf1b-601dc5238791\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-19T09:48:35.0514006Z\",\"endTime\":\"2023-08-19T09:50:41Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectName\":\"3eb1ac59-5b3c-4f7d-87be-df4d3c9bb20b\",\"objectInternalId\":\"5eec484f-c573-54cc-a516-ea584dd9ec33\",\"objectInternalName\":\"testsamlee1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/0503cbeb-58c4-4fa5-b1ff-090b3521a954\",\"name\":\"0503cbeb-58c4-4fa5-b1ff-090b3521a954\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Complete initial replication\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-19T05:04:29.7674604Z\",\"endTime\":\"2023-08-19T05:04:31Z\",\"objectId\":null,\"objectName\":\"c44473d0-a8ce-41bc-8638-14a0bd956ddd\",\"objectInternalId\":\"90288fee-74a0-5073-89ca-838b62dc68bc\",\"objectInternalName\":\"testmayada6\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/81578cce-919f-445d-b8c1-07869bae8b38\",\"name\":\"81578cce-919f-445d-b8c1-07869bae8b38\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-19T04:18:40.0736603Z\",\"endTime\":\"2023-08-19T04:20:54Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/c44473d0-a8ce-41bc-8638-14a0bd956ddd\",\"objectName\":\"c44473d0-a8ce-41bc-8638-14a0bd956ddd\",\"objectInternalId\":\"90288fee-74a0-5073-89ca-838b62dc68bc\",\"objectInternalName\":\"testmayada6\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/29620f72-f849-473a-83f6-9453ba097eb9\",\"name\":\"29620f72-f849-473a-83f6-9453ba097eb9\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-18T22:23:09.3684133Z\",\"endTime\":\"2023-08-18T22:23:11Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/122d7dbf-2e2b-4912-88bd-6d52775cc9cd\",\"name\":\"122d7dbf-2e2b-4912-88bd-6d52775cc9cd\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Complete initial replication\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-18T22:05:27.1644308Z\",\"endTime\":\"2023-08-18T22:05:28Z\",\"objectId\":null,\"objectName\":\"cd0b80c6-074f-474d-86e4-733ded0e0819\",\"objectInternalId\":\"68153b29-d298-54f7-a324-58209db3f78a\",\"objectInternalName\":\"testmayada5\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/397a5379-7628-4325-a65d-30107d469d28\",\"name\":\"397a5379-7628-4325-a65d-30107d469d28\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-18T21:46:45.828483Z\",\"endTime\":\"2023-08-18T21:52:22Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/cd0b80c6-074f-474d-86e4-733ded0e0819\",\"objectName\":\"cd0b80c6-074f-474d-86e4-733ded0e0819\",\"objectInternalId\":\"68153b29-d298-54f7-a324-58209db3f78a\",\"objectInternalName\":\"testmayada5\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/94d83dfd-c609-432c-a095-0d46d1b9bfbb\",\"name\":\"94d83dfd-c609-432c-a095-0d46d1b9bfbb\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-18T19:44:24.7669997Z\",\"endTime\":\"2023-08-18T19:44:25Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/840ec58b-8980-4030-9b0e-1a6a3d3957ac\",\"name\":\"840ec58b-8980-4030-9b0e-1a6a3d3957ac\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-18T19:30:07.6737569Z\",\"endTime\":\"2023-08-18T19:30:12Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/611139c5-82ab-4618-8c65-06bc97cf106a\",\"name\":\"611139c5-82ab-4618-8c65-06bc97cf106a\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-18T19:24:58.6325983Z\",\"endTime\":\"2023-08-18T19:25:03Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/cd0b80c6-074f-474d-86e4-733ded0e0819\",\"objectName\":\"cd0b80c6-074f-474d-86e4-733ded0e0819\",\"objectInternalId\":\"68153b29-d298-54f7-a324-58209db3f78a\",\"objectInternalName\":\"testmayada5\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/717881c3-1c0c-4b6d-95f4-6ca15fe370c8\",\"name\":\"717881c3-1c0c-4b6d-95f4-6ca15fe370c8\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-18T12:37:34.3424172Z\",\"endTime\":\"2023-08-18T12:37:35Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/2d756633-eab0-400c-8e66-a3e141fda6a3\",\"name\":\"2d756633-eab0-400c-8e66-a3e141fda6a3\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-18T07:16:10.3653368Z\",\"endTime\":\"2023-08-18T07:16:11Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/cd0b80c6-074f-474d-86e4-733ded0e0819\",\"objectName\":\"cd0b80c6-074f-474d-86e4-733ded0e0819\",\"objectInternalId\":\"68153b29-d298-54f7-a324-58209db3f78a\",\"objectInternalName\":\"testmayada5\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/171c6729-57bc-4fd0-af67-f72d1c00ec5c\",\"name\":\"171c6729-57bc-4fd0-af67-f72d1c00ec5c\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-17T21:25:44.1345093Z\",\"endTime\":\"2023-08-17T21:25:45Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/1339dbfa-6823-4d3d-b9a8-a9b661a9ffa1\",\"name\":\"1339dbfa-6823-4d3d-b9a8-a9b661a9ffa1\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-17T19:37:07.1330143Z\",\"endTime\":\"2023-08-17T19:37:09Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/24c712b4-dc3f-480a-8abf-93ca01f7dbee\",\"name\":\"24c712b4-dc3f-480a-8abf-93ca01f7dbee\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-17T18:44:41.3202933Z\",\"endTime\":\"2023-08-17T18:44:44Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/a2631c58-a580-4adc-a979-59f25993b1a0\",\"name\":\"a2631c58-a580-4adc-a979-59f25993b1a0\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-17T18:33:47.9738601Z\",\"endTime\":\"2023-08-17T18:33:50Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/62302eba-6e29-4127-a468-14a95035f98f\",\"name\":\"62302eba-6e29-4127-a468-14a95035f98f\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-17T18:31:17.6174922Z\",\"endTime\":\"2023-08-17T18:31:19Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/f1249350-184d-4886-aea7-5a7c43522611\",\"name\":\"f1249350-184d-4886-aea7-5a7c43522611\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Complete initial replication\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-17T14:49:17.005277Z\",\"endTime\":\"2023-08-17T14:49:47.005277Z\",\"objectId\":null,\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/8ac48f51-1753-4c60-9c87-43fc3a35bcdf\",\"name\":\"8ac48f51-1753-4c60-9c87-43fc3a35bcdf\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-17T14:12:47.6687128Z\",\"endTime\":\"2023-08-17T14:18:03Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/dca5d244-5348-40e7-91dd-2942ef1aafd5\",\"name\":\"dca5d244-5348-40e7-91dd-2942ef1aafd5\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Delete protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-17T13:58:22.676376Z\",\"endTime\":\"2023-08-17T13:58:24Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/6b802b72-36bc-4b4f-9572-d477c6e3916e\",\"name\":\"6b802b72-36bc-4b4f-9572-d477c6e3916e\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Delete protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-17T13:57:54.5550871Z\",\"endTime\":\"2023-08-17T13:57:56Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectName\":\"c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectInternalId\":\"51354a7f-b5a0-562b-9865-752c03022e30\",\"objectInternalName\":\"testmayada2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/f37c15df-b879-45d0-8857-02e2bb3a0435\",\"name\":\"f37c15df-b879-45d0-8857-02e2bb3a0435\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Delete protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-17T13:54:22.5349141Z\",\"endTime\":\"2023-08-17T13:56:26Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectName\":\"c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectInternalId\":\"51354a7f-b5a0-562b-9865-752c03022e30\",\"objectInternalName\":\"testmayada2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/c8bb81d5-9e9a-425d-bc33-f82bf459622b\",\"name\":\"c8bb81d5-9e9a-425d-bc33-f82bf459622b\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Complete initial replication\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-16T22:01:14.722684Z\",\"endTime\":\"2023-08-16T22:01:16Z\",\"objectId\":null,\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/daea637c-468a-4563-a0a2-370267bccd24\",\"name\":\"daea637c-468a-4563-a0a2-370267bccd24\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-16T20:55:25.720599Z\",\"endTime\":\"2023-08-16T21:02:06Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectName\":\"0ec082d5-6827-457a-bae2-f986e1b94851\",\"objectInternalId\":\"c5d2ecdf-138e-5eca-a4b3-4d485aa483a2\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/45623004-07cf-491a-86da-fbf6e22234a7\",\"name\":\"45623004-07cf-491a-86da-fbf6e22234a7\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Delete protected item\",\"state\":\"Failed\",\"startTime\":\"2023-08-16T19:38:04.3587937Z\",\"endTime\":\"2023-08-16T19:45:18Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectName\":\"c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectInternalId\":\"51354a7f-b5a0-562b-9865-752c03022e30\",\"objectInternalName\":\"testmayada2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Restart\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/8aa76292-04a6-4b09-a4e7-9201391f7223\",\"name\":\"8aa76292-04a6-4b09-a4e7-9201391f7223\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null},{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Succeeded\",\"startTime\":\"2023-08-16T18:31:37.0721002Z\",\"endTime\":\"2023-08-16T18:38:03Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectName\":\"c1a34301-3bff-4ec6-97f1-6c4bd5adcde0\",\"objectInternalId\":\"51354a7f-b5a0-562b-9865-752c03022e30\",\"objectInternalName\":\"testmayada2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":null,\"errors\":null,\"customProperties\":null},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/c6f5ac4d-60af-459b-8ca1-bc9bd9814d3b\",\"name\":\"c6f5ac4d-60af-459b-8ca1-bc9bd9814d3b\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null}],\"nextLink\":null}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/test/Get-AzMigrateHCIJob.Tests.ps1 b/src/Migrate/Migrate.Autorest/test/Get-AzMigrateHCIJob.Tests.ps1 new file mode 100644 index 000000000000..b32a12ee1cad --- /dev/null +++ b/src/Migrate/Migrate.Autorest/test/Get-AzMigrateHCIJob.Tests.ps1 @@ -0,0 +1,62 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzMigrateHCIJob')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzMigrateHCIJob.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-AzMigrateHCIJob' { + It 'ListByName' { + $output = Get-AzMigrateHCIJob ` + -ProjectName $env.hciProjectName ` + -ResourceGroupName $env.hciMigResourceGroup ` + -SubscriptionId $env.hciSubscriptionId + $output.Count | Should -BeGreaterOrEqual 1 + } + + It 'GetByName' { + $output = Get-AzMigrateHCIJob ` + -ProjectName $env.hciProjectName ` + -ResourceGroupName $env.hciMigResourceGroup ` + -SubscriptionId $env.hciSubscriptionId ` + -Name $env.hciJobName + $output.Count | Should -BeGreaterOrEqual 1 + } + + It 'GetById' { + $output = Get-AzMigrateHCIJob ` + -SubscriptionId $env.hciSubscriptionId ` + -ID $env.hciJobId + $output.Count | Should -BeGreaterOrEqual 1 + } + + It 'GetByInputObject' { + $output = Get-AzMigrateHCIJob ` + -ProjectName $env.hciProjectName ` + -ResourceGroupName $env.hciMigResourceGroup ` + -SubscriptionId $env.hciSubscriptionId ` + -Name $env.hciJobName + + $output1 = Get-AzMigrateHCIJob ` + -InputObject $output ` + -SubscriptionId $env.hciSubscriptionId + $output1.Count | Should -BeGreaterOrEqual 1 + } + + It 'ListById' { + $output = Get-AzMigrateHCIJob ` + -ProjectID $env.hciProjectId ` + -ResourceGroupID $env.hciMigResourceGroupId ` + -SubscriptionId $env.hciSubscriptionId + $output.Count | Should -BeGreaterOrEqual 1 + } +} diff --git a/src/Migrate/Migrate.Autorest/test/Get-AzMigrateHCIReplicationFabric.Recording.json b/src/Migrate/Migrate.Autorest/test/Get-AzMigrateHCIReplicationFabric.Recording.json new file mode 100644 index 000000000000..019f359b0d66 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/test/Get-AzMigrateHCIReplicationFabric.Recording.json @@ -0,0 +1,217 @@ +{ + "Get-AzMigrateHCIReplicationFabric+[NoContext]+List+$GET+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/providers/Microsoft.DataReplication/replicationFabrics?api-version=2021-02-16-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/providers/Microsoft.DataReplication/replicationFabrics?api-version=2021-02-16-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "1" ], + "x-ms-client-request-id": [ "bfa6b9e5-9963-4d88-9fb6-f5c76504f334" ], + "CommandName": [ "Get-AzMigrateHCIReplicationFabric" ], + "FullCommandName": [ "Get-AzMigrateHCIReplicationFabric_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.6", "Az.Migrate/1.0.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-original-request-ids": [ "", "", "", "" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-request-id": [ "d6bd9b10-b7e8-4be3-970e-850d4305bdb1" ], + "x-ms-correlation-request-id": [ "d6bd9b10-b7e8-4be3-970e-850d4305bdb1" ], + "x-ms-routing-request-id": [ "CENTRALUS:20230822T210723Z:d6bd9b10-b7e8-4be3-970e-850d4305bdb1" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: D15BF7D6AB554E4C85271AE65BBDB171 Ref B: CO6AA3150220023 Ref C: 2023-08-22T21:07:17Z" ], + "Date": [ "Tue, 22 Aug 2023 21:07:23 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "434857" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"location\":\"westeurope\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.we.siterecovery.azure.com\",\"serviceResourceId\":\"78720e1f-b4e3-40cc-925a-0c21c739a625\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/chengrwu-mig-32/providers/Microsoft.OffAzure/HyperVSites/cr-weu-src6523site\",\"fabricResourceId\":\"4669305802747678239\",\"fabricContainerId\":\"1976249350156\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/chengrwu-mig-32/providers/Microsoft.Migrate/MigrateProjects/chengrwu-mig-32-proj/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/chengrwu-mig-32/providers/Microsoft.DataReplication/replicationFabrics/cr-weu-src52dareplicationfabric\",\"name\":\"cr-weu-src52dareplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"chengrwu@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-03-02T20:04:46.5118917+00:00\",\"lastModifiedBy\":\"chengrwu@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-03-02T20:04:46.5118917+00:00\"},\"tags\":{}},{\"location\":\"westeurope\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.we.siterecovery.azure.com\",\"serviceResourceId\":\"c09acc1c-0c4b-4004-8732-04e6f9649341\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHCISiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/chengrwu-mig-32/providers/Microsoft.OffAzure/HyperVSites/cr-weu-tgt7160site\",\"applianceName\":[\"cr-weu-tgt\"],\"cluster\":{\"clusterName\":\"rn03-u0911.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/680d0dad-59aa-4464-adf3-b34b2b427e8c/resourceGroups/vjvmmigtest01RG/providers/Microsoft.AzureStackHCI/clusters/hciclu09011\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4612825437827681308\",\"fabricContainerId\":\"2096369568076\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/chengrwu-mig-32/providers/Microsoft.Migrate/MigrateProjects/chengrwu-mig-32-proj/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/chengrwu-mig-32/providers/Microsoft.DataReplication/replicationFabrics/cr-weu-tgtf75areplicationfabric\",\"name\":\"cr-weu-tgtf75areplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"chengrwu@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-03-03T00:18:28.8453858+00:00\",\"lastModifiedBy\":\"chengrwu@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-03-03T00:18:28.8453858+00:00\"},\"tags\":{}},{\"location\":\"westeurope\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.we.siterecovery.azure.com\",\"serviceResourceId\":\"8f110736-f5bb-41c6-9285-7ecff311fc55\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadaprdwe2-rg/providers/Microsoft.OffAzure/HyperVSites/weap20754site\",\"fabricResourceId\":\"4739745843761973046\",\"fabricContainerId\":\"6279858825531\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadaprdwe2-rg/providers/Microsoft.Migrate/MigrateProjects/mayadaprdwe2/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadaprdwe2-rg/providers/Microsoft.DataReplication/replicationFabrics/weap26a57replicationfabric\",\"name\":\"weap26a57replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"mayada@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-03-07T19:37:32.9307319+00:00\",\"lastModifiedBy\":\"mayada@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-03-07T19:37:32.9307319+00:00\"},\"tags\":{}},{\"location\":\"westeurope\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.we.siterecovery.azure.com\",\"serviceResourceId\":\"666229b6-6771-4112-9376-144ed4592ea9\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHCISiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadaprdwe2-rg/providers/Microsoft.OffAzure/HyperVSites/tgtwe28166site\",\"applianceName\":[\"tgtwe2\"],\"cluster\":{\"clusterName\":\"mayadahciclus3.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/clusters/mayadahciclus3\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4688923898792782262\",\"fabricContainerId\":\"6263829803744\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadaprdwe2-rg/providers/Microsoft.Migrate/MigrateProjects/mayadaprdwe2/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadaprdwe2-rg/providers/Microsoft.DataReplication/replicationFabrics/tgtwe2977ereplicationfabric\",\"name\":\"tgtwe2977ereplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"mayada@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-03-07T20:04:18.3547805+00:00\",\"lastModifiedBy\":\"mayada@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-03-07T20:04:18.3547805+00:00\"},\"tags\":{}},{\"location\":\"westeurope\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.we.siterecovery.azure.com\",\"serviceResourceId\":\"6250cc97-956b-416b-b916-35f8e5d3c484\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gdweu/providers/Microsoft.OffAzure/HyperVSites/gdweusrc5369site\",\"fabricResourceId\":\"4714025723416857751\",\"fabricContainerId\":\"6794830844730\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gdweu/providers/Microsoft.Migrate/MigrateProjects/gdweu/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gdweu/providers/Microsoft.DataReplication/replicationFabrics/gdweusrc3b6areplicationfabric\",\"name\":\"gdweusrc3b6areplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"gadeshpa@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-03-08T10:49:19.0342138+00:00\",\"lastModifiedBy\":\"gadeshpa@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-03-08T10:49:19.0342138+00:00\"},\"tags\":{}},{\"location\":\"westeurope\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.we.siterecovery.azure.com\",\"serviceResourceId\":\"5bb75b2c-9cd1-4231-9686-df8875901e9d\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHCISiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gdweu/providers/Microsoft.OffAzure/HyperVSites/gdtgtweu8626site\",\"applianceName\":[\"gdtgtweu\"],\"cluster\":{\"clusterName\":\"rnu-0103.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjvmmigtestrgu01u03/providers/Microsoft.AzureStackHCI/clusters/RNU-0103\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4769765903362906924\",\"fabricContainerId\":\"6807202961305\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gdweu/providers/Microsoft.Migrate/MigrateProjects/gdweu/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gdweu/providers/Microsoft.DataReplication/replicationFabrics/gdtgtweu00f6replicationfabric\",\"name\":\"gdtgtweu00f6replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"gadeshpa@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-03-08T11:07:05.9155085+00:00\",\"lastModifiedBy\":\"gadeshpa@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-03-08T11:07:05.9155085+00:00\"},\"tags\":{}},{\"location\":\"westeurope\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.we.siterecovery.azure.com\",\"serviceResourceId\":\"61c19674-ded2-4900-9a71-2033a487c640\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-rg-0308/providers/Microsoft.OffAzure/HyperVSites/srini-src-03082877site\",\"fabricResourceId\":\"5260449359933314676\",\"fabricContainerId\":\"7105484427722\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-rg-0308/providers/Microsoft.Migrate/MigrateProjects/srini-mig-0308/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-rg-0308/providers/Microsoft.DataReplication/replicationFabrics/srini-src-0308799areplicationfabric\",\"name\":\"srini-src-0308799areplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"srganesa@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-03-08T19:24:14.7013838+00:00\",\"lastModifiedBy\":\"srganesa@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-03-08T19:24:14.7013838+00:00\"},\"tags\":{}},{\"location\":\"westeurope\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.we.siterecovery.azure.com\",\"serviceResourceId\":\"d678de25-a229-460d-9a2f-46254e01deb1\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHCISiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-rg-0308/providers/Microsoft.OffAzure/HyperVSites/srini-tgt-03082880site\",\"applianceName\":[\"srini-tgt-0308\"],\"cluster\":{\"clusterName\":\"rnu-0103.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjvmmigtestrgu01u03/providers/Microsoft.AzureStackHCI/clusters/RNU-0103\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5047869057927798309\",\"fabricContainerId\":\"7167805193539\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-rg-0308/providers/Microsoft.Migrate/MigrateProjects/srini-mig-0308/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-rg-0308/providers/Microsoft.DataReplication/replicationFabrics/srini-tgt-0308b297replicationfabric\",\"name\":\"srini-tgt-0308b297replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"srganesa@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-03-08T21:10:56.0613468+00:00\",\"lastModifiedBy\":\"srganesa@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-03-08T21:10:56.0613468+00:00\"},\"tags\":{}},{\"location\":\"westeurope\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.we.siterecovery.azure.com\",\"serviceResourceId\":\"3119ff95-5ac4-443b-acd1-d5dbba745f71\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.OffAzure/HyperVSites/sourcevm19264site\",\"fabricResourceId\":\"4916623216888905621\",\"fabricContainerId\":\"8945472542672\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.Migrate/MigrateProjects/jnarProject03-10/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.DataReplication/replicationFabrics/sourcevm19454replicationfabric\",\"name\":\"sourcevm19454replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-03-10T22:33:44.105201+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-03-10T22:33:44.105201+00:00\"},\"tags\":{}},{\"location\":\"westeurope\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.we.siterecovery.azure.com\",\"serviceResourceId\":\"bb5bf80c-8da4-4ada-82a1-68eb9a07e39c\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHCISiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.OffAzure/HyperVSites/tar7594site\",\"applianceName\":[\"tar\"],\"cluster\":{\"clusterName\":\"clrn03u05.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgCLRN03U0507/providers/Microsoft.AzureStackHCI/clusters/CLRN03U05hci\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5393779242387109900\",\"fabricContainerId\":\"9001792839465\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.Migrate/MigrateProjects/jnarProject03-10/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.DataReplication/replicationFabrics/tarc016replicationfabric\",\"name\":\"tarc016replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-03-11T00:04:46.0797827+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-03-11T00:04:46.0797827+00:00\"},\"tags\":{}},{\"location\":\"westeurope\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.we.siterecovery.azure.com\",\"serviceResourceId\":\"abe4e630-2316-4196-a486-06c69968de11\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.OffAzure/HyperVSites/testSrcApp7038site\",\"fabricResourceId\":\"4726003439252071984\",\"fabricContainerId\":\"19075161025628\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.Migrate/MigrateProjects/jnarProject03-10/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.DataReplication/replicationFabrics/testSrcApp71ddreplicationfabric\",\"name\":\"testSrcApp71ddreplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-04-07T14:57:42.615703+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-04-07T14:57:42.615703+00:00\"},\"tags\":{}},{\"location\":\"westeurope\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.we.siterecovery.azure.com\",\"serviceResourceId\":\"bdad3d1f-0a60-4fde-a510-3464f651b272\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.OffAzure/HyperVSites/testSrcApp16339site\",\"fabricResourceId\":\"5755048784441457951\",\"fabricContainerId\":\"19096692202965\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.Migrate/MigrateProjects/jnarProject03-10/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.DataReplication/replicationFabrics/testSrcApp14b0areplicationfabric\",\"name\":\"testSrcApp14b0areplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-04-07T15:33:18.8845801+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-04-07T15:33:18.8845801+00:00\"},\"tags\":{}},{\"location\":\"centralus\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.cus.siterecovery.azure.com\",\"serviceResourceId\":\"c37805df-712e-4190-8392-9b1caa0908a8\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/chengrwu-prod-cus/providers/Microsoft.OffAzure/HyperVSites/srccus13851site\",\"fabricResourceId\":\"4724400454773507551\",\"fabricContainerId\":\"3557201972080\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/chengrwu-prod-cus/providers/Microsoft.Migrate/MigrateProjects/chengrwu-prod-cus/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/chengrwu-prod-cus/providers/Microsoft.DataReplication/replicationFabrics/srccus17508replicationfabric\",\"name\":\"srccus17508replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"chengrwu@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-03-07T19:23:39.2438271+00:00\",\"lastModifiedBy\":\"chengrwu@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-03-07T19:23:39.2438271+00:00\"},\"tags\":{}},{\"location\":\"centralus\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.cus.siterecovery.azure.com\",\"serviceResourceId\":\"6f0127e6-7d7b-4ae4-ad8c-cc084d772375\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gdcusrg/providers/Microsoft.OffAzure/HyperVSites/gdcussrc2454site\",\"fabricResourceId\":\"5396576222593492966\",\"fabricContainerId\":\"5616628928329\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gdcusrg/providers/Microsoft.Migrate/MigrateProjects/gdcus/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gdcusrg/providers/Microsoft.DataReplication/replicationFabrics/gdcussrc32b1replicationfabric\",\"name\":\"gdcussrc32b1replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"gadeshpa@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-03-10T04:35:51.3450799+00:00\",\"lastModifiedBy\":\"gadeshpa@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-03-10T04:35:51.3450799+00:00\"},\"tags\":{}},{\"location\":\"centralus\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.cus.siterecovery.azure.com\",\"serviceResourceId\":\"eef31bea-4525-4e3c-a352-a94922a006f3\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHCISiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gdcusrg/providers/Microsoft.OffAzure/HyperVSites/gdcustgt1817site\",\"applianceName\":[\"gdcustgt\"],\"cluster\":{\"clusterName\":\"rnu-0103.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjvmmigtestrgu01u03/providers/Microsoft.AzureStackHCI/clusters/RNU-0103\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5637456862786034666\",\"fabricContainerId\":\"5629744558296\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gdcusrg/providers/Microsoft.Migrate/MigrateProjects/gdcus/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gdcusrg/providers/Microsoft.DataReplication/replicationFabrics/gdcustgtbcbcreplicationfabric\",\"name\":\"gdcustgtbcbcreplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"gadeshpa@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-03-10T04:57:54.5025964+00:00\",\"lastModifiedBy\":\"gadeshpa@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-03-10T04:57:54.5025964+00:00\"},\"tags\":{}},{\"location\":\"centralus\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.cus.siterecovery.azure.com\",\"serviceResourceId\":\"9a89599f-6a00-465d-8806-38e0d97b030a\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/KerimhaPrivPrev1/providers/Microsoft.OffAzure/HyperVSites/kerimhapp1src5093site\",\"fabricResourceId\":\"5070325306314283423\",\"fabricContainerId\":\"6269408850272\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/KerimhaPrivPrev1/providers/Microsoft.Migrate/MigrateProjects/KerimhaPrivPrev1/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/KerimhaPrivPrev1/providers/Microsoft.DataReplication/replicationFabrics/kerimhapp1srcf36dreplicationfabric\",\"name\":\"kerimhapp1srcf36dreplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"kerimha@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-03-10T22:43:48.8303231+00:00\",\"lastModifiedBy\":\"kerimha@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-03-10T22:43:48.8303231+00:00\"},\"tags\":{}},{\"location\":\"centralus\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.cus.siterecovery.azure.com\",\"serviceResourceId\":\"ea4bd580-0b3c-4247-a583-1abea6a39588\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHCISiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/KerimhaPrivPrev1/providers/Microsoft.OffAzure/HyperVSites/kerimhapp1tgt5730site\",\"applianceName\":[\"kerimhapp1tgt\"],\"cluster\":{\"clusterName\":\"clrn03u05.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgCLRN03U0507/providers/Microsoft.AzureStackHCI/clusters/CLRN03U05hci\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4775798286106482048\",\"fabricContainerId\":\"6323351525271\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/KerimhaPrivPrev1/providers/Microsoft.Migrate/MigrateProjects/KerimhaPrivPrev1/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/KerimhaPrivPrev1/providers/Microsoft.DataReplication/replicationFabrics/kerimhapp1tgtbfe1replicationfabric\",\"name\":\"kerimhapp1tgtbfe1replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"kerimha@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-03-11T00:13:43.2167422+00:00\",\"lastModifiedBy\":\"kerimha@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-03-11T00:13:43.2167422+00:00\"},\"tags\":{}},{\"location\":\"centralus\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.cus.siterecovery.azure.com\",\"serviceResourceId\":\"bbffa9e3-5946-4087-bb63-49f6ae07232d\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHCISiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/KerimhaPrivPrev1/providers/Microsoft.OffAzure/HyperVSites/kerimhapptgt5215site\",\"applianceName\":[\"kerimhapptgt\"],\"cluster\":{\"clusterName\":\"rnu-0103.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjvmmigtestrgu01u03/providers/Microsoft.AzureStackHCI/clusters/RNU-0103\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4649783300620003811\",\"fabricContainerId\":\"6344017255570\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/KerimhaPrivPrev1/providers/Microsoft.Migrate/MigrateProjects/KerimhaPrivPrev1/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/KerimhaPrivPrev1/providers/Microsoft.DataReplication/replicationFabrics/kerimhapptgte14freplicationfabric\",\"name\":\"kerimhapptgte14freplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"kerimha@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-03-11T00:48:09.9711702+00:00\",\"lastModifiedBy\":\"kerimha@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-03-11T00:48:09.9711702+00:00\"},\"tags\":{}},{\"location\":\"centralus\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.cus.siterecovery.azure.com\",\"serviceResourceId\":\"ec343941-c5c0-4fa7-a0fd-e12aad5d9482\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/kerimHCItoHCI/providers/Microsoft.OffAzure/HyperVSites/kerimHCItoHCIs8417site\",\"fabricResourceId\":\"5739773682494224705\",\"fabricContainerId\":\"7745511319594\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/kerimHCItoHCI/providers/Microsoft.Migrate/MigrateProjects/kerimHCItoHCI/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/kerimHCItoHCI/providers/Microsoft.DataReplication/replicationFabrics/kerimHCItoHCIsfca9replicationfabric\",\"name\":\"kerimHCItoHCIsfca9replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"kerimha@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-04-26T21:15:36.4831274+00:00\",\"lastModifiedBy\":\"kerimha@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-04-26T21:15:36.4831274+00:00\"},\"tags\":{}},{\"location\":\"centralus\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.cus.siterecovery.azure.com\",\"serviceResourceId\":\"a2ae6968-2819-4552-8eeb-6dba2103c3af\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHCISiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/kerimHCItoHCI/providers/Microsoft.OffAzure/HyperVSites/kerimHCItoHCIT8386site\",\"applianceName\":[\"kerimHCItoHCIT\"],\"cluster\":{\"clusterName\":\"clrp09u13.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/clrp09u13RG/providers/Microsoft.AzureStackHCI/clusters/clrp09u13hci\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4995099027275934056\",\"fabricContainerId\":\"7773164056745\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/kerimHCItoHCI/providers/Microsoft.Migrate/MigrateProjects/kerimHCItoHCI/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/kerimHCItoHCI/providers/Microsoft.DataReplication/replicationFabrics/kerimHCItoHCIT41c9replicationfabric\",\"name\":\"kerimHCItoHCIT41c9replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"kerimha@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-04-26T22:59:00.0039969+00:00\",\"lastModifiedBy\":\"kerimha@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-04-26T22:59:00.0039969+00:00\"},\"tags\":{}},{\"location\":\"centralus\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.cus.siterecovery.azure.com\",\"serviceResourceId\":\"38ba9b6f-7be1-469c-b02a-50bc4bd6c67b\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/kerim04update/providers/Microsoft.OffAzure/HyperVSites/kerim04upsrc4568site\",\"fabricResourceId\":\"5088077886271429487\",\"fabricContainerId\":\"12183129554234\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/kerim04update/providers/Microsoft.Migrate/MigrateProjects/kerim04update/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/kerim04update/providers/Microsoft.DataReplication/replicationFabrics/kerim04upsrc4e5areplicationfabric\",\"name\":\"kerim04upsrc4e5areplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"kerimha@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-05-02T01:07:27.2382396+00:00\",\"lastModifiedBy\":\"kerimha@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-05-02T01:07:27.2382396+00:00\"},\"tags\":{}},{\"location\":\"centralus\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.cus.siterecovery.azure.com\",\"serviceResourceId\":\"b06f65bb-5a1c-460c-acc1-5cc91a9a3dec\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHCISiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/kerim04update/providers/Microsoft.OffAzure/HyperVSites/jnarccytgt0212site\",\"applianceName\":[\"jnarccytgt\"],\"cluster\":{\"clusterName\":\"clrn03u05.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgCLRN03U0507/providers/Microsoft.AzureStackHCI/clusters/CLRN03U05hci\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5047508361641158075\",\"fabricContainerId\":\"12217183483593\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/kerim04update/providers/Microsoft.Migrate/MigrateProjects/kerim04update/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/kerim04update/providers/Microsoft.DataReplication/replicationFabrics/jnarccytgtd898replicationfabric\",\"name\":\"jnarccytgtd898replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"kerimha@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-05-02T01:46:59.0573676+00:00\",\"lastModifiedBy\":\"kerimha@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-05-02T01:46:59.0573676+00:00\"},\"tags\":{}},{\"location\":\"centralus\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.cus.siterecovery.azure.com\",\"serviceResourceId\":\"dfeefe4a-6476-47f2-9173-382e3967a60f\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gdcusrg/providers/Microsoft.OffAzure/HyperVSites/kalla9777site\",\"fabricResourceId\":\"5184316582782762570\",\"fabricContainerId\":\"15105239650174\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gdcusrg/providers/Microsoft.Migrate/MigrateProjects/gdcus/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gdcusrg/providers/Microsoft.DataReplication/replicationFabrics/kallae6ffreplicationfabric\",\"name\":\"kallae6ffreplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"gadeshpa@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-05-05T10:17:38.8597245+00:00\",\"lastModifiedBy\":\"gadeshpa@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-05-05T10:17:38.8597245+00:00\"},\"tags\":{}},{\"location\":\"centralus\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.cus.siterecovery.azure.com\",\"serviceResourceId\":\"39c308b0-133b-49ad-b1d1-59a58afd2e93\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digotlonghaul/providers/Microsoft.OffAzure/HyperVSites/digotlhaulsrc4304site\",\"fabricResourceId\":\"5308920680832764080\",\"fabricContainerId\":\"763346987346\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digotlonghaul/providers/Microsoft.Migrate/MigrateProjects/digotlonghaul/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digotlonghaul/providers/Microsoft.DataReplication/replicationFabrics/digotlhaulsrcffc5replicationfabric\",\"name\":\"digotlhaulsrcffc5replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"digot@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-05-17T08:22:12.7249527+00:00\",\"lastModifiedBy\":\"digot@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-05-17T08:22:12.7249527+00:00\"},\"tags\":{}},{\"location\":\"centralus\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.cus.siterecovery.azure.com\",\"serviceResourceId\":\"bbb8470e-188d-4ed9-8ce6-4ecee7e64d12\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHCISiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digotlonghaul/providers/Microsoft.OffAzure/HyperVSites/digotlhaultgt3667site\",\"applianceName\":[\"digotlhaultgt\"],\"cluster\":{\"clusterName\":\"rn03-u0911.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/680d0dad-59aa-4464-adf3-b34b2b427e8c/resourceGroups/vjvmmigtest01RG/providers/Microsoft.AzureStackHCI/clusters/hciclu09011\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5681599401923462926\",\"fabricContainerId\":\"797804738355\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digotlonghaul/providers/Microsoft.Migrate/MigrateProjects/digotlonghaul/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digotlonghaul/providers/Microsoft.DataReplication/replicationFabrics/digotlhaultgt6963replicationfabric\",\"name\":\"digotlhaultgt6963replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"digot@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-05-17T09:59:03.8027605+00:00\",\"lastModifiedBy\":\"digot@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-05-17T09:59:03.8027605+00:00\"},\"tags\":{}},{\"location\":\"centralus\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.cus.siterecovery.azure.com\",\"serviceResourceId\":\"740362a2-2bb1-4054-b04b-3ba25710689f\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/kerim0522/providers/Microsoft.OffAzure/HyperVSites/kerim05224130site\",\"fabricResourceId\":\"4635377957626667682\",\"fabricContainerId\":\"5551079797260\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/kerim0522/providers/Microsoft.Migrate/MigrateProjects/kerim0522/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/kerim0522/providers/Microsoft.DataReplication/replicationFabrics/kerim05229af2replicationfabric\",\"name\":\"kerim05229af2replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"kerimha@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-05-22T22:01:16.8067217+00:00\",\"lastModifiedBy\":\"kerimha@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-05-22T22:01:16.8067217+00:00\"},\"tags\":{}},{\"location\":\"centralus\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.cus.siterecovery.azure.com\",\"serviceResourceId\":\"7d51be12-8bd9-4c4e-9b2d-8494b783713a\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHCISiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/kerim0522/providers/Microsoft.OffAzure/HyperVSites/kerim0522src4718site\",\"applianceName\":[\"kerim0522src\"],\"cluster\":{\"clusterName\":\"rn03-u0911.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/680d0dad-59aa-4464-adf3-b34b2b427e8c/resourceGroups/vjvmmigtest01RG/providers/Microsoft.AzureStackHCI/clusters/hciclu09011\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5498485961292627474\",\"fabricContainerId\":\"5567202137668\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/kerim0522/providers/Microsoft.Migrate/MigrateProjects/kerim0522/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/kerim0522/providers/Microsoft.DataReplication/replicationFabrics/kerim0522src9517replicationfabric\",\"name\":\"kerim0522src9517replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"kerimha@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-05-22T22:46:55.859245+00:00\",\"lastModifiedBy\":\"kerimha@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-05-22T22:46:55.859245+00:00\"},\"tags\":{}},{\"location\":\"centraluseuap\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.ccy.siterecovery.azure.com\",\"serviceResourceId\":\"f62f31c6-2d2a-4e44-9bdb-44d84804d817\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/saisamigRG/providers/Microsoft.OffAzure/HyperVSites/saisasrc01207041site\",\"fabricResourceId\":\"5639682295916868038\",\"fabricContainerId\":\"6730853507495\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/saisamigRG/providers/Microsoft.Migrate/MigrateProjects/saisamig0120/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/saisamigRG/providers/Microsoft.DataReplication/replicationFabrics/saisasrc0120ba1freplicationfabric\",\"name\":\"saisasrc0120ba1freplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"saisa@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-01-20T22:59:06.8930315+00:00\",\"lastModifiedBy\":\"saisa@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-01-20T22:59:06.8930315+00:00\"},\"tags\":{}},{\"location\":\"centraluseuap\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.ccy.siterecovery.azure.com\",\"serviceResourceId\":\"817aeba8-9598-46b3-bc79-2e3a1f7c458a\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/ppgdtest/providers/Microsoft.OffAzure/HyperVSites/srchd3428site\",\"fabricResourceId\":\"5094580085726047144\",\"fabricContainerId\":\"8746300576451\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/ppgdtest/providers/Microsoft.Migrate/MigrateProjects/jhh/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/ppgdtest/providers/Microsoft.DataReplication/replicationFabrics/srchd1cdcreplicationfabric\",\"name\":\"srchd1cdcreplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"gadeshpa@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-02-09T05:05:11.3322002+00:00\",\"lastModifiedBy\":\"gadeshpa@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-02-09T05:05:11.3322002+00:00\"},\"tags\":{}},{\"location\":\"centraluseuap\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.ccy.siterecovery.azure.com\",\"serviceResourceId\":\"ee15cbda-2fed-4646-9c48-edad768bb412\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHCISiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/ppgdtest/providers/Microsoft.OffAzure/HyperVSites/tgtaa5365site\",\"applianceName\":[\"tgtaa\"],\"cluster\":{\"clusterName\":\"clrn03u05.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgCLRN03U0507/providers/Microsoft.AzureStackHCI/clusters/CLRN03U05hci\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5063787529972861914\",\"fabricContainerId\":\"25262772871034\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/ppgdtest/providers/Microsoft.Migrate/MigrateProjects/jhh/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/ppgdtest/providers/Microsoft.DataReplication/replicationFabrics/tgtaac80freplicationfabric\",\"name\":\"tgtaac80freplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"gadeshpa@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-02-09T06:04:13.9115244+00:00\",\"lastModifiedBy\":\"gadeshpa@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-02-09T06:04:13.9115244+00:00\"},\"tags\":{}},{\"location\":\"centraluseuap\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.ccy.siterecovery.azure.com\",\"serviceResourceId\":\"71de3b64-7789-434c-87f8-c071dbfcafac\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg2/providers/Microsoft.OffAzure/HyperVSites/samlee3-src21866site\",\"fabricResourceId\":\"4849382330975796068\",\"fabricContainerId\":\"774925588652\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg2/providers/Microsoft.Migrate/MigrateProjects/samlee3-mig-proj2/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg2/providers/Microsoft.DataReplication/replicationFabrics/samlee3-src254a7replicationfabric\",\"name\":\"samlee3-src254a7replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"samlee3@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-02-15T19:01:55.6662222+00:00\",\"lastModifiedBy\":\"samlee3@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-02-15T19:01:55.6662222+00:00\"},\"tags\":{}},{\"location\":\"centraluseuap\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.ccy.siterecovery.azure.com\",\"serviceResourceId\":\"697d5402-e578-439e-beee-bdf199d720d7\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnar08/providers/Microsoft.OffAzure/HyperVSites/newSrcApp5531site\",\"fabricResourceId\":\"4872584152190112770\",\"fabricContainerId\":\"872286275063\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnar08/providers/Microsoft.Migrate/MigrateProjects/jnarProject/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnar08/providers/Microsoft.DataReplication/replicationFabrics/newSrcApp0ad6replicationfabric\",\"name\":\"newSrcApp0ad6replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-02-15T21:22:24.0929805+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-02-15T21:22:24.0929805+00:00\"},\"tags\":{}},{\"location\":\"centraluseuap\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.ccy.siterecovery.azure.com\",\"serviceResourceId\":\"a0121007-371e-4dac-b12e-96a7ffd1587e\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHCISiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnar08/providers/Microsoft.OffAzure/HyperVSites/newTrgtApp7266site\",\"applianceName\":[\"newTrgtApp\"],\"cluster\":{\"clusterName\":\"clrn03u05.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgCLRN03U0507/providers/Microsoft.AzureStackHCI/clusters/CLRN03U05hci\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5596909041588768775\",\"fabricContainerId\":\"872901966473\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnar08/providers/Microsoft.Migrate/MigrateProjects/jnarProject/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnar08/providers/Microsoft.DataReplication/replicationFabrics/newTrgtApp634breplicationfabric\",\"name\":\"newTrgtApp634breplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-02-15T21:23:25.7361913+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-02-15T21:23:25.7361913+00:00\"},\"tags\":{}},{\"location\":\"centraluseuap\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.ccy.siterecovery.azure.com\",\"serviceResourceId\":\"2b705cd9-fce5-4ffc-94db-dd2347bbbeed\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHCISiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg2/providers/Microsoft.OffAzure/HyperVSites/samlee3-tgt21613site\",\"applianceName\":[\"samlee3-tgt2\"],\"cluster\":{\"clusterName\":\"mayadahciclus3.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/clusters/mayadahciclus3\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5763759684333886681\",\"fabricContainerId\":\"910096051395\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg2/providers/Microsoft.Migrate/MigrateProjects/samlee3-mig-proj2/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg2/providers/Microsoft.DataReplication/replicationFabrics/samlee3-tgt26862replicationfabric\",\"name\":\"samlee3-tgt26862replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"samlee3@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-02-15T22:47:12.5052304+00:00\",\"lastModifiedBy\":\"samlee3@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-02-15T22:47:12.5052304+00:00\"},\"tags\":{}},{\"location\":\"centraluseuap\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.ccy.siterecovery.azure.com\",\"serviceResourceId\":\"926f67c8-576d-42ff-9375-25ad3d8766d8\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHCISiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnar08/providers/Microsoft.OffAzure/HyperVSites/targetApp21494site\",\"applianceName\":[\"targetApp2\"],\"cluster\":{\"clusterName\":\"clrn03u05.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgCLRN03U0507/providers/Microsoft.AzureStackHCI/clusters/CLRN03U05hci\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4827673453684287432\",\"fabricContainerId\":\"962162581099\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnar08/providers/Microsoft.Migrate/MigrateProjects/jnarProject/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnar08/providers/Microsoft.DataReplication/replicationFabrics/targetApp21684replicationfabric\",\"name\":\"targetApp21684replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-02-15T23:52:12.406674+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-02-15T23:52:12.406674+00:00\"},\"tags\":{}},{\"location\":\"centraluseuap\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.ccy.siterecovery.azure.com\",\"serviceResourceId\":\"c6144a71-a2e9-4cab-a24a-a8fd525c2864\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gdccyrg/providers/Microsoft.OffAzure/HyperVSites/gdsrcccy4004site\",\"fabricResourceId\":\"5524688492834343537\",\"fabricContainerId\":\"1014804776065\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gdccyrg/providers/Microsoft.Migrate/MigrateProjects/gdccy/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gdccyrg/providers/Microsoft.DataReplication/replicationFabrics/gdsrcccy2881replicationfabric\",\"name\":\"gdsrcccy2881replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"gadeshpa@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-02-24T11:40:45.1900881+00:00\",\"lastModifiedBy\":\"gadeshpa@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-02-24T11:40:45.1900881+00:00\"},\"tags\":{}},{\"location\":\"centraluseuap\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.ccy.siterecovery.azure.com\",\"serviceResourceId\":\"76fb63c7-3a5b-416e-a3b3-69f7ba74aa50\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHCISiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gdccyrg/providers/Microsoft.OffAzure/HyperVSites/gdtgtccy7137site\",\"applianceName\":[\"gdtgtccy\"],\"cluster\":{\"clusterName\":\"rnu-0103.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjvmmigtestrgu01u03/providers/Microsoft.AzureStackHCI/clusters/RNU-0103\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4714770024416109511\",\"fabricContainerId\":\"1037425831973\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gdccyrg/providers/Microsoft.Migrate/MigrateProjects/gdccy/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gdccyrg/providers/Microsoft.DataReplication/replicationFabrics/gdtgtccy57d8replicationfabric\",\"name\":\"gdtgtccy57d8replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"gadeshpa@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-02-24T12:18:26.6698771+00:00\",\"lastModifiedBy\":\"gadeshpa@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-02-24T12:18:26.6698771+00:00\"},\"tags\":{}},{\"location\":\"centraluseuap\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.ccy.siterecovery.azure.com\",\"serviceResourceId\":\"1461af8d-99c4-412d-9e69-5738e9f18c1d\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digmt224/providers/Microsoft.OffAzure/HyperVSites/ditmgt224sapl10749site\",\"fabricResourceId\":\"4696579053851881357\",\"fabricContainerId\":\"8571640170918\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digmt224/providers/Microsoft.Migrate/MigrateProjects/digmt224/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digmt224/providers/Microsoft.DataReplication/replicationFabrics/ditmgt224sapl19eb7replicationfabric\",\"name\":\"ditmgt224sapl19eb7replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"digot@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-02-24T19:36:30.2994968+00:00\",\"lastModifiedBy\":\"digot@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-02-24T19:36:30.2994968+00:00\"},\"tags\":{}},{\"location\":\"centraluseuap\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.ccy.siterecovery.azure.com\",\"serviceResourceId\":\"c838c64b-5ed0-4c4b-94bd-8ce52201aefc\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rawang-mig-testRG/providers/Microsoft.OffAzure/HyperVSites/rawang-srcap3421site\",\"fabricResourceId\":\"5497592020941194827\",\"fabricContainerId\":\"1381086622688\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rawang-mig-testRG/providers/Microsoft.Migrate/MigrateProjects/rawang-mig-proj/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rawang-mig-testRG/providers/Microsoft.DataReplication/replicationFabrics/rawang-srcapedcbreplicationfabric\",\"name\":\"rawang-srcapedcbreplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"rawang@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-02-24T21:51:13.6702342+00:00\",\"lastModifiedBy\":\"rawang@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-02-24T21:51:13.6702342+00:00\"},\"tags\":{}},{\"location\":\"centraluseuap\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.ccy.siterecovery.azure.com\",\"serviceResourceId\":\"2c8fa51d-4379-402f-a71a-fbdb75d21702\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHCISiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rawang-mig-testRG/providers/Microsoft.OffAzure/HyperVSites/rawang-dstap6734site\",\"applianceName\":[\"rawang-dstap\"],\"cluster\":{\"clusterName\":\"rnu-0103.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjvmmigtestrgu01u03/providers/Microsoft.AzureStackHCI/clusters/RNU-0103\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4624989530050503965\",\"fabricContainerId\":\"1437195484742\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rawang-mig-testRG/providers/Microsoft.Migrate/MigrateProjects/rawang-mig-proj/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rawang-mig-testRG/providers/Microsoft.DataReplication/replicationFabrics/rawang-dstap771breplicationfabric\",\"name\":\"rawang-dstap771breplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"rawang@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-02-24T23:24:44.3899027+00:00\",\"lastModifiedBy\":\"rawang@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-02-24T23:24:44.3899027+00:00\"},\"tags\":{}},{\"location\":\"centraluseuap\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.ccy.siterecovery.azure.com\",\"serviceResourceId\":\"54e97a62-4273-42bd-a190-c641ef3c9ed3\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHCISiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digmt224/providers/Microsoft.OffAzure/HyperVSites/digmt224ta12380site\",\"applianceName\":[\"digmt224ta1\"],\"cluster\":{\"clusterName\":\"rnu-0103.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjvmmigtestrgu01u03/providers/Microsoft.AzureStackHCI/clusters/RNU-0103\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4809073040214817378\",\"fabricContainerId\":\"8713938801576\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digmt224/providers/Microsoft.Migrate/MigrateProjects/digmt224/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digmt224/providers/Microsoft.DataReplication/replicationFabrics/digmt224ta18381replicationfabric\",\"name\":\"digmt224ta18381replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"digot@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-02-24T23:33:40.1440493+00:00\",\"lastModifiedBy\":\"digot@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-02-24T23:33:40.1440493+00:00\"},\"tags\":{}},{\"location\":\"centraluseuap\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.ccy.siterecovery.azure.com\",\"serviceResourceId\":\"3d62d3a5-b67b-4b55-b49d-3dbbf0e7a3b5\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/feb27PerfRG/providers/Microsoft.OffAzure/HyperVSites/srcfeb27perf9765site\",\"fabricResourceId\":\"5428445566292120485\",\"fabricContainerId\":\"11833662400982\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/feb27PerfRG/providers/Microsoft.Migrate/MigrateProjects/feb27PerfPrj/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/feb27PerfRG/providers/Microsoft.DataReplication/replicationFabrics/srcfeb27perf7f89replicationfabric\",\"name\":\"srcfeb27perf7f89replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"helenafework@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-02-28T14:13:14.5974203+00:00\",\"lastModifiedBy\":\"helenafework@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-02-28T14:13:14.5974203+00:00\"},\"tags\":{}},{\"location\":\"centraluseuap\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.ccy.siterecovery.azure.com\",\"serviceResourceId\":\"5fa41b32-ee75-47cb-8931-8e13b48266f3\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHCISiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/feb27PerfRG/providers/Microsoft.OffAzure/HyperVSites/tarfeb27Perf3606site\",\"applianceName\":[\"tarfeb27Perf\"],\"cluster\":{\"clusterName\":\"cltk52931.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgforClusterTK52931/providers/Microsoft.AzureStackHCI/clusters/hciClusterTK52931\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5173490784848321330\",\"fabricContainerId\":\"12020538235795\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/feb27PerfRG/providers/Microsoft.Migrate/MigrateProjects/feb27PerfPrj/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/feb27PerfRG/providers/Microsoft.DataReplication/replicationFabrics/tarfeb27Perf80fereplicationfabric\",\"name\":\"tarfeb27Perf80fereplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"helenafework@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-02-28T19:24:41.2595628+00:00\",\"lastModifiedBy\":\"helenafework@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-02-28T19:24:41.2595628+00:00\"},\"tags\":{}},{\"location\":\"centraluseuap\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.ccy.siterecovery.azure.com\",\"serviceResourceId\":\"19c4e4f9-6811-4cd7-afca-bbb4d9c26144\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mar8PerfRG/providers/Microsoft.OffAzure/HyperVSites/mar8Src1876site\",\"fabricResourceId\":\"5537008689531380985\",\"fabricContainerId\":\"11775247792960\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mar8PerfRG/providers/Microsoft.Migrate/MigrateProjects/mar8PerfPrj/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mar8PerfRG/providers/Microsoft.DataReplication/replicationFabrics/mar8Srcfdfbreplicationfabric\",\"name\":\"mar8Srcfdfbreplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"helenafework@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-03-08T22:35:01.3517224+00:00\",\"lastModifiedBy\":\"helenafework@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-03-08T22:35:01.3517224+00:00\"},\"tags\":{}},{\"location\":\"centraluseuap\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.ccy.siterecovery.azure.com\",\"serviceResourceId\":\"5c634f73-998a-4f9c-a253-b15e907bcbb6\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHCISiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mar8PerfRG/providers/Microsoft.OffAzure/HyperVSites/mar8Tar1427site\",\"applianceName\":[\"mar8Tar\"],\"cluster\":{\"clusterName\":\"cltk52931.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgforClusterTK52931/providers/Microsoft.AzureStackHCI/clusters/hciClusterTK52931\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5736628844897718131\",\"fabricContainerId\":\"19211087548957\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mar8PerfRG/providers/Microsoft.Migrate/MigrateProjects/mar8PerfPrj/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mar8PerfRG/providers/Microsoft.DataReplication/replicationFabrics/mar8Tarc0dareplicationfabric\",\"name\":\"mar8Tarc0dareplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"helenafework@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-03-09T03:09:00.4858905+00:00\",\"lastModifiedBy\":\"helenafework@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-03-09T03:09:00.4858905+00:00\"},\"tags\":{}},{\"location\":\"centraluseuap\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.ccy.siterecovery.azure.com\",\"serviceResourceId\":\"c486d67a-fcfb-47ae-86d7-169552b9f805\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mar9PerfRG/providers/Microsoft.OffAzure/HyperVSites/mar9Src3659site\",\"fabricResourceId\":\"5165343980904699514\",\"fabricContainerId\":\"19670908176918\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mar9PerfRG/providers/Microsoft.Migrate/MigrateProjects/mar9PerfPr/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mar9PerfRG/providers/Microsoft.DataReplication/replicationFabrics/mar9Src4c8ereplicationfabric\",\"name\":\"mar9Src4c8ereplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"helenafework@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-03-09T15:55:22.062465+00:00\",\"lastModifiedBy\":\"helenafework@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-03-09T15:55:22.062465+00:00\"},\"tags\":{}},{\"location\":\"centraluseuap\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.ccy.siterecovery.azure.com\",\"serviceResourceId\":\"d37bb041-1fe0-4d97-94fe-779210a2ad79\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHCISiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mar9PerfRG/providers/Microsoft.OffAzure/HyperVSites/mar9tar4860site\",\"applianceName\":[\"mar9tar\"],\"cluster\":{\"clusterName\":\"cltk52931.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgforClusterTK52931/providers/Microsoft.AzureStackHCI/clusters/hciClusterTK52931\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5590972512884994113\",\"fabricContainerId\":\"19681591390102\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mar9PerfRG/providers/Microsoft.Migrate/MigrateProjects/mar9PerfPr/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mar9PerfRG/providers/Microsoft.DataReplication/replicationFabrics/mar9tar53a0replicationfabric\",\"name\":\"mar9tar53a0replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"helenafework@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-03-09T16:13:10.4977708+00:00\",\"lastModifiedBy\":\"helenafework@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-03-09T16:13:10.4977708+00:00\"},\"tags\":{}},{\"location\":\"centraluseuap\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.ccy.siterecovery.azure.com\",\"serviceResourceId\":\"d7fa2e51-9102-4209-8af9-eeafcc1c1bd2\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/crcampb-migrate-ccy-0420/providers/Microsoft.OffAzure/HyperVSites/crcSrcApp04206608site\",\"fabricResourceId\":\"4758493922693099089\",\"fabricContainerId\":\"7801670389176\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/crcampb-migrate-ccy-0420/providers/Microsoft.Migrate/MigrateProjects/crcampb-ccy-0420/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/crcampb-migrate-ccy-0420/providers/Microsoft.DataReplication/replicationFabrics/crcSrcApp0420163areplicationfabric\",\"name\":\"crcSrcApp0420163areplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"crcampb@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-04-20T20:04:35.1120346+00:00\",\"lastModifiedBy\":\"crcampb@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-04-20T20:04:35.1120346+00:00\"},\"tags\":{}},{\"location\":\"centraluseuap\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.ccy.siterecovery.azure.com\",\"serviceResourceId\":\"99b250b2-244c-4fd8-abb0-112b50250fcf\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHCISiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/crcampb-migrate-ccy-0420/providers/Microsoft.OffAzure/HyperVSites/crcTgtApp4202369site\",\"applianceName\":[\"crcTgtApp420\"],\"cluster\":{\"clusterName\":\"clrn03u05.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgCLRN03U0507/providers/Microsoft.AzureStackHCI/clusters/CLRN03U05hci\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5753388435380523186\",\"fabricContainerId\":\"7824462560272\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/crcampb-migrate-ccy-0420/providers/Microsoft.Migrate/MigrateProjects/crcampb-ccy-0420/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/crcampb-migrate-ccy-0420/providers/Microsoft.DataReplication/replicationFabrics/crcTgtApp420904areplicationfabric\",\"name\":\"crcTgtApp420904areplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"crcampb@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-04-20T20:42:34.6756655+00:00\",\"lastModifiedBy\":\"crcampb@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-04-20T20:42:34.6756655+00:00\"},\"tags\":{}},{\"location\":\"centraluseuap\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.ccy.siterecovery.azure.com\",\"serviceResourceId\":\"c7bdcfe0-3e06-4182-ad44-c4e23f99df00\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/crcampb-migrate-ccy-0420/providers/Microsoft.OffAzure/HyperVSites/crcSrcApp04212064site\",\"fabricResourceId\":\"4720403558279532512\",\"fabricContainerId\":\"8570302249059\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/crcampb-migrate-ccy-0420/providers/Microsoft.Migrate/MigrateProjects/crcampb-ccy-0421/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/crcampb-migrate-ccy-0420/providers/Microsoft.DataReplication/replicationFabrics/crcSrcApp0421dacdreplicationfabric\",\"name\":\"crcSrcApp0421dacdreplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"crcampb@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-04-21T18:07:32.9604049+00:00\",\"lastModifiedBy\":\"crcampb@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-04-21T18:07:32.9604049+00:00\"},\"tags\":{}},{\"location\":\"centraluseuap\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.ccy.siterecovery.azure.com\",\"serviceResourceId\":\"1fb8a88f-dbf4-4392-b069-843d7d81020f\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarRGccy/providers/Microsoft.OffAzure/HyperVSites/jnarccySrc4670site\",\"fabricResourceId\":\"4869195988691626127\",\"fabricContainerId\":\"13925338321773\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarRGccy/providers/Microsoft.Migrate/MigrateProjects/jnarProj0427ccy/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarRGccy/providers/Microsoft.DataReplication/replicationFabrics/jnarccySrc9727replicationfabric\",\"name\":\"jnarccySrc9727replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-04-27T22:30:52.7587733+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-04-27T22:30:52.7587733+00:00\"},\"tags\":{}},{\"location\":\"centraluseuap\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.ccy.siterecovery.azure.com\",\"serviceResourceId\":\"a7bdaa72-0d24-4324-b226-830ac39bb99e\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarRGccy/providers/Microsoft.OffAzure/HyperVSites/jnarSrcApp8320site\",\"fabricResourceId\":\"4838006350786964082\",\"fabricContainerId\":\"14016535715489\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarRGccy/providers/Microsoft.Migrate/MigrateProjects/jnarProj0427ccy/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarRGccy/providers/Microsoft.DataReplication/replicationFabrics/jnarSrcApp4a9creplicationfabric\",\"name\":\"jnarSrcApp4a9creplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-04-28T00:42:40.9639955+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-04-28T00:42:40.9639955+00:00\"},\"tags\":{}},{\"location\":\"centraluseuap\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.ccy.siterecovery.azure.com\",\"serviceResourceId\":\"32f9f894-ea3d-4430-aa95-26af21d075c1\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarRGccy/providers/Microsoft.OffAzure/HyperVSites/jnarFinalSrc4433site\",\"fabricResourceId\":\"4913684742030358676\",\"fabricContainerId\":\"17295728089353\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarRGccy/providers/Microsoft.Migrate/MigrateProjects/jnarProj0427ccy/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarRGccy/providers/Microsoft.DataReplication/replicationFabrics/jnarFinalSrcb9fareplicationfabric\",\"name\":\"jnarFinalSrcb9fareplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-05-01T20:08:12.6186814+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-05-01T20:08:12.6186814+00:00\"},\"tags\":{}},{\"location\":\"centraluseuap\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.ccy.siterecovery.azure.com\",\"serviceResourceId\":\"1c064397-1583-441c-87ff-9a0bf43fa3b1\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarRGccy/providers/Microsoft.OffAzure/HyperVSites/srcAppliance6161site\",\"fabricResourceId\":\"4907821346782069655\",\"fabricContainerId\":\"17475655632460\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarRGccy/providers/Microsoft.Migrate/MigrateProjects/jnarProj0501/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarRGccy/providers/Microsoft.DataReplication/replicationFabrics/srcApplianced561replicationfabric\",\"name\":\"srcApplianced561replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-05-02T01:29:46.7816832+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-05-02T01:29:46.7816832+00:00\"},\"tags\":{}},{\"location\":\"centraluseuap\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.ccy.siterecovery.azure.com\",\"serviceResourceId\":\"bd254104-d311-4c6b-96a5-6c43cbd62c83\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHCISiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarRGccy/providers/Microsoft.OffAzure/HyperVSites/tgtAppliance5060site\",\"applianceName\":[\"tgtAppliance\"],\"cluster\":{\"clusterName\":\"clrn03u05.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgCLRN03U0507/providers/Microsoft.AzureStackHCI/clusters/CLRN03U05hci\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5506727042531803396\",\"fabricContainerId\":\"17491236587276\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarRGccy/providers/Microsoft.Migrate/MigrateProjects/jnarProj0501/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarRGccy/providers/Microsoft.DataReplication/replicationFabrics/tgtAppliancefdedreplicationfabric\",\"name\":\"tgtAppliancefdedreplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-05-02T01:55:45.9596216+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-05-02T01:55:45.9596216+00:00\"},\"tags\":{}},{\"location\":\"centraluseuap\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.ccy.siterecovery.azure.com\",\"serviceResourceId\":\"e44a4c14-84a3-46be-81d8-7671ffb9970e\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/kerimaprilup/providers/Microsoft.OffAzure/HyperVSites/kerimaprilupsr6525site\",\"fabricResourceId\":\"5097657667674590228\",\"fabricContainerId\":\"18053817879376\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/kerimaprilup/providers/Microsoft.Migrate/MigrateProjects/kerimaprilup/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/kerimaprilup/providers/Microsoft.DataReplication/replicationFabrics/kerimaprilupsrc1e4replicationfabric\",\"name\":\"kerimaprilupsrc1e4replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"kerimha@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-05-02T17:11:42.4088343+00:00\",\"lastModifiedBy\":\"kerimha@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-05-02T17:11:42.4088343+00:00\"},\"tags\":{}},{\"location\":\"centraluseuap\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.ccy.siterecovery.azure.com\",\"serviceResourceId\":\"b4891033-3c44-4b40-85da-75cd3097338d\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHCISiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/kerimaprilup/providers/Microsoft.OffAzure/HyperVSites/kerimapriluptg6545site\",\"applianceName\":[\"kerimapriluptg\"],\"cluster\":{\"clusterName\":\"clrn03u05.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgCLRN03U0507/providers/Microsoft.AzureStackHCI/clusters/CLRN03U05hci\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5422400217138401331\",\"fabricContainerId\":\"18285825878182\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/kerimaprilup/providers/Microsoft.Migrate/MigrateProjects/kerimaprilup/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/kerimaprilup/providers/Microsoft.DataReplication/replicationFabrics/kerimapriluptg8ba5replicationfabric\",\"name\":\"kerimapriluptg8ba5replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"kerimha@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-05-02T23:18:08.1530437+00:00\",\"lastModifiedBy\":\"kerimha@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-05-02T23:18:08.1530437+00:00\"},\"tags\":{}},{\"location\":\"centraluseuap\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.ccy.siterecovery.azure.com\",\"serviceResourceId\":\"07403c50-8d22-4f52-9083-1ba8870fd1c6\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarRGccy/providers/Microsoft.OffAzure/HyperVSites/SrcAppCCY05117547site\",\"fabricResourceId\":\"5715786054376635472\",\"fabricContainerId\":\"1662674861215\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarRGccy/providers/Microsoft.Migrate/MigrateProjects/jnarProjCCY0511/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarRGccy/providers/Microsoft.DataReplication/replicationFabrics/SrcAppCCY051127d5replicationfabric\",\"name\":\"SrcAppCCY051127d5replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-05-11T18:32:39.4328957+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-05-11T18:32:39.4328957+00:00\"},\"tags\":{}},{\"location\":\"centraluseuap\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.ccy.siterecovery.azure.com\",\"serviceResourceId\":\"2f5d595a-0b09-44f0-8005-a24e991c7a41\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHCISiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarRGccy/providers/Microsoft.OffAzure/HyperVSites/TgtAppCCY05114802site\",\"applianceName\":[\"TgtAppCCY0511\"],\"cluster\":{\"clusterName\":\"clrn03u05.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgCLRN03U0507/providers/Microsoft.AzureStackHCI/clusters/CLRN03U05hci\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4967482523066915162\",\"fabricContainerId\":\"1770010669081\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarRGccy/providers/Microsoft.Migrate/MigrateProjects/jnarProjCCY0511/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarRGccy/providers/Microsoft.DataReplication/replicationFabrics/TgtAppCCY05117729replicationfabric\",\"name\":\"TgtAppCCY05117729replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-05-11T21:31:33.2483188+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-05-11T21:31:33.2483188+00:00\"},\"tags\":{}},{\"location\":\"centraluseuap\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.ccy.siterecovery.azure.com\",\"serviceResourceId\":\"6106de8a-377b-49d2-9123-f3659e479923\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/lumawariccytest/providers/Microsoft.OffAzure/HyperVSites/srcappccy4365site\",\"fabricResourceId\":\"5319375112926322314\",\"fabricContainerId\":\"4324049843283\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/lumawariccytest/providers/Microsoft.Migrate/MigrateProjects/lumawariccytest/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/lumawariccytest/providers/Microsoft.DataReplication/replicationFabrics/srcappccy0b94replicationfabric\",\"name\":\"srcappccy0b94replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vmmige2etest@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-06-28T21:46:30.8999875+00:00\",\"lastModifiedBy\":\"vmmige2etest@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-06-28T21:46:30.8999875+00:00\"},\"tags\":{}},{\"location\":\"centraluseuap\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.ccy.siterecovery.azure.com\",\"serviceResourceId\":\"65557641-4c18-476f-a5c6-8a4b046f80fa\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHCISiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/lumawariccytest/providers/Microsoft.OffAzure/HyperVSites/tgtappccy3910site\",\"applianceName\":[\"tgtappccy\"],\"cluster\":{\"clusterName\":\"clrn03u05.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgCLRN03U0507/providers/Microsoft.AzureStackHCI/clusters/CLRN03U05hci\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5147416566770792001\",\"fabricContainerId\":\"4340198431466\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/lumawariccytest/providers/Microsoft.Migrate/MigrateProjects/lumawariccytest/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/lumawariccytest/providers/Microsoft.DataReplication/replicationFabrics/tgtappccyfbecreplicationfabric\",\"name\":\"tgtappccyfbecreplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vmmige2etest@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-06-28T22:13:25.0251806+00:00\",\"lastModifiedBy\":\"vmmige2etest@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-06-28T22:13:25.0251806+00:00\"},\"tags\":{}},{\"location\":\"centraluseuap\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.ccy.siterecovery.azure.com\",\"serviceResourceId\":\"d95eea57-7d0a-44f2-8c21-30b95f82e9b6\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/lumawaritest0725/providers/Microsoft.OffAzure/HyperVSites/srcapp7258358site\",\"fabricResourceId\":\"4968170824493099607\",\"fabricContainerId\":\"184242239667\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/lumawaritest0725/providers/Microsoft.Migrate/MigrateProjects/lumawaritest0725/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/lumawaritest0725/providers/Microsoft.DataReplication/replicationFabrics/srcapp725ccfereplicationfabric\",\"name\":\"srcapp725ccfereplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"lumawari@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-07-26T19:10:32.5004192+00:00\",\"lastModifiedBy\":\"lumawari@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-07-26T19:10:32.5004192+00:00\"},\"tags\":{}},{\"location\":\"centraluseuap\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-asrrp1.ccy.siterecovery.azure.com\",\"serviceResourceId\":\"88404447-31fe-4ff3-a999-2702f91b9cf6\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHCISiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/lumawaritest0725/providers/Microsoft.OffAzure/HyperVSites/tgtapp6787site\",\"applianceName\":[\"tgtapp\"],\"cluster\":{\"clusterName\":\"rn03-u0911.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/680d0dad-59aa-4464-adf3-b34b2b427e8c/resourceGroups/vjvmmigtest01RG/providers/Microsoft.AzureStackHCI/clusters/hciclu09011\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5761003317614363719\",\"fabricContainerId\":\"13033082083982\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/lumawaritest0725/providers/Microsoft.Migrate/MigrateProjects/lumawaritest0725/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/lumawaritest0725/providers/Microsoft.DataReplication/replicationFabrics/tgtapp2502replicationfabric\",\"name\":\"tgtapp2502replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"lumawari@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-07-26T21:06:46.2531223+00:00\",\"lastModifiedBy\":\"lumawari@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-07-26T21:06:46.2531223+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"7a6ca06a-02e6-42d3-8701-f49ee669a6d5\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/bugbashgd/providers/Microsoft.OffAzure/HyperVSites/gdtestapp1151site\",\"fabricResourceId\":\"4815195615508865130\",\"fabricContainerId\":\"17078538071852\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/bugbashgd/providers/Microsoft.Migrate/MigrateProjects/bbgd/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/bugbashgd/providers/Microsoft.DataReplication/replicationFabrics/gdtestapp22f4replicationfabric\",\"name\":\"gdtestapp22f4replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"gadeshpa@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-06-07T17:00:11.611245+00:00\",\"lastModifiedBy\":\"gadeshpa@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-06-07T17:00:11.611245+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"a7553042-7c17-4469-98c0-5a8810bf5b98\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/algamaes-rg/providers/Microsoft.OffAzure/HyperVSites/gamaapp9491site\",\"fabricResourceId\":\"4929607708167188546\",\"fabricContainerId\":\"17079132437292\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/algamaes-rg/providers/Microsoft.Migrate/MigrateProjects/gama1007/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/algamaes-rg/providers/Microsoft.DataReplication/replicationFabrics/gamaappdff2replicationfabric\",\"name\":\"gamaappdff2replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"alexander.gama@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-06-07T17:42:06.6998558+00:00\",\"lastModifiedBy\":\"alexander.gama@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-06-07T17:42:06.6998558+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"9b725dec-19fe-40a6-8f38-e367b20185d8\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/crcampb-seasisa715b/providers/Microsoft.OffAzure/HyperVSites/src715b7016site\",\"fabricResourceId\":\"4658439445881708012\",\"fabricContainerId\":\"24939730661735\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/crcampb-seasisa715b/providers/Microsoft.Migrate/MigrateProjects/seasia715b/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/crcampb-seasisa715b/providers/Microsoft.DataReplication/replicationFabrics/src715bd5a7replicationfabric\",\"name\":\"src715bd5a7replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"crcampb@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-07-15T06:05:07.2441999+00:00\",\"lastModifiedBy\":\"crcampb@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-07-15T06:05:07.2441999+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"70a942bc-6660-467f-b7f6-64e99b01571f\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/crcampb-seasisa715b/providers/Microsoft.OffAzure/HyperVSites/dst715b2697site\",\"applianceName\":[\"dst715b\"],\"cluster\":{\"clusterName\":\"aszhciclus2.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/680d0dad-59aa-4464-adf3-b34b2b427e8c/resourceGroups/aszhciclus2-rg/providers/Microsoft.AzureStackHCI/clusters/aszhciclus2\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5079891469090243260\",\"fabricContainerId\":\"24946452782579\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/crcampb-seasisa715b/providers/Microsoft.Migrate/MigrateProjects/seasia715b/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/crcampb-seasisa715b/providers/Microsoft.DataReplication/replicationFabrics/dst715b43d3replicationfabric\",\"name\":\"dst715b43d3replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"crcampb@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-07-15T06:16:19.6875916+00:00\",\"lastModifiedBy\":\"crcampb@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-07-15T06:16:19.6875916+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"be541b65-70d8-485c-bb57-2b784277c5c9\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmigratetest123/providers/Microsoft.OffAzure/HyperVSites/aszmigtest-11502ae-site\",\"fabricResourceId\":\"5214166544796621669\",\"fabricContainerId\":\"4597657367809\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmigratetest123/providers/Microsoft.Migrate/MigrateProjects/aszmigtest-11502ae/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmigratetest123/providers/Microsoft.DataReplication/replicationFabrics/HyperV-11502ae39a2replicationfabric\",\"name\":\"HyperV-11502ae39a2replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vmmige2etest@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-07-21T17:32:02.1415632+00:00\",\"lastModifiedBy\":\"vmmige2etest@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-07-21T18:03:30.6469091+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"d662661a-0460-4fe9-b3b3-030ddc6cc23f\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/test0721v2/providers/Microsoft.OffAzure/HyperVSites/targettest07217541site\",\"applianceName\":[\"targettest0721\"],\"cluster\":{\"clusterName\":\"100.101.61.55\",\"resourceName\":\"/Subscriptions/680d0dad-59aa-4464-adf3-b34b2b427e8c/resourceGroups/vjvmmigtest01RG/providers/Microsoft.AzureStackHCI/clusters/hciclu09011\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5758138412530034202\",\"fabricContainerId\":\"4678394229654\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/test0721v2/providers/Microsoft.Migrate/MigrateProjects/testMigrate0721/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/test0721v2/providers/Microsoft.DataReplication/replicationFabrics/targettest0721cf2freplicationfabric\",\"name\":\"targettest0721cf2freplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vmmige2etest@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-07-21T19:46:35.7894185+00:00\",\"lastModifiedBy\":\"vmmige2etest@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-07-21T19:46:35.7894185+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"b99d7c19-85e0-47ec-b728-546366677386\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/seasia721a/providers/Microsoft.OffAzure/HyperVSites/src7217329site\",\"fabricResourceId\":\"5182664471429872665\",\"fabricContainerId\":\"4705004655810\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/seasia721a/providers/Microsoft.Migrate/MigrateProjects/seasia721a/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/seasia721a/providers/Microsoft.DataReplication/replicationFabrics/src7216466replicationfabric\",\"name\":\"src7216466replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"crcampb@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-07-21T20:30:56.6089013+00:00\",\"lastModifiedBy\":\"crcampb@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-07-21T20:30:56.6089013+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"dee48b27-521b-4eb0-a54b-7d77f597c76c\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/seasia721a/providers/Microsoft.OffAzure/HyperVSites/dst7212670site\",\"applianceName\":[\"dst721\"],\"cluster\":{\"clusterName\":\"aszhciclus2.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/680d0dad-59aa-4464-adf3-b34b2b427e8c/resourceGroups/aszhciclus2-rg/providers/Microsoft.AzureStackHCI/clusters/aszhciclus2\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5670122210516568871\",\"fabricContainerId\":\"4721282386204\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/seasia721a/providers/Microsoft.Migrate/MigrateProjects/seasia721a/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/seasia721a/providers/Microsoft.DataReplication/replicationFabrics/dst7211569replicationfabric\",\"name\":\"dst7211569replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"crcampb@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-07-21T20:58:04.5728612+00:00\",\"lastModifiedBy\":\"crcampb@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-07-21T20:58:04.5728612+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"b7133efa-9e28-4c56-b2f8-195d0b86d933\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/crcampbseasia721b/providers/Microsoft.OffAzure/HyperVSites/src721b8067site\",\"fabricResourceId\":\"5500757892587011834\",\"fabricContainerId\":\"5040811818108\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/crcampbseasia721b/providers/Microsoft.Migrate/MigrateProjects/seasia721b/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/crcampbseasia721b/providers/Microsoft.DataReplication/replicationFabrics/src721ba962replicationfabric\",\"name\":\"src721ba962replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"crcampb@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-07-22T05:50:36.7169863+00:00\",\"lastModifiedBy\":\"crcampb@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-07-22T05:50:36.7169863+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"f85b9eef-85b4-4345-b9fd-f77228a5a362\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-replcn-0721/providers/Microsoft.OffAzure/HyperVSites/replcn0721src0847site\",\"fabricResourceId\":\"4847427586241568495\",\"fabricContainerId\":\"5044348069820\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-replcn-0721/providers/Microsoft.Migrate/MigrateProjects/srinireplcn0721/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-replcn-0721/providers/Microsoft.DataReplication/replicationFabrics/replcn0721src3b52replicationfabric\",\"name\":\"replcn0721src3b52replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vmmige2etest@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-07-22T05:56:33.3268883+00:00\",\"lastModifiedBy\":\"vmmige2etest@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-07-22T06:53:56.5660026+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"66d0f223-9364-4e1e-97de-4dea40804e78\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/crcampbseasia721b/providers/Microsoft.OffAzure/HyperVSites/dst721b2386site\",\"applianceName\":[\"dst721b\"],\"cluster\":{\"clusterName\":\"aszhciclus2.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/680d0dad-59aa-4464-adf3-b34b2b427e8c/resourceGroups/aszhciclus2-rg/providers/Microsoft.AzureStackHCI/clusters/aszhciclus2\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5629098643690680867\",\"fabricContainerId\":\"5055188803232\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/crcampbseasia721b/providers/Microsoft.Migrate/MigrateProjects/seasia721b/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/crcampbseasia721b/providers/Microsoft.DataReplication/replicationFabrics/dst721ba816replicationfabric\",\"name\":\"dst721ba816replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"crcampb@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-07-22T06:14:34.1364661+00:00\",\"lastModifiedBy\":\"crcampb@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-07-22T06:14:34.1364661+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"eb8c3dda-1ccc-43c2-9a61-433cdece1cdf\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-replcn-0721/providers/Microsoft.OffAzure/HyperVSites/repl0725src29718site\",\"fabricResourceId\":\"4882496612473781722\",\"fabricContainerId\":\"8158140012732\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-replcn-0721/providers/Microsoft.Migrate/MigrateProjects/srinireplcn0721/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-replcn-0721/providers/Microsoft.DataReplication/replicationFabrics/repl0725src2156breplicationfabric\",\"name\":\"repl0725src2156breplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vmmige2etest@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-07-25T20:26:03.1883896+00:00\",\"lastModifiedBy\":\"vmmige2etest@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-07-25T20:26:03.1883896+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"8ad1f4cc-1801-4029-8580-ed7d8ba2f2a8\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-replcn-0721/providers/Microsoft.OffAzure/HyperVSites/replcn0721src0847site\",\"applianceName\":[\"replcn0721src\"],\"cluster\":{\"clusterName\":\"100.101.61.55\",\"resourceName\":\"/Subscriptions/680d0dad-59aa-4464-adf3-b34b2b427e8c/resourceGroups/vjvmmigtest01RG/providers/Microsoft.AzureStackHCI/clusters/hciclu09011\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4623252887375574220\",\"fabricContainerId\":\"8160795327442\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-replcn-0721/providers/Microsoft.Migrate/MigrateProjects/srinireplcn0721/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-replcn-0721/providers/Microsoft.DataReplication/replicationFabrics/replcn0721src68abreplicationfabric\",\"name\":\"replcn0721src68abreplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vmmige2etest@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-07-25T20:30:31.4232351+00:00\",\"lastModifiedBy\":\"vmmige2etest@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-07-25T20:30:31.4232351+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"9d416c3b-c7af-4f9d-8348-78e585a66850\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-replcn-0721/providers/Microsoft.OffAzure/HyperVSites/repl0725src39717site\",\"fabricResourceId\":\"5736961057411394619\",\"fabricContainerId\":\"8330555525346\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-replcn-0721/providers/Microsoft.Migrate/MigrateProjects/srinireplcn0721/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-replcn-0721/providers/Microsoft.DataReplication/replicationFabrics/repl0725src3d634replicationfabric\",\"name\":\"repl0725src3d634replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vmmige2etest@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-07-26T01:13:24.2728509+00:00\",\"lastModifiedBy\":\"vmmige2etest@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-07-26T01:13:24.2728509+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"da7df554-b84c-4893-bdb4-4bcc86e277bd\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srinitest0726/providers/Microsoft.OffAzure/HyperVSites/replcn0726src9035site\",\"fabricResourceId\":\"5229726232529990996\",\"fabricContainerId\":\"9006574137197\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srinitest0726/providers/Microsoft.Migrate/MigrateProjects/sriniMig0726/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srinitest0726/providers/Microsoft.DataReplication/replicationFabrics/replcn0726src572areplicationfabric\",\"name\":\"replcn0726src572areplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vmmige2etest@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-07-26T20:20:32.4929985+00:00\",\"lastModifiedBy\":\"vmmige2etest@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-07-26T20:28:50.6957765+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"156f2189-15f3-4a9b-a31a-ed30bb167ee5\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srinitest0726/providers/Microsoft.OffAzure/HyperVSites/replcn0726src22583site\",\"fabricResourceId\":\"5375914713977659785\",\"fabricContainerId\":\"9057757245786\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srinitest0726/providers/Microsoft.Migrate/MigrateProjects/sriniMig0726/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srinitest0726/providers/Microsoft.DataReplication/replicationFabrics/replcn0726src23950replicationfabric\",\"name\":\"replcn0726src23950replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vmmige2etest@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-07-26T21:25:25.9519083+00:00\",\"lastModifiedBy\":\"vmmige2etest@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-07-26T21:25:25.9519083+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"7f5a4481-20c9-4bf0-b3a6-6646f11b3a93\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srinitest0726/providers/Microsoft.OffAzure/HyperVSites/replcn0726src32584site\",\"fabricResourceId\":\"5471909597052290177\",\"fabricContainerId\":\"9067428101326\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srinitest0726/providers/Microsoft.Migrate/MigrateProjects/sriniMig0726/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srinitest0726/providers/Microsoft.DataReplication/replicationFabrics/replcn0726src389fdreplicationfabric\",\"name\":\"replcn0726src389fdreplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vmmige2etest@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-07-26T22:01:54.521016+00:00\",\"lastModifiedBy\":\"vmmige2etest@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-07-27T00:39:32.3509491+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"42ea4154-a2cf-4f33-84fd-10d2fd1959bc\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srinitest0726/providers/Microsoft.OffAzure/HyperVSites/replcn0726tgt9672site\",\"applianceName\":[\"replcn0726tgt\"],\"cluster\":{\"clusterName\":\"100.101.61.55\",\"resourceName\":\"/Subscriptions/680d0dad-59aa-4464-adf3-b34b2b427e8c/resourceGroups/vjvmmigtest01RG/providers/Microsoft.AzureStackHCI/clusters/hciclu09011\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5707084163873128788\",\"fabricContainerId\":\"11689774231832\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srinitest0726/providers/Microsoft.Migrate/MigrateProjects/sriniMig0726/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srinitest0726/providers/Microsoft.DataReplication/replicationFabrics/replcn0726tgtc55areplicationfabric\",\"name\":\"replcn0726tgtc55areplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vmmige2etest@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-07-29T22:12:49.0045379+00:00\",\"lastModifiedBy\":\"vmmige2etest@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-07-29T22:12:49.0045379+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"2f83e53f-16fc-480d-8154-dcd8cf2ea1dd\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digot-migrate-rg1/providers/Microsoft.OffAzure/HyperVSites/digotsrcappl15922site\",\"fabricResourceId\":\"5191831217812792639\",\"fabricContainerId\":\"14259663435911\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digot-migrate-rg1/providers/Microsoft.Migrate/MigrateProjects/digot-migrate-proj1/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digot-migrate-rg1/providers/Microsoft.DataReplication/replicationFabrics/digotsrcappl1c4b4replicationfabric\",\"name\":\"digotsrcappl1c4b4replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"digot@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-08-01T21:55:03.2056721+00:00\",\"lastModifiedBy\":\"digot@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-08-01T21:55:03.2056721+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"4db45177-df37-4e9f-8aa8-d2565f90e839\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digot-migrate-rg1/providers/Microsoft.OffAzure/HyperVSites/digottgtappl15925site\",\"applianceName\":[\"digottgtappl1\"],\"cluster\":{\"clusterName\":\"aszhciclus2.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/680d0dad-59aa-4464-adf3-b34b2b427e8c/resourceGroups/aszhciclus2-rg/providers/Microsoft.AzureStackHCI/clusters/aszhciclus2\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5665492284875231607\",\"fabricContainerId\":\"14251834562717\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digot-migrate-rg1/providers/Microsoft.Migrate/MigrateProjects/digot-migrate-proj1/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digot-migrate-rg1/providers/Microsoft.DataReplication/replicationFabrics/digottgtappl19ba8replicationfabric\",\"name\":\"digottgtappl19ba8replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"digot@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-08-01T22:02:39.0789342+00:00\",\"lastModifiedBy\":\"digot@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-08-01T22:02:39.0789342+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"cd8682d8-70e0-4cd5-ae2f-ac2dda65cd2f\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-rg-0809/providers/Microsoft.OffAzure/HyperVSites/srini-src-08092529site\",\"fabricResourceId\":\"5536455427745022680\",\"fabricContainerId\":\"21221671483970\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-rg-0809/providers/Microsoft.Migrate/MigrateProjects/srini-mig-0809/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-rg-0809/providers/Microsoft.DataReplication/replicationFabrics/srini-src-08096300replicationfabric\",\"name\":\"srini-src-08096300replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vmmige2etest@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-08-09T23:39:03.3221548+00:00\",\"lastModifiedBy\":\"vmmige2etest@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-08-09T23:39:03.3221548+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"3a57a399-02e2-400d-bf27-26bfc7b7fd13\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-rg-0809/providers/Microsoft.OffAzure/HyperVSites/srini-tgt-08092526site\",\"applianceName\":[\"srini-tgt-0809\"],\"cluster\":{\"clusterName\":\"rn03-u0911.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/680d0dad-59aa-4464-adf3-b34b2b427e8c/resourceGroups/vjvmmigtest01RG/providers/Microsoft.AzureStackHCI/clusters/hciclu09011\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4615348363789312921\",\"fabricContainerId\":\"21248334953977\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-rg-0809/providers/Microsoft.Migrate/MigrateProjects/srini-mig-0809/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-rg-0809/providers/Microsoft.DataReplication/replicationFabrics/srini-tgt-0809d3d4replicationfabric\",\"name\":\"srini-tgt-0809d3d4replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vmmige2etest@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-08-10T00:02:36.0111861+00:00\",\"lastModifiedBy\":\"vmmige2etest@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-08-10T00:02:36.0111861+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"b84e53b7-75ab-402a-96f7-b712f0d841ee\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/testgd/providers/Microsoft.OffAzure/HyperVSites/tgta9901site\",\"applianceName\":[\"tgta\"],\"cluster\":{\"clusterName\":\"aszhciclus2.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/680d0dad-59aa-4464-adf3-b34b2b427e8c/resourceGroups/aszhciclus2-rg/providers/Microsoft.AzureStackHCI/clusters/aszhciclus2\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4623637347841233847\",\"fabricContainerId\":\"23383158452934\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/testgd/providers/Microsoft.Migrate/MigrateProjects/testgd/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/testgd/providers/Microsoft.DataReplication/replicationFabrics/tgtae62creplicationfabric\",\"name\":\"tgtae62creplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"gadeshpa@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-08-12T11:20:35.618606+00:00\",\"lastModifiedBy\":\"gadeshpa@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-08-12T11:20:35.618606+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"a52ed81a-23c6-4294-918f-102a64ed7c77\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/testgd/providers/Microsoft.OffAzure/HyperVSites/srca0154site\",\"fabricResourceId\":\"4797498839138228250\",\"fabricContainerId\":\"23425248825298\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/testgd/providers/Microsoft.Migrate/MigrateProjects/testgd/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/testgd/providers/Microsoft.DataReplication/replicationFabrics/srcaf5b7replicationfabric\",\"name\":\"srcaf5b7replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"gadeshpa@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-08-12T12:30:42.4679893+00:00\",\"lastModifiedBy\":\"gadeshpa@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-08-12T12:30:42.4679893+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"754c0769-50f3-4849-9c87-8d6a03114c9a\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/kerimdemo/providers/Microsoft.OffAzure/HyperVSites/KerimDemo8528site\",\"fabricResourceId\":\"5208783450605881193\",\"fabricContainerId\":\"1448775504323\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/kerimdemo/providers/Microsoft.Migrate/MigrateProjects/KerimDemo/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/kerimdemo/providers/Microsoft.DataReplication/replicationFabrics/KerimDemo573ereplicationfabric\",\"name\":\"KerimDemo573ereplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"kerimha@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-08-15T19:06:53.6789936+00:00\",\"lastModifiedBy\":\"kerimha@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-08-15T19:06:53.6789936+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"285d4528-1159-447c-86b6-18ff276b7758\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/kerimdemo/providers/Microsoft.OffAzure/HyperVSites/tgtkerimdemo0445site\",\"applianceName\":[\"tgtkerimdemo\"],\"cluster\":{\"clusterName\":\"rnu-0103.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjvmmigtestrgu01u03/providers/Microsoft.AzureStackHCI/clusters/RNU-0103\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4934838366318183720\",\"fabricContainerId\":\"1501679368294\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/kerimdemo/providers/Microsoft.Migrate/MigrateProjects/KerimDemo/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/kerimdemo/providers/Microsoft.DataReplication/replicationFabrics/tgtkerimdemo357ereplicationfabric\",\"name\":\"tgtkerimdemo357ereplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"kerimha@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-08-15T20:35:03.9680206+00:00\",\"lastModifiedBy\":\"kerimha@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-08-15T20:35:03.9680206+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"b6318cfc-6e0f-4b98-aa65-67b51c13eab1\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/ReplicationDemo/providers/Microsoft.OffAzure/HyperVSites/Repldemo9455site\",\"fabricResourceId\":\"5447224763064880380\",\"fabricContainerId\":\"1627048551502\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/ReplicationDemo/providers/Microsoft.Migrate/MigrateProjects/ReplicationDemo/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/ReplicationDemo/providers/Microsoft.DataReplication/replicationFabrics/Repldemo9401replicationfabric\",\"name\":\"Repldemo9401replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"kerimha@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-08-16T00:24:09.9261354+00:00\",\"lastModifiedBy\":\"kerimha@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-08-16T00:24:09.9261354+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"589cc605-bf5c-4a53-b60f-19d94dccb431\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/ReplicationDemo/providers/Microsoft.OffAzure/HyperVSites/tgtapprepl1842site\",\"applianceName\":[\"tgtapprepl\"],\"cluster\":{\"clusterName\":\"rnu-0103.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjvmmigtestrgu01u03/providers/Microsoft.AzureStackHCI/clusters/RNU-0103\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5355834785218217477\",\"fabricContainerId\":\"1875279945199\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/ReplicationDemo/providers/Microsoft.Migrate/MigrateProjects/ReplicationDemo/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/ReplicationDemo/providers/Microsoft.DataReplication/replicationFabrics/tgtapprepl33b1replicationfabric\",\"name\":\"tgtapprepl33b1replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"kerimha@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-08-16T07:17:53.108344+00:00\",\"lastModifiedBy\":\"kerimha@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-08-16T07:17:53.108344+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"32e65ba6-ab9a-438e-902d-c9e43a82212c\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/Rg/providers/Microsoft.OffAzure/HyperVSites/source5253site\",\"fabricResourceId\":\"4868016926001355686\",\"fabricContainerId\":\"3250118126166\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/Rg/providers/Microsoft.Migrate/MigrateProjects/demohypersource/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/Rg/providers/Microsoft.DataReplication/replicationFabrics/source5297replicationfabric\",\"name\":\"source5297replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"v-romagiri@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-08-17T21:09:06.6271466+00:00\",\"lastModifiedBy\":\"v-romagiri@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-08-17T21:09:06.6271466+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"30ee184f-bff9-4bba-9450-dd49fdec0316\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/helenprj2-rg/providers/Microsoft.OffAzure/HyperVSites/sourceApp11902site\",\"fabricResourceId\":\"5456884975501449295\",\"fabricContainerId\":\"7562403325137\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/helenprj2-rg/providers/Microsoft.Migrate/MigrateProjects/helenprj2/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/helenprj2-rg/providers/Microsoft.DataReplication/replicationFabrics/sourceApp14df6replicationfabric\",\"name\":\"sourceApp14df6replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"helenafework@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-08-22T20:36:07.6579744+00:00\",\"lastModifiedBy\":\"helenafework@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-08-22T20:36:07.6579744+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"eeceb5d6-3f9f-4b94-8075-cf92b966761d\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/helenprj2-rg/providers/Microsoft.OffAzure/HyperVSites/targetApp11388site\",\"applianceName\":[\"targetApp1\"],\"cluster\":{\"clusterName\":\"aszhciclus2.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/680d0dad-59aa-4464-adf3-b34b2b427e8c/resourceGroups/aszhciclus2-rg/providers/Microsoft.AzureStackHCI/clusters/aszhciclus2\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5446047805536646614\",\"fabricContainerId\":\"7594055643267\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/helenprj2-rg/providers/Microsoft.Migrate/MigrateProjects/helenprj2/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/helenprj2-rg/providers/Microsoft.DataReplication/replicationFabrics/targetApp17c53replicationfabric\",\"name\":\"targetApp17c53replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"helenafework@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-08-22T22:09:12.5790017+00:00\",\"lastModifiedBy\":\"helenafework@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-08-22T22:09:12.5790017+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"c653a7c9-b8ec-4321-8caf-13af79da565c\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjSep02/providers/Microsoft.OffAzure/HyperVSites/vjSep02src1553site\",\"fabricResourceId\":\"4837350801851787209\",\"fabricContainerId\":\"17125035230482\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjSep02/providers/Microsoft.Migrate/MigrateProjects/vjSep02prj/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjSep02/providers/Microsoft.DataReplication/replicationFabrics/vjSep02src61efreplicationfabric\",\"name\":\"vjSep02src61efreplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vajagdal@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-09-02T22:33:30.3949007+00:00\",\"lastModifiedBy\":\"vajagdal@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-09-02T22:33:30.3949007+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"c24dccc4-aa41-4a67-9792-8f68ab08d6cf\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjSep02/providers/Microsoft.OffAzure/HyperVSites/vjSep02tgt2190site\",\"applianceName\":[\"vjSep02tgt\"],\"cluster\":{\"clusterName\":\"rn03u0507.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/680d0dad-59aa-4464-adf3-b34b2b427e8c/resourceGroups/vmmigtestrg0507hciclu/providers/Microsoft.AzureStackHCI/clusters/RN03U0507\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5361441080817339588\",\"fabricContainerId\":\"17145138059221\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjSep02/providers/Microsoft.Migrate/MigrateProjects/vjSep02prj/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjSep02/providers/Microsoft.DataReplication/replicationFabrics/vjSep02tgtdb16replicationfabric\",\"name\":\"vjSep02tgtdb16replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vajagdal@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-09-02T22:47:23.0824884+00:00\",\"lastModifiedBy\":\"vajagdal@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-09-02T22:47:23.0824884+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"3fed6991-72c0-458f-9862-2549191972c2\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjsep06/providers/Microsoft.OffAzure/HyperVSites/vjsep06src0723site\",\"fabricResourceId\":\"5012351080318462353\",\"fabricContainerId\":\"20449800472377\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjsep06/providers/Microsoft.Migrate/MigrateProjects/vjsep06prj/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjsep06/providers/Microsoft.DataReplication/replicationFabrics/vjsep06src2fadreplicationfabric\",\"name\":\"vjsep06src2fadreplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vajagdal@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-09-06T18:54:40.2524976+00:00\",\"lastModifiedBy\":\"vajagdal@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-09-06T18:59:30.1268669+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"a8b2d6fb-2300-46d0-9fc5-04313f116bcb\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjsep06/providers/Microsoft.OffAzure/HyperVSites/vjsep06tgt0086site\",\"applianceName\":[\"vjsep06tgt\"],\"cluster\":{\"clusterName\":\"rn03u0507.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/680d0dad-59aa-4464-adf3-b34b2b427e8c/resourceGroups/vmmigtestrg0507hciclu/providers/Microsoft.AzureStackHCI/clusters/RN03U0507\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5102616863548036859\",\"fabricContainerId\":\"20484743536599\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjsep06/providers/Microsoft.Migrate/MigrateProjects/vjsep06prj/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjsep06/providers/Microsoft.DataReplication/replicationFabrics/vjsep06tgt501areplicationfabric\",\"name\":\"vjsep06tgt501areplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vajagdal@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-09-06T19:33:24.4906868+00:00\",\"lastModifiedBy\":\"vajagdal@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-09-06T19:33:24.4906868+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"8e2fbf50-32ab-45be-84af-8ebe338b0f51\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vdemanc-rg3/providers/Microsoft.OffAzure/HyperVSites/sourceapp23719site\",\"fabricResourceId\":\"5025509946598342480\",\"fabricContainerId\":\"23014459254014\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vdemanc-rg3/providers/Microsoft.Migrate/MigrateProjects/migrate-project2/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vdemanc-rg3/providers/Microsoft.DataReplication/replicationFabrics/sourceapp2f6careplicationfabric\",\"name\":\"sourceapp2f6careplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"v-demanc@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-09-09T18:09:01.4928178+00:00\",\"lastModifiedBy\":\"v-demanc@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-09-09T18:09:01.4928178+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"ce0bbf92-eb2d-4bc2-9866-d68a45de6e0d\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vdemanc-rg3/providers/Microsoft.OffAzure/HyperVSites/targetappl27367site\",\"applianceName\":[\"targetappl2\"],\"cluster\":{\"clusterName\":\"rnu-0103.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjvmmigtestrgu01u03/providers/Microsoft.AzureStackHCI/clusters/RNU-0103\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5459184280289394578\",\"fabricContainerId\":\"23045439669708\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vdemanc-rg3/providers/Microsoft.Migrate/MigrateProjects/migrate-project2/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vdemanc-rg3/providers/Microsoft.DataReplication/replicationFabrics/targetappl28037replicationfabric\",\"name\":\"targetappl28037replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"v-demanc@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-09-09T18:41:14.1336729+00:00\",\"lastModifiedBy\":\"v-demanc@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-09-09T18:41:14.1336729+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"adc33267-b401-4212-aa2a-38802a5d5e48\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-rg-0912/providers/Microsoft.OffAzure/HyperVSites/srini-src-09124682site\",\"fabricResourceId\":\"4761065675387253351\",\"fabricContainerId\":\"25599015193445\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-rg-0912/providers/Microsoft.Migrate/MigrateProjects/srini-mig-0912/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-rg-0912/providers/Microsoft.DataReplication/replicationFabrics/srini-src-0912dd08replicationfabric\",\"name\":\"srini-src-0912dd08replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vmmige2etest@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-09-12T18:17:32.4828004+00:00\",\"lastModifiedBy\":\"vmmige2etest@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-09-12T18:17:32.4828004+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"2dc633f9-80c5-4cc3-8019-b4caa050c27b\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-rg-0912/providers/Microsoft.OffAzure/HyperVSites/srini-tgt-09122611site\",\"applianceName\":[\"srini-tgt-0912\"],\"cluster\":{\"clusterName\":\"RN03-U0911.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/680d0dad-59aa-4464-adf3-b34b2b427e8c/resourceGroups/vjvmmigtest01RG/providers/Microsoft.AzureStackHCI/clusters/hciclu09011\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5531406351705977849\",\"fabricContainerId\":\"25617835093293\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-rg-0912/providers/Microsoft.Migrate/MigrateProjects/srini-mig-0912/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-rg-0912/providers/Microsoft.DataReplication/replicationFabrics/srini-tgt-09129491replicationfabric\",\"name\":\"srini-tgt-09129491replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vmmige2etest@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-09-12T18:27:53.3498897+00:00\",\"lastModifiedBy\":\"vmmige2etest@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-09-12T18:27:53.3498897+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"13b4f0cb-d6a3-4743-a2da-672ad3e1c8a6\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vdemanc-rg4/providers/Microsoft.OffAzure/HyperVSites/sourceapp36236site\",\"fabricResourceId\":\"5135183996031135947\",\"fabricContainerId\":\"25832783384415\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vdemanc-rg4/providers/Microsoft.Migrate/MigrateProjects/migrate-project3/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vdemanc-rg4/providers/Microsoft.DataReplication/replicationFabrics/sourceapp3e0a6replicationfabric\",\"name\":\"sourceapp3e0a6replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"v-demanc@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-09-13T00:26:08.1901166+00:00\",\"lastModifiedBy\":\"v-demanc@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-09-13T00:26:08.1901166+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"842e8af6-ea17-4135-963d-99248c3253e1\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vdemanc-rg4/providers/Microsoft.OffAzure/HyperVSites/targetappl31192site\",\"applianceName\":[\"targetappl3\"],\"cluster\":{\"clusterName\":\"rnu-0103.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjvmmigtestrgu01u03/providers/Microsoft.AzureStackHCI/clusters/RNU-0103\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4698919172953770742\",\"fabricContainerId\":\"25845149179046\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vdemanc-rg4/providers/Microsoft.Migrate/MigrateProjects/migrate-project3/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vdemanc-rg4/providers/Microsoft.DataReplication/replicationFabrics/targetappl3b346replicationfabric\",\"name\":\"targetappl3b346replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"v-demanc@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-09-13T00:46:44.789747+00:00\",\"lastModifiedBy\":\"v-demanc@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-09-13T00:46:44.789747+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"4c49edd8-07b4-4393-bd0c-2378e11e8f3b\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-rg-0913/providers/Microsoft.OffAzure/HyperVSites/srini-tg2-09133070site\",\"applianceName\":[\"srini-tg2-0913\"],\"cluster\":{\"clusterName\":\"rn03-u0911.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/680d0dad-59aa-4464-adf3-b34b2b427e8c/resourceGroups/vjvmmigtest01RG/providers/Microsoft.AzureStackHCI/clusters/hciclu09011\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4869244093073059288\",\"fabricContainerId\":\"26600381199031\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-rg-0913/providers/Microsoft.Migrate/MigrateProjects/srini-mig-0913/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-rg-0913/providers/Microsoft.DataReplication/replicationFabrics/srini-tg2-09130c3creplicationfabric\",\"name\":\"srini-tg2-09130c3creplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vmmige2etest@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-09-13T21:45:26.3039532+00:00\",\"lastModifiedBy\":\"vmmige2etest@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-09-13T21:45:26.3039532+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"679ceae1-1cbf-4fa3-b651-f5f45fa36ed1\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-rg-0913/providers/Microsoft.OffAzure/HyperVSites/srini-sr2-09139790site\",\"fabricResourceId\":\"5738461958602812129\",\"fabricContainerId\":\"26613331353623\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-rg-0913/providers/Microsoft.Migrate/MigrateProjects/srini-mig-0913/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-rg-0913/providers/Microsoft.DataReplication/replicationFabrics/srini-sr2-0913abb1replicationfabric\",\"name\":\"srini-sr2-0913abb1replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vmmige2etest@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-09-13T21:47:43.7922098+00:00\",\"lastModifiedBy\":\"vmmige2etest@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-09-13T21:47:43.7922098+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"94853c94-d1c7-4604-b369-d847e2db2509\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vdemanc-rg5/providers/Microsoft.OffAzure/HyperVSites/sourceapp48895site\",\"fabricResourceId\":\"5045388137682254996\",\"fabricContainerId\":\"26607243738393\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vdemanc-rg5/providers/Microsoft.Migrate/MigrateProjects/migrate-project4/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vdemanc-rg5/providers/Microsoft.DataReplication/replicationFabrics/sourceapp492b9replicationfabric\",\"name\":\"sourceapp492b9replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"v-demanc@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-09-13T21:56:53.0794166+00:00\",\"lastModifiedBy\":\"v-demanc@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-09-13T21:59:46.0616712+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"f05d1272-3056-45ee-9397-6482e2bba300\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vdemanc-rg5/providers/Microsoft.OffAzure/HyperVSites/targetappl45017site\",\"applianceName\":[\"targetappl4\"],\"cluster\":{\"clusterName\":\"rnu-0103.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjvmmigtestrgu01u03/providers/Microsoft.AzureStackHCI/clusters/RNU-0103\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5039018183032115826\",\"fabricContainerId\":\"26649318935974\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vdemanc-rg5/providers/Microsoft.Migrate/MigrateProjects/migrate-project4/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vdemanc-rg5/providers/Microsoft.DataReplication/replicationFabrics/targetappl4f8c1replicationfabric\",\"name\":\"targetappl4f8c1replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"v-demanc@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-09-13T22:47:41.8297858+00:00\",\"lastModifiedBy\":\"v-demanc@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-09-13T22:47:41.8297858+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"f8c9f39a-9aaf-41e5-9e1c-bf972d5cdd31\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vdemanc-rg1/providers/Microsoft.OffAzure/HyperVSites/sourceapp51235site\",\"fabricResourceId\":\"4748371462715995034\",\"fabricContainerId\":\"27300249464568\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vdemanc-rg1/providers/Microsoft.Migrate/MigrateProjects/migrate-project5/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vdemanc-rg1/providers/Microsoft.DataReplication/replicationFabrics/sourceapp51661replicationfabric\",\"name\":\"sourceapp51661replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"v-demanc@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-09-14T17:32:55.2506678+00:00\",\"lastModifiedBy\":\"v-demanc@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-09-14T17:32:55.2506678+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"5756da1b-6c98-46b8-9a3e-897e0786934d\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vdemanc-rg1/providers/Microsoft.OffAzure/HyperVSites/targetapp52771site\",\"applianceName\":[\"targetapp5\"],\"cluster\":{\"clusterName\":\"rnu-0103.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjvmmigtestrgu01u03/providers/Microsoft.AzureStackHCI/clusters/RNU-0103\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5095942379925854747\",\"fabricContainerId\":\"27383520493655\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vdemanc-rg1/providers/Microsoft.Migrate/MigrateProjects/migrate-project5/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vdemanc-rg1/providers/Microsoft.DataReplication/replicationFabrics/targetapp5608dreplicationfabric\",\"name\":\"targetapp5608dreplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"v-demanc@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-09-14T19:11:22.479642+00:00\",\"lastModifiedBy\":\"v-demanc@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-09-14T19:11:22.479642+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"e34edb23-95de-4b0b-9f43-fd81a8b1e917\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etest/providers/Microsoft.OffAzure/HyperVSites/HyperV-1ba55d8site\",\"fabricResourceId\":\"5407580562117286691\",\"fabricContainerId\":\"31985864312511\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etest/providers/Microsoft.Migrate/MigrateProjects/aszmigtest-1ba55d8/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etest/providers/Microsoft.DataReplication/replicationFabrics/HyperV-1ba55d80830replicationfabric\",\"name\":\"HyperV-1ba55d80830replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vmmige2etest@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-09-20T03:21:01.126725+00:00\",\"lastModifiedBy\":\"vmmige2etest@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-09-20T03:21:01.126725+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"627280c4-3685-4833-b070-54b89e83c6e6\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etest/providers/Microsoft.OffAzure/HyperVSites/asz-1ba55d8site\",\"applianceName\":[\"asz-1ba55d8\"],\"cluster\":{\"clusterName\":\"rn03-u0911.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/680d0dad-59aa-4464-adf3-b34b2b427e8c/resourceGroups/vjvmmigtest01RG/providers/Microsoft.AzureStackHCI/clusters/hciclu09011\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5202561941053276356\",\"fabricContainerId\":\"32006764111158\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etest/providers/Microsoft.Migrate/MigrateProjects/aszmigtest-1ba55d8/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etest/providers/Microsoft.DataReplication/replicationFabrics/asz-1ba55d84c63replicationfabric\",\"name\":\"asz-1ba55d84c63replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vmmige2etest@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-09-20T03:36:44.773948+00:00\",\"lastModifiedBy\":\"vmmige2etest@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-09-20T03:36:44.773948+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"e38123d7-c299-4511-8656-52a19860230d\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjsep19rg/providers/Microsoft.OffAzure/HyperVSites/SRCvjsep190883site\",\"fabricResourceId\":\"4976973029423784919\",\"fabricContainerId\":\"32482241779530\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjsep19rg/providers/Microsoft.Migrate/MigrateProjects/vjsep19prj01/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjsep19rg/providers/Microsoft.DataReplication/replicationFabrics/SRCvjsep19f886replicationfabric\",\"name\":\"SRCvjsep19f886replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vajagdal@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-09-20T17:29:34.6710391+00:00\",\"lastModifiedBy\":\"vajagdal@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-09-20T17:29:34.6710391+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"27591e8d-cbee-485b-b4de-7eb04089cda5\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjsep19rg/providers/Microsoft.OffAzure/HyperVSites/tgtsep20t15657site\",\"applianceName\":[\"tgtsep20t1\"],\"cluster\":{\"clusterName\":\"clrp09u15.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/clrp09u15RG/providers/Microsoft.AzureStackHCI/clusters/clrp09u15hci\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5213985217334288013\",\"fabricContainerId\":\"32628921864280\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjsep19rg/providers/Microsoft.Migrate/MigrateProjects/vjsep19prj01/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjsep19rg/providers/Microsoft.DataReplication/replicationFabrics/tgtsep20t1dcd4replicationfabric\",\"name\":\"tgtsep20t1dcd4replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vajagdal@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-09-20T21:12:46.4527737+00:00\",\"lastModifiedBy\":\"vajagdal@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-09-20T21:12:46.4527737+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"d9928b1a-aa98-4051-9616-bf0bc1b6f457\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestdev/providers/Microsoft.OffAzure/HyperVSites/HyperV-1e73387site\",\"fabricResourceId\":\"4634673065002961690\",\"fabricContainerId\":\"33421462183741\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestdev/providers/Microsoft.Migrate/MigrateProjects/aszmigtest-1e73387/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestdev/providers/Microsoft.DataReplication/replicationFabrics/HyperV-1e73387654freplicationfabric\",\"name\":\"HyperV-1e73387654freplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vmmige2etest@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-09-21T18:54:37.1998232+00:00\",\"lastModifiedBy\":\"vmmige2etest@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-09-21T18:54:37.1998232+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"6d5eea41-ed6d-407b-b7d4-86cc1d86e330\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestdev/providers/Microsoft.OffAzure/HyperVSites/asz-1e73387site\",\"applianceName\":[\"asz-1e73387\"],\"cluster\":{\"clusterName\":\"rn03-u0911.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/680d0dad-59aa-4464-adf3-b34b2b427e8c/resourceGroups/vjvmmigtest01RG/providers/Microsoft.AzureStackHCI/clusters/hciclu09011\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4646568494804953665\",\"fabricContainerId\":\"33406429515188\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestdev/providers/Microsoft.Migrate/MigrateProjects/aszmigtest-1e73387/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestdev/providers/Microsoft.DataReplication/replicationFabrics/asz-1e733870ecfreplicationfabric\",\"name\":\"asz-1e733870ecfreplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vmmige2etest@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-09-21T19:09:53.0850192+00:00\",\"lastModifiedBy\":\"vmmige2etest@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-09-21T19:09:53.0850192+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"04c9ecb2-ea2a-409a-b475-b43b0a9ff3f2\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/RGKerimha/providers/Microsoft.OffAzure/HyperVSites/Kerimha9227465site\",\"fabricResourceId\":\"4655290631030697138\",\"fabricContainerId\":\"34502264407745\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/RGKerimha/providers/Microsoft.Migrate/MigrateProjects/Kerimha922/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/RGKerimha/providers/Microsoft.DataReplication/replicationFabrics/Kerimha922a79dreplicationfabric\",\"name\":\"Kerimha922a79dreplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"kerimha@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-09-23T01:14:58.3046262+00:00\",\"lastModifiedBy\":\"kerimha@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-09-23T01:14:58.3046262+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"341c6fd7-5431-453d-99ae-141f79f99af6\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/RGKerimha/providers/Microsoft.OffAzure/HyperVSites/testasz19696site\",\"applianceName\":[\"testasz1\"],\"cluster\":{\"clusterName\":\"rn03-u0911.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/680d0dad-59aa-4464-adf3-b34b2b427e8c/resourceGroups/vjvmmigtest01RG/providers/Microsoft.AzureStackHCI/clusters/hciclu09011\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4989236532500787159\",\"fabricContainerId\":\"34653814799364\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/RGKerimha/providers/Microsoft.Migrate/MigrateProjects/Kerimha922/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/RGKerimha/providers/Microsoft.DataReplication/replicationFabrics/testasz1ac39replicationfabric\",\"name\":\"testasz1ac39replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"kerimha@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-09-23T05:08:32.4096114+00:00\",\"lastModifiedBy\":\"kerimha@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-09-23T05:08:32.4096114+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"b57ec743-fb12-49f9-9f6b-14ed5eb4fa58\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gdbbsep22/providers/Microsoft.OffAzure/HyperVSites/gdsep22src4654site\",\"fabricResourceId\":\"5330567691742660419\",\"fabricContainerId\":\"4819329032916\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gdbbsep22/providers/Microsoft.Migrate/MigrateProjects/gdbbsep22/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gdbbsep22/providers/Microsoft.DataReplication/replicationFabrics/gdsep22src5309replicationfabric\",\"name\":\"gdsep22src5309replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"gadeshpa@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-09-29T16:17:26.0820757+00:00\",\"lastModifiedBy\":\"gadeshpa@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-09-29T16:17:26.0820757+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"88b53b04-71bb-484b-b5ac-04732a9c5144\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gdbbsep22/providers/Microsoft.OffAzure/HyperVSites/gdsep22tgt4017site\",\"applianceName\":[\"gdsep22tgt\"],\"cluster\":{\"clusterName\":\"rn03u0507.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/680d0dad-59aa-4464-adf3-b34b2b427e8c/resourceGroups/vmmigtestrg0507hciclu/providers/Microsoft.AzureStackHCI/clusters/RN03U0507\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5209382444250512132\",\"fabricContainerId\":\"4821574326825\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gdbbsep22/providers/Microsoft.Migrate/MigrateProjects/gdbbsep22/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gdbbsep22/providers/Microsoft.DataReplication/replicationFabrics/gdsep22tgt1ae6replicationfabric\",\"name\":\"gdsep22tgt1ae6replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"gadeshpa@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-09-29T17:01:52.068398+00:00\",\"lastModifiedBy\":\"gadeshpa@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-09-29T17:01:52.068398+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"2a6fdc5e-2903-4c49-886e-ed75caba3650\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/929KerimhaRG/providers/Microsoft.OffAzure/HyperVSites/kerimha9292343site\",\"fabricResourceId\":\"5496969913756015710\",\"fabricContainerId\":\"4919869190551\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/929KerimhaRG/providers/Microsoft.Migrate/MigrateProjects/kerimhabugbash02/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/929KerimhaRG/providers/Microsoft.DataReplication/replicationFabrics/kerimha9292251replicationfabric\",\"name\":\"kerimha9292251replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"kerimha@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-09-29T19:45:43.3220855+00:00\",\"lastModifiedBy\":\"kerimha@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-09-29T19:45:43.3220855+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"7bd85aaf-6f89-44f3-985c-d0a9a2d01a6c\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-rg-0929/providers/Microsoft.OffAzure/HyperVSites/srini-src-09297972site\",\"fabricResourceId\":\"4968437450198768303\",\"fabricContainerId\":\"4972457576635\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-rg-0929/providers/Microsoft.Migrate/MigrateProjects/srini-mig-0929/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-rg-0929/providers/Microsoft.DataReplication/replicationFabrics/srini-src-09293c52replicationfabric\",\"name\":\"srini-src-09293c52replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"srganesa@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-09-29T20:32:38.7339673+00:00\",\"lastModifiedBy\":\"srganesa@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-09-29T20:32:38.7339673+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"b9fc3808-809d-4f1c-a9bc-5225ba053cbd\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/yanszha-test1/providers/Microsoft.OffAzure/HyperVSites/srcyanszha0715site\",\"fabricResourceId\":\"5700572643262740488\",\"fabricContainerId\":\"4968943551401\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/yanszha-test1/providers/Microsoft.Migrate/MigrateProjects/bugbash2/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/yanszha-test1/providers/Microsoft.DataReplication/replicationFabrics/srcyanszha4f1breplicationfabric\",\"name\":\"srcyanszha4f1breplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"yanszha@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-09-29T20:47:16.6870934+00:00\",\"lastModifiedBy\":\"yanszha@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-09-29T20:47:16.6870934+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"88360c58-4523-42aa-b5c9-71664885ed72\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-rg-0929/providers/Microsoft.OffAzure/HyperVSites/srini-sr2-09290925site\",\"fabricResourceId\":\"4803727971455470680\",\"fabricContainerId\":\"4984978417027\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-rg-0929/providers/Microsoft.Migrate/MigrateProjects/srini-mig-0929/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-rg-0929/providers/Microsoft.DataReplication/replicationFabrics/srini-sr2-09290a59replicationfabric\",\"name\":\"srini-sr2-09290a59replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"srganesa@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-09-29T21:14:00.7993671+00:00\",\"lastModifiedBy\":\"srganesa@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-09-29T21:14:00.7993671+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"e31a725a-06d3-4ccf-8e74-ed803e3d4e6e\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/929KerimhaRG/providers/Microsoft.OffAzure/HyperVSites/kerimha929tar5100site\",\"applianceName\":[\"kerimha929tar\"],\"cluster\":{\"clusterName\":\"rn03u0507.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/680d0dad-59aa-4464-adf3-b34b2b427e8c/resourceGroups/vmmigtestrg0507hciclu/providers/Microsoft.AzureStackHCI/clusters/RN03U0507\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5534649974179656282\",\"fabricContainerId\":\"4998972501669\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/929KerimhaRG/providers/Microsoft.Migrate/MigrateProjects/kerimhabugbash02/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/929KerimhaRG/providers/Microsoft.DataReplication/replicationFabrics/kerimha929tar959creplicationfabric\",\"name\":\"kerimha929tar959creplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"kerimha@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-09-29T21:37:19.1527936+00:00\",\"lastModifiedBy\":\"kerimha@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-09-29T21:37:19.1527936+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"c5a3cd14-4609-4bd0-8cf5-fa86e305630f\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-rg-0929/providers/Microsoft.OffAzure/HyperVSites/srini-tgt-09292031site\",\"applianceName\":[\"srini-tgt-0929\"],\"cluster\":{\"clusterName\":\"rnu-0103.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjvmmigtestrgu01u03/providers/Microsoft.AzureStackHCI/clusters/RNU-0103\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5462943355784908052\",\"fabricContainerId\":\"4999384987368\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-rg-0929/providers/Microsoft.Migrate/MigrateProjects/srini-mig-0929/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srini-rg-0929/providers/Microsoft.DataReplication/replicationFabrics/srini-tgt-09291ca7replicationfabric\",\"name\":\"srini-tgt-09291ca7replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"srganesa@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-09-29T21:38:01.2868411+00:00\",\"lastModifiedBy\":\"srganesa@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-09-29T21:38:01.2868411+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"60fc6413-2987-4d1b-8e5e-01359249173b\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/yanszha-test1/providers/Microsoft.OffAzure/HyperVSites/tgtyanszha0312site\",\"applianceName\":[\"tgtyanszha\"],\"cluster\":{\"clusterName\":\"rnu-0103.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjvmmigtestrgu01u03/providers/Microsoft.AzureStackHCI/clusters/RNU-0103\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5556080226716115987\",\"fabricContainerId\":\"5056395028517\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/yanszha-test1/providers/Microsoft.Migrate/MigrateProjects/bugbash2/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/yanszha-test1/providers/Microsoft.DataReplication/replicationFabrics/tgtyanszhaf35freplicationfabric\",\"name\":\"tgtyanszhaf35freplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"yanszha@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-09-29T22:52:32.2939922+00:00\",\"lastModifiedBy\":\"yanszha@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-09-29T22:52:32.2939922+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"b785f3fa-090e-4ce0-afc5-a182184fb77a\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digotbb-02/providers/Microsoft.OffAzure/HyperVSites/digotsrcap1bb24945site\",\"fabricResourceId\":\"5539437500478911482\",\"fabricContainerId\":\"5844968588317\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digotbb-02/providers/Microsoft.Migrate/MigrateProjects/digotbb02srca1/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digotbb-02/providers/Microsoft.DataReplication/replicationFabrics/digotsrcap1bb2e0cbreplicationfabric\",\"name\":\"digotsrcap1bb2e0cbreplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"digot@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-09-30T21:27:33.3013586+00:00\",\"lastModifiedBy\":\"digot@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-09-30T21:27:33.3013586+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"470a3ed7-3a81-4b8a-90fd-cc738a5bf3f1\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/saisa-vmmig-bb-src-rg/providers/Microsoft.OffAzure/HyperVSites/saisa-src-appl5226site\",\"fabricResourceId\":\"5443227426547711703\",\"fabricContainerId\":\"5846753262701\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/saisa-vmmig-bb-src-rg/providers/Microsoft.Migrate/MigrateProjects/saisa-vmmig-bb-proj/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/saisa-vmmig-bb-src-rg/providers/Microsoft.DataReplication/replicationFabrics/saisa-src-apple15breplicationfabric\",\"name\":\"saisa-src-apple15breplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"saisa@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-09-30T21:30:31.2921361+00:00\",\"lastModifiedBy\":\"saisa@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-09-30T21:30:31.2921361+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"13add9e2-3f72-4ff9-8e66-c5ba31926428\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digotbb-02/providers/Microsoft.OffAzure/HyperVSites/digbb2tar010860site\",\"applianceName\":[\"digbb2tar01\"],\"cluster\":{\"clusterName\":\"rnu-0103.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjvmmigtestrgu01u03/providers/Microsoft.AzureStackHCI/clusters/RNU-0103\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5762706957386242530\",\"fabricContainerId\":\"6019980864908\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digotbb-02/providers/Microsoft.Migrate/MigrateProjects/digotbb02srca1/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digotbb-02/providers/Microsoft.DataReplication/replicationFabrics/digbb2tar014779replicationfabric\",\"name\":\"digbb2tar014779replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"digot@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-10-01T01:38:30.9097028+00:00\",\"lastModifiedBy\":\"digot@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-10-01T01:38:30.9097028+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"d2ea83ff-cb14-4287-9a95-481f06d39162\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/saisa-vmmig-bb-src-rg/providers/Microsoft.OffAzure/HyperVSites/saisa-tgta1070site\",\"applianceName\":[\"saisa-tgta\"],\"cluster\":{\"clusterName\":\"rn03-u0911.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/680d0dad-59aa-4464-adf3-b34b2b427e8c/resourceGroups/vjvmmigtest01RG/providers/Microsoft.AzureStackHCI/clusters/hciclu09011\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4794023618657551359\",\"fabricContainerId\":\"6029605323250\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/saisa-vmmig-bb-src-rg/providers/Microsoft.Migrate/MigrateProjects/saisa-vmmig-bb-proj/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/saisa-vmmig-bb-src-rg/providers/Microsoft.DataReplication/replicationFabrics/saisa-tgta2a7freplicationfabric\",\"name\":\"saisa-tgta2a7freplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"saisa@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-10-01T02:15:00.9110231+00:00\",\"lastModifiedBy\":\"saisa@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-10-01T02:15:00.9110231+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"cb1da9df-5b01-450c-af1d-e0d979d908f5\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gdoct22/providers/Microsoft.OffAzure/HyperVSites/gdoctsrc4784site\",\"fabricResourceId\":\"4975451751598369247\",\"fabricContainerId\":\"7999499682445\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gdoct22/providers/Microsoft.Migrate/MigrateProjects/gdoct22/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gdoct22/providers/Microsoft.DataReplication/replicationFabrics/gdoctsrcde0areplicationfabric\",\"name\":\"gdoctsrcde0areplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"gadeshpa@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-10-03T08:58:06.7140716+00:00\",\"lastModifiedBy\":\"gadeshpa@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-10-03T08:58:06.7140716+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"41459500-9cd3-4fb0-a0e0-0ea65523d9ae\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gdoct22/providers/Microsoft.OffAzure/HyperVSites/gdocttgt4147site\",\"applianceName\":[\"gdocttgt\"],\"cluster\":{\"clusterName\":\"rn03-u0911.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/680d0dad-59aa-4464-adf3-b34b2b427e8c/resourceGroups/vjvmmigtest01RG/providers/Microsoft.AzureStackHCI/clusters/hciclu09011\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5742261956044494080\",\"fabricContainerId\":\"8701914754344\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gdoct22/providers/Microsoft.Migrate/MigrateProjects/gdoct22/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gdoct22/providers/Microsoft.DataReplication/replicationFabrics/gdocttgtbb07replicationfabric\",\"name\":\"gdocttgtbb07replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"gadeshpa@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-10-04T04:49:08.521374+00:00\",\"lastModifiedBy\":\"gadeshpa@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-10-04T04:49:08.521374+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"08082b3f-86d2-43ad-98f3-b9dbf8bedc83\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/crcampb-clustertest/providers/Microsoft.OffAzure/HyperVSites/srcAppCrcampb19425site\",\"fabricResourceId\":\"4876702208148122431\",\"fabricContainerId\":\"9352854344569\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/crcampb-clustertest/providers/Microsoft.Migrate/MigrateProjects/crcampbclustertest1/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/crcampb-clustertest/providers/Microsoft.DataReplication/replicationFabrics/srcAppCrcampb17773replicationfabric\",\"name\":\"srcAppCrcampb17773replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"crcampb@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-10-04T22:33:39.5144667+00:00\",\"lastModifiedBy\":\"crcampb@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-10-04T22:33:39.5144667+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"1a745e37-c8db-4678-8179-28b2e35f03cc\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/crcampb-clustertest/providers/Microsoft.OffAzure/HyperVSites/tgtcrcampb11397site\",\"applianceName\":[\"tgtcrcampb1\"],\"cluster\":{\"clusterName\":\"rn03-u0911.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/680d0dad-59aa-4464-adf3-b34b2b427e8c/resourceGroups/vjvmmigtest01RG/providers/Microsoft.AzureStackHCI/clusters/hciclu09011\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5078029423227461175\",\"fabricContainerId\":\"9374751952716\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/crcampb-clustertest/providers/Microsoft.Migrate/MigrateProjects/crcampbclustertest1/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/crcampb-clustertest/providers/Microsoft.DataReplication/replicationFabrics/tgtcrcampb1ee9creplicationfabric\",\"name\":\"tgtcrcampb1ee9creplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"crcampb@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-10-04T23:30:31.198779+00:00\",\"lastModifiedBy\":\"crcampb@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-10-04T23:30:31.198779+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"add6d239-5469-4f19-bf3d-2c06e31815f5\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digotbb-02/providers/Microsoft.OffAzure/HyperVSites/digap1te12846site\",\"fabricResourceId\":\"5699679616278909497\",\"fabricContainerId\":\"15719564552675\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digotbb-02/providers/Microsoft.Migrate/MigrateProjects/digotbb02srca1/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digotbb-02/providers/Microsoft.DataReplication/replicationFabrics/digap1te1a457replicationfabric\",\"name\":\"digap1te1a457replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"digot@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-10-12T07:24:33.0265925+00:00\",\"lastModifiedBy\":\"digot@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-10-12T07:24:33.0265925+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"c3d66c49-1013-4a14-a804-1074cd70e11b\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/yansheng-rg1/providers/Microsoft.OffAzure/HyperVSites/gdtestmigrate2014site\",\"fabricResourceId\":\"5337909135416912969\",\"fabricContainerId\":\"16078046429238\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/yanszha-test1/providers/Microsoft.Migrate/MigrateProjects/migrationtest1/Solutions/Servers-Migration-ServerMigration\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/yanszha-test1/providers/Microsoft.DataReplication/replicationFabrics/hypervtest14\",\"name\":\"hypervtest14\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"yanszha@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-10-12T17:42:39.5916091+00:00\",\"lastModifiedBy\":\"yanszha@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-10-12T17:42:39.5916091+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"17157c86-e072-49e5-b053-89f9e9c27ff8\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjoct12T1RG/providers/Microsoft.OffAzure/HyperVSites/vajSrc12130site\",\"fabricResourceId\":\"5324908915053657222\",\"fabricContainerId\":\"16106171065734\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjoct12T1RG/providers/Microsoft.Migrate/MigrateProjects/vjoct12T1prj/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjoct12T1RG/providers/Microsoft.DataReplication/replicationFabrics/vajSrc1359areplicationfabric\",\"name\":\"vajSrc1359areplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vajagdal@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-10-12T18:08:57.0868404+00:00\",\"lastModifiedBy\":\"vajagdal@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-10-12T18:08:57.0868404+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"b40d5b0d-7019-4259-8ad6-a381a3f3c22a\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjoct12T1RG/providers/Microsoft.OffAzure/HyperVSites/vajT7245site\",\"applianceName\":[\"vajT\"],\"cluster\":{\"clusterName\":\"clrp09u15.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/clrp09u15RG/providers/Microsoft.AzureStackHCI/clusters/clrp09u15hci\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4780975735127759629\",\"fabricContainerId\":\"16133618085022\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjoct12T1RG/providers/Microsoft.Migrate/MigrateProjects/vjoct12T1prj/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjoct12T1RG/providers/Microsoft.DataReplication/replicationFabrics/vajTc4b7replicationfabric\",\"name\":\"vajTc4b7replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vajagdal@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-10-12T18:54:42.2208999+00:00\",\"lastModifiedBy\":\"vajagdal@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-10-12T18:54:42.2208999+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"bd1679d4-c73c-4922-885d-9adc37495503\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/yanszha-itest1/providers/Microsoft.OffAzure/HyperVSites/srcyanszha0157site\",\"fabricResourceId\":\"5269993577661233620\",\"fabricContainerId\":\"20802111232827\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/yanszha-itest1/providers/Microsoft.Migrate/MigrateProjects/it2/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/yanszha-itest1/providers/Microsoft.DataReplication/replicationFabrics/srcyanszha5e23replicationfabric\",\"name\":\"srcyanszha5e23replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"yanszha@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-10-18T04:56:08.5836144+00:00\",\"lastModifiedBy\":\"yanszha@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-10-18T04:56:08.5836144+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"1787b9ba-4d6c-4841-afb8-bbca9eab1fe5\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/yanszha-itest1/providers/Microsoft.OffAzure/HyperVSites/srcyanszha8798site\",\"fabricResourceId\":\"5206527770863581626\",\"fabricContainerId\":\"20852847448572\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/yanszha-itest1/providers/Microsoft.Migrate/MigrateProjects/it3/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/yanszha-itest1/providers/Microsoft.DataReplication/replicationFabrics/srcyanszhacf89replicationfabric\",\"name\":\"srcyanszhacf89replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"yanszha@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-10-18T06:20:42.9401564+00:00\",\"lastModifiedBy\":\"yanszha@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-10-18T06:20:42.9401564+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"6b7ba507-897b-485c-a7ee-6b358f4b4554\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/yanszha-itest1/providers/Microsoft.OffAzure/HyperVSites/srcyanszha2561site\",\"fabricResourceId\":\"5214193631765439751\",\"fabricContainerId\":\"20890826976217\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/yanszha-itest1/providers/Microsoft.Migrate/MigrateProjects/it4/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/yanszha-itest1/providers/Microsoft.DataReplication/replicationFabrics/srcyanszhac7fbreplicationfabric\",\"name\":\"srcyanszhac7fbreplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"yanszha@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-10-18T06:42:50.6518402+00:00\",\"lastModifiedBy\":\"yanszha@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-10-18T06:42:50.6518402+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"b4197c55-cd76-4cbf-b794-4dbaa4877bab\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/yanszha-itest1/providers/Microsoft.OffAzure/HyperVSites/tgtyanszh1761site\",\"applianceName\":[\"tgtyanszh\"],\"cluster\":{\"clusterName\":\"rn03-u0911.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/680d0dad-59aa-4464-adf3-b34b2b427e8c/resourceGroups/vjvmmigtest01RG/providers/Microsoft.AzureStackHCI/clusters/hciclu09011\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5530364777145662549\",\"fabricContainerId\":\"20915132312085\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/yanszha-itest1/providers/Microsoft.Migrate/MigrateProjects/it4/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/yanszha-itest1/providers/Microsoft.DataReplication/replicationFabrics/tgtyanszh4d44replicationfabric\",\"name\":\"tgtyanszh4d44replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"yanszha@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-10-18T07:23:48.3650993+00:00\",\"lastModifiedBy\":\"yanszha@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-10-18T07:23:48.3650993+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"4872ba64-ca0b-4d08-936b-1f1235916fe8\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digotbb-02/providers/Microsoft.OffAzure/HyperVSites/apldig17738site\",\"fabricResourceId\":\"5550908690543065700\",\"fabricContainerId\":\"21031073261406\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digotbb-02/providers/Microsoft.Migrate/MigrateProjects/digotbb02srca1/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digotbb-02/providers/Microsoft.DataReplication/replicationFabrics/apldig1d828replicationfabric\",\"name\":\"apldig1d828replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"digot@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-10-18T10:56:56.86565+00:00\",\"lastModifiedBy\":\"digot@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-10-18T10:56:56.86565+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"fc239cfd-1977-4765-99a3-946a8f07f6d9\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/hafeworkoct12RG/providers/Microsoft.OffAzure/HyperVSites/src104269150site\",\"fabricResourceId\":\"5144546152462654717\",\"fabricContainerId\":\"2038230815532\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/hafeworkoct12RG/providers/Microsoft.Migrate/MigrateProjects/hafeworkoct26/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/hafeworkoct12RG/providers/Microsoft.DataReplication/replicationFabrics/src104269e18replicationfabric\",\"name\":\"src104269e18replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"helenafework@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-10-26T20:27:41.7989538+00:00\",\"lastModifiedBy\":\"helenafework@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-10-26T20:27:41.7989538+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"da7cee12-f332-4515-a2de-53e26c9c704a\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/hafeworkoct12RG/providers/Microsoft.OffAzure/HyperVSites/target107264014site\",\"applianceName\":[\"target10726\"],\"cluster\":{\"clusterName\":\"clrp09u15.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/clrp09u15RG/providers/Microsoft.AzureStackHCI/clusters/clrp09u15hci\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4978152362867486226\",\"fabricContainerId\":\"2102221552836\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/hafeworkoct12RG/providers/Microsoft.Migrate/MigrateProjects/hafeworkoct26/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/hafeworkoct12RG/providers/Microsoft.DataReplication/replicationFabrics/target10726edf7replicationfabric\",\"name\":\"target10726edf7replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"helenafework@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-10-26T22:14:22.7107326+00:00\",\"lastModifiedBy\":\"helenafework@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-10-26T22:14:22.7107326+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"c211adcb-6ae8-41e7-8bdf-6670db8c1877\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digot_10_28/providers/Microsoft.OffAzure/HyperVSites/digot1028src13452site\",\"fabricResourceId\":\"4748881880006372811\",\"fabricContainerId\":\"3768623144955\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digot_10_28/providers/Microsoft.Migrate/MigrateProjects/digot1028/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digot_10_28/providers/Microsoft.DataReplication/replicationFabrics/digot1028src18e69replicationfabric\",\"name\":\"digot1028src18e69replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"digot@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-10-28T20:11:44.547249+00:00\",\"lastModifiedBy\":\"digot@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-10-28T20:11:44.547249+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"073576b0-5b2a-40b1-a5e3-a6d6061686e9\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vajagdalOct31RG/providers/Microsoft.OffAzure/HyperVSites/vajagdalOct31S4366site\",\"fabricResourceId\":\"4661607325372872368\",\"fabricContainerId\":\"6390471854749\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vajagdalOct31RG/providers/Microsoft.Migrate/MigrateProjects/vajagdalOct31project/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vajagdalOct31RG/providers/Microsoft.DataReplication/replicationFabrics/vajagdalOct31S50b1replicationfabric\",\"name\":\"vajagdalOct31S50b1replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vajagdal@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-10-31T20:41:19.3642895+00:00\",\"lastModifiedBy\":\"vajagdal@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-10-31T20:41:19.3642895+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"95d3362c-89c3-4043-af36-bc637eefdc0d\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vajagdalOct31RG/providers/Microsoft.OffAzure/HyperVSites/vajagdaloctT0371site\",\"applianceName\":[\"vajagdaloctT\"],\"cluster\":{\"clusterName\":\"rn03u0507.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/680d0dad-59aa-4464-adf3-b34b2b427e8c/resourceGroups/vmmigtestrg0507hciclu/providers/Microsoft.AzureStackHCI/clusters/RN03U0507\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4630696314992277036\",\"fabricContainerId\":\"6557567609426\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vajagdalOct31RG/providers/Microsoft.Migrate/MigrateProjects/vajagdalOct31project/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vajagdalOct31RG/providers/Microsoft.DataReplication/replicationFabrics/vajagdaloctT362dreplicationfabric\",\"name\":\"vajagdaloctT362dreplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vajagdal@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-11-01T01:19:52.6668377+00:00\",\"lastModifiedBy\":\"vajagdal@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-11-01T01:19:52.6668377+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"3a275039-afc6-4759-a133-ec68b4c0291a\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/hafeworknov2RG/providers/Microsoft.OffAzure/HyperVSites/srcnov21046724site\",\"fabricResourceId\":\"5141333715534172217\",\"fabricContainerId\":\"7900088444961\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/hafeworknov2RG/providers/Microsoft.Migrate/MigrateProjects/hafeworknov2/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/hafeworknov2RG/providers/Microsoft.DataReplication/replicationFabrics/srcnov2104d15areplicationfabric\",\"name\":\"srcnov2104d15areplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"helenafework@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-11-02T14:57:21.9135861+00:00\",\"lastModifiedBy\":\"helenafework@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-11-02T14:57:21.9135861+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"9f584ebd-1bec-4996-b01d-6a4511f13937\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/hafeworknov2RG/providers/Microsoft.OffAzure/HyperVSites/targetnov21077350site\",\"applianceName\":[\"targetnov2107\"],\"cluster\":{\"clusterName\":\"clrp09u15.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/clrp09u15RG/providers/Microsoft.AzureStackHCI/clusters/clrp09u15hci\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5302456314374934205\",\"fabricContainerId\":\"7910969453413\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/hafeworknov2RG/providers/Microsoft.Migrate/MigrateProjects/hafeworknov2/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/hafeworknov2RG/providers/Microsoft.DataReplication/replicationFabrics/targetnov210715f7replicationfabric\",\"name\":\"targetnov210715f7replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"helenafework@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-11-02T15:15:30.0499202+00:00\",\"lastModifiedBy\":\"helenafework@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-11-02T15:15:30.0499202+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"b7bdb05a-010e-47dc-957e-b0c1e5f35b85\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-nov2/providers/Microsoft.OffAzure/HyperVSites/srceappnov26463site\",\"fabricResourceId\":\"5178014834293059674\",\"fabricContainerId\":\"8013060637400\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-nov2/providers/Microsoft.Migrate/MigrateProjects/migproj-nov2/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-nov2/providers/Microsoft.DataReplication/replicationFabrics/srceappnov28d9creplicationfabric\",\"name\":\"srceappnov28d9creplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"v-demanc@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-11-02T17:45:41.9353327+00:00\",\"lastModifiedBy\":\"v-demanc@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-11-02T17:45:41.9353327+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"f97f11d6-5031-4a07-8ef7-7a9eb8025d04\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-nov2/providers/Microsoft.OffAzure/HyperVSites/targappnov28032site\",\"applianceName\":[\"targappnov2\"],\"cluster\":{\"clusterName\":\"rnu-0103.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjvmmigtestrgu01u03/providers/Microsoft.AzureStackHCI/clusters/RNU-0103\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5334320459213115862\",\"fabricContainerId\":\"8012972351508\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-nov2/providers/Microsoft.Migrate/MigrateProjects/migproj-nov2/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-nov2/providers/Microsoft.DataReplication/replicationFabrics/targappnov25df1replicationfabric\",\"name\":\"targappnov25df1replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"v-demanc@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-11-02T18:05:30.3966058+00:00\",\"lastModifiedBy\":\"v-demanc@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-11-02T18:05:30.3966058+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"4cc6a1d3-686c-4789-8fe2-b78dc6f85108\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/Kerimha1110/providers/Microsoft.OffAzure/HyperVSites/kerim11106299site\",\"fabricResourceId\":\"5154766062856085971\",\"fabricContainerId\":\"15008371306935\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/Kerimha1110/providers/Microsoft.Migrate/MigrateProjects/kerim1110/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/Kerimha1110/providers/Microsoft.DataReplication/replicationFabrics/kerim1110b703replicationfabric\",\"name\":\"kerim1110b703replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"kerimha@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-11-10T20:24:16.6863495+00:00\",\"lastModifiedBy\":\"kerimha@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-11-10T20:24:16.6863495+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"641dab75-93c1-47cb-a900-4b9f6c1eb2ff\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnar08/providers/Microsoft.OffAzure/HyperVSites/jnar-src4978site\",\"fabricResourceId\":\"5173391055782783861\",\"fabricContainerId\":\"15145179143540\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnar08/providers/Microsoft.Migrate/MigrateProjects/jnar11-10-22/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnar08/providers/Microsoft.DataReplication/replicationFabrics/jnar-srccb65replicationfabric\",\"name\":\"jnar-srccb65replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-11-10T23:52:34.671387+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-11-10T23:52:34.671387+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"23df2732-a539-4676-abf3-6fb093f3de6e\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnar08/providers/Microsoft.OffAzure/HyperVSites/jnar-target0521site\",\"applianceName\":[\"jnar-target\"],\"cluster\":{\"clusterName\":\"rn03u0507.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/680d0dad-59aa-4464-adf3-b34b2b427e8c/resourceGroups/vmmigtestrg0507hciclu/providers/Microsoft.AzureStackHCI/clusters/RN03U0507\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5077427294740358962\",\"fabricContainerId\":\"15171250574546\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnar08/providers/Microsoft.Migrate/MigrateProjects/jnar11-10-22/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnar08/providers/Microsoft.DataReplication/replicationFabrics/jnar-target6be1replicationfabric\",\"name\":\"jnar-target6be1replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-11-11T00:55:44.6097101+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-11-11T00:55:44.6097101+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"64d4e32e-0a24-492c-8763-5c446d34c37c\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/Kerimha1110/providers/Microsoft.OffAzure/HyperVSites/kerim1110t5103site\",\"applianceName\":[\"kerim1110t\"],\"cluster\":{\"clusterName\":\"rn03u0507.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/680d0dad-59aa-4464-adf3-b34b2b427e8c/resourceGroups/vmmigtestrg0507hciclu/providers/Microsoft.AzureStackHCI/clusters/RN03U0507\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5272600415170781998\",\"fabricContainerId\":\"16044606488167\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/Kerimha1110/providers/Microsoft.Migrate/MigrateProjects/kerim1110/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/Kerimha1110/providers/Microsoft.DataReplication/replicationFabrics/kerim1110t7e51replicationfabric\",\"name\":\"kerim1110t7e51replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"kerimha@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-11-12T00:51:37.5921331+00:00\",\"lastModifiedBy\":\"kerimha@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-11-12T00:51:37.5921331+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"87cd8bfe-b1f3-4fdc-9167-ce3dd4e76f37\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnar08/providers/Microsoft.OffAzure/HyperVSites/jnarTargetApp8585site\",\"applianceName\":[\"jnarTargetApp\"],\"cluster\":{\"clusterName\":\"clrn03u05.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgCLRN03U0507/providers/Microsoft.AzureStackHCI/clusters/CLRN03U05hci\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5754670083386215422\",\"fabricContainerId\":\"2158404965827\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnar08/providers/Microsoft.Migrate/MigrateProjects/jnar11-10-22/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnar08/providers/Microsoft.DataReplication/replicationFabrics/jnarTargetAppe446replicationfabric\",\"name\":\"jnarTargetAppe446replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-11-18T21:35:44.6241663+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-11-18T21:35:44.6241663+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"e08c1588-7338-4c56-9ada-839fcc0ab1f9\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadaintprj14-rg/providers/Microsoft.OffAzure/HyperVSites/hvapp17809site\",\"fabricResourceId\":\"5500710683002279304\",\"fabricContainerId\":\"2244024924156\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadaintprj14-rg/providers/Microsoft.Migrate/MigrateProjects/mayadaintprj14/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadaintprj14-rg/providers/Microsoft.DataReplication/replicationFabrics/hvapp1141dreplicationfabric\",\"name\":\"hvapp1141dreplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"mayada@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-11-18T23:38:42.7213814+00:00\",\"lastModifiedBy\":\"mayada@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-11-18T23:38:42.7213814+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"133e2ecb-3c16-4ff1-b893-89b1d7729e92\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadaintprj14-rg/providers/Microsoft.OffAzure/HyperVSites/aszapp21754site\",\"applianceName\":[\"aszapp2\"],\"cluster\":{\"clusterName\":\"mayadahciclus3.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/clusters/mayadahciclus3\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5760451463893364427\",\"fabricContainerId\":\"2247586304917\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadaintprj14-rg/providers/Microsoft.Migrate/MigrateProjects/mayadaintprj14/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadaintprj14-rg/providers/Microsoft.DataReplication/replicationFabrics/aszapp26edareplicationfabric\",\"name\":\"aszapp26edareplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"mayada@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-11-19T00:04:22.7702376+00:00\",\"lastModifiedBy\":\"mayada@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-11-19T00:04:22.7702376+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"0ebee0b4-38b0-4c6b-b6e0-c99a5ea631c8\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-nov21/providers/Microsoft.OffAzure/HyperVSites/srcappnov211729site\",\"fabricResourceId\":\"5506557298203353268\",\"fabricContainerId\":\"4844054763389\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-nov21/providers/Microsoft.Migrate/MigrateProjects/migproj-nov21/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-nov21/providers/Microsoft.DataReplication/replicationFabrics/srcappnov216833replicationfabric\",\"name\":\"srcappnov216833replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"v-demanc@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-11-21T23:31:06.8851206+00:00\",\"lastModifiedBy\":\"v-demanc@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-11-21T23:31:06.8851206+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"9be67758-587c-4723-8d45-045ed5ebc19c\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digot1122rg/providers/Microsoft.OffAzure/HyperVSites/dig1122srcap5963site\",\"fabricResourceId\":\"5126038093092517720\",\"fabricContainerId\":\"5661731936184\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digot1122rg/providers/Microsoft.Migrate/MigrateProjects/digot1122/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digot1122rg/providers/Microsoft.DataReplication/replicationFabrics/dig1122srcapc66breplicationfabric\",\"name\":\"dig1122srcapc66breplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"digot@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-11-22T22:54:37.9022712+00:00\",\"lastModifiedBy\":\"digot@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-11-22T22:54:37.9022712+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"b17049c7-e213-4360-922c-35650e71bf79\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-nov21/providers/Microsoft.OffAzure/HyperVSites/targappnov211043site\",\"applianceName\":[\"targappnov21\"],\"cluster\":{\"clusterName\":\"rnu-0103.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjvmmigtestrgu01u03/providers/Microsoft.AzureStackHCI/clusters/RNU-0103\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4855128972514576839\",\"fabricContainerId\":\"5670834355428\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-nov21/providers/Microsoft.Migrate/MigrateProjects/migproj-nov21/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-nov21/providers/Microsoft.DataReplication/replicationFabrics/targappnov21e036replicationfabric\",\"name\":\"targappnov21e036replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"v-demanc@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-11-22T23:09:47.6144817+00:00\",\"lastModifiedBy\":\"v-demanc@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-11-22T23:09:47.6144817+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"eb4c23e2-b518-45b4-8316-4be070711b52\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digot1122rg/providers/Microsoft.OffAzure/HyperVSites/digot1122tar19785site\",\"fabricResourceId\":\"5022838603056423906\",\"fabricContainerId\":\"5690560703668\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digot1122rg/providers/Microsoft.Migrate/MigrateProjects/digot1122/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digot1122rg/providers/Microsoft.DataReplication/replicationFabrics/digot1122tar1600creplicationfabric\",\"name\":\"digot1122tar1600creplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"digot@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-11-22T23:22:50.3368157+00:00\",\"lastModifiedBy\":\"digot@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-11-22T23:22:50.3368157+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"fbea0c6e-656e-4393-85a9-d8ac345f7e0d\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digot1122rg/providers/Microsoft.OffAzure/HyperVSites/digot1122tr17114site\",\"applianceName\":[\"digot1122tr1\"],\"cluster\":{\"clusterName\":\"rnu-0103.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjvmmigtestrgu01u03/providers/Microsoft.AzureStackHCI/clusters/RNU-0103\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4869347149464865902\",\"fabricContainerId\":\"5711344250322\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digot1122rg/providers/Microsoft.Migrate/MigrateProjects/digot1122/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digot1122rg/providers/Microsoft.DataReplication/replicationFabrics/digot1122tr19a82replicationfabric\",\"name\":\"digot1122tr19a82replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"digot@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-11-22T23:36:35.604658+00:00\",\"lastModifiedBy\":\"digot@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-11-22T23:36:35.604658+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"54cc48c5-a062-4677-90d5-c2f68a7e2cb7\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-nov23/providers/Microsoft.OffAzure/HyperVSites/srcappnov237679site\",\"fabricResourceId\":\"5077703449073436869\",\"fabricContainerId\":\"6476633383750\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-nov23/providers/Microsoft.Migrate/MigrateProjects/migproj-nov23/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-nov23/providers/Microsoft.DataReplication/replicationFabrics/srcappnov23c84areplicationfabric\",\"name\":\"srcappnov23c84areplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"v-demanc@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-11-23T21:12:55.6162934+00:00\",\"lastModifiedBy\":\"v-demanc@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-11-23T21:12:55.6162934+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"ab611bb3-6921-4adb-b0ab-c136ec459650\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-nov23/providers/Microsoft.OffAzure/HyperVSites/targappnov237441site\",\"applianceName\":[\"targappnov23\"],\"cluster\":{\"clusterName\":\"rnu-0103.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjvmmigtestrgu01u03/providers/Microsoft.AzureStackHCI/clusters/RNU-0103\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5394020572036406195\",\"fabricContainerId\":\"6517326089012\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-nov23/providers/Microsoft.Migrate/MigrateProjects/migproj-nov23/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-nov23/providers/Microsoft.DataReplication/replicationFabrics/targappnov236446replicationfabric\",\"name\":\"targappnov236446replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"v-demanc@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-11-23T22:20:45.0001371+00:00\",\"lastModifiedBy\":\"v-demanc@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-11-23T22:20:45.0001371+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"ed772584-3a0c-4326-bf9e-d401cec688f8\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-nov28/providers/Microsoft.OffAzure/HyperVSites/srcappnov281094site\",\"fabricResourceId\":\"4838618676854203780\",\"fabricContainerId\":\"10760789341077\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-nov28/providers/Microsoft.Migrate/MigrateProjects/migproj-nov28/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-nov28/providers/Microsoft.DataReplication/replicationFabrics/srcappnov2839aareplicationfabric\",\"name\":\"srcappnov2839aareplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"v-demanc@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-11-28T20:33:03.7426281+00:00\",\"lastModifiedBy\":\"v-demanc@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-11-28T20:33:03.7426281+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"445577ca-4966-42b0-8e44-8e6d3a4c3abf\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-nov28/providers/Microsoft.OffAzure/HyperVSites/targappnov283436site\",\"applianceName\":[\"targappnov28\"],\"cluster\":{\"clusterName\":\"rnu-0103.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjvmmigtestrgu01u03/providers/Microsoft.AzureStackHCI/clusters/RNU-0103\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4805421505986262986\",\"fabricContainerId\":\"10795810871086\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-nov28/providers/Microsoft.Migrate/MigrateProjects/migproj-nov28/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-nov28/providers/Microsoft.DataReplication/replicationFabrics/targappnov28aa7creplicationfabric\",\"name\":\"targappnov28aa7creplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"v-demanc@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-11-28T21:11:22.2446162+00:00\",\"lastModifiedBy\":\"v-demanc@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-11-28T21:11:22.2446162+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"16ccd11e-8c26-4067-99d2-ca074622b473\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-dec01/providers/Microsoft.OffAzure/HyperVSites/srcappdec016718site\",\"fabricResourceId\":\"4640832036247752990\",\"fabricContainerId\":\"13374686707605\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-dec01/providers/Microsoft.Migrate/MigrateProjects/migproj-dec01/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-dec01/providers/Microsoft.DataReplication/replicationFabrics/srcappdec0156f0replicationfabric\",\"name\":\"srcappdec0156f0replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"v-demanc@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-12-01T20:49:26.9411257+00:00\",\"lastModifiedBy\":\"v-demanc@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-12-01T20:49:26.9411257+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"145d21f0-5e85-4f5c-84cf-669698c61c34\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnar08/providers/Microsoft.OffAzure/HyperVSites/jnarSource3345site\",\"fabricResourceId\":\"5718549552518996464\",\"fabricContainerId\":\"14080694426260\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnar08/providers/Microsoft.Migrate/MigrateProjects/jnar12-01-22/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnar08/providers/Microsoft.DataReplication/replicationFabrics/jnarSourcea9dfreplicationfabric\",\"name\":\"jnarSourcea9dfreplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-12-02T16:46:14.2650624+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-12-02T16:46:14.2650624+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"55d798ad-b95a-4ed0-a9cd-980481095761\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnar08/providers/Microsoft.OffAzure/HyperVSites/jnarTargetApp0886site\",\"applianceName\":[\"jnarTargetApp\"],\"cluster\":{\"clusterName\":\"rn03-u0911.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/680d0dad-59aa-4464-adf3-b34b2b427e8c/resourceGroups/vjvmmigtest01RG/providers/Microsoft.AzureStackHCI/clusters/hciclu09011\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5679242927752583341\",\"fabricContainerId\":\"14162219509955\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnar08/providers/Microsoft.Migrate/MigrateProjects/jnar12-01-22/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnar08/providers/Microsoft.DataReplication/replicationFabrics/jnarTargetApp03d0replicationfabric\",\"name\":\"jnarTargetApp03d0replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-12-02T18:21:24.518327+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-12-02T18:21:24.518327+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"60952157-0d3d-4c11-bd07-4bbeba655d37\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-dec01/providers/Microsoft.OffAzure/HyperVSites/targapp8857site\",\"applianceName\":[\"targapp\"],\"cluster\":{\"clusterName\":\"rnu-0103.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjvmmigtestrgu01u03/providers/Microsoft.AzureStackHCI/clusters/RNU-0103\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5481176778751156567\",\"fabricContainerId\":\"14209470082934\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-dec01/providers/Microsoft.Migrate/MigrateProjects/migproj-dec01/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-dec01/providers/Microsoft.DataReplication/replicationFabrics/targapp439areplicationfabric\",\"name\":\"targapp439areplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"v-demanc@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-12-02T20:00:43.7413318+00:00\",\"lastModifiedBy\":\"v-demanc@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-12-02T20:00:43.7413318+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"4f44c181-b404-41d0-884c-d2ef554eb459\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/Kerimha2022RG/providers/Microsoft.OffAzure/HyperVSites/kerimha2022src9131site\",\"fabricResourceId\":\"4742488338223907201\",\"fabricContainerId\":\"14423149653957\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/Kerimha2022RG/providers/Microsoft.Migrate/MigrateProjects/Kerimha2022/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/Kerimha2022RG/providers/Microsoft.DataReplication/replicationFabrics/kerimha2022src3794replicationfabric\",\"name\":\"kerimha2022src3794replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"kerimha@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-12-03T01:56:50.8264875+00:00\",\"lastModifiedBy\":\"kerimha@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-12-03T01:56:50.8264875+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"f2d59c1b-6e9c-41f2-93e6-b7380a9ac906\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/Kerimha2022RG/providers/Microsoft.OffAzure/HyperVSites/Kerimha2022Tgt4168site\",\"applianceName\":[\"Kerimha2022Tgt\"],\"cluster\":{\"clusterName\":\"clrn03u05.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgCLRN03U0507/providers/Microsoft.AzureStackHCI/clusters/CLRN03U05hci\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4751982177197333531\",\"fabricContainerId\":\"15014064051059\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/Kerimha2022RG/providers/Microsoft.Migrate/MigrateProjects/Kerimha2022/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/Kerimha2022RG/providers/Microsoft.DataReplication/replicationFabrics/Kerimha2022Tgt0963replicationfabric\",\"name\":\"Kerimha2022Tgt0963replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"kerimha@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-12-03T18:21:41.5529366+00:00\",\"lastModifiedBy\":\"kerimha@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-12-03T18:21:41.5529366+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"b693a860-d591-4287-91aa-7e881c945552\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/Kerimha1204/providers/Microsoft.OffAzure/HyperVSites/kerimha1204src7182site\",\"fabricResourceId\":\"4794035150169286752\",\"fabricContainerId\":\"16331307346568\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/Kerimha1204/providers/Microsoft.Migrate/MigrateProjects/kerimha1204az/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/Kerimha1204/providers/Microsoft.DataReplication/replicationFabrics/kerimha1204src6c93replicationfabric\",\"name\":\"kerimha1204src6c93replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"kerimha@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-12-05T06:57:01.9667068+00:00\",\"lastModifiedBy\":\"kerimha@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-12-05T06:57:01.9667068+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"3ed50c4d-ec6f-4ae4-838b-38ef372d3e96\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/Kerimha1204/providers/Microsoft.OffAzure/HyperVSites/kerimha1204tgt6545site\",\"applianceName\":[\"kerimha1204tgt\"],\"cluster\":{\"clusterName\":\"clrn03u05.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgCLRN03U0507/providers/Microsoft.AzureStackHCI/clusters/CLRN03U05hci\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5396698216036371533\",\"fabricContainerId\":\"16384086279200\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/Kerimha1204/providers/Microsoft.Migrate/MigrateProjects/kerimha1204az/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/Kerimha1204/providers/Microsoft.DataReplication/replicationFabrics/kerimha1204tgtc28dreplicationfabric\",\"name\":\"kerimha1204tgtc28dreplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"kerimha@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-12-05T08:04:30.5488063+00:00\",\"lastModifiedBy\":\"kerimha@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-12-05T08:04:30.5488063+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"c6bb89be-3126-411b-8142-fc6bf862381f\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-dec05/providers/Microsoft.OffAzure/HyperVSites/srcappdec059198site\",\"fabricResourceId\":\"4691397479449201086\",\"fabricContainerId\":\"16802709782447\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-dec05/providers/Microsoft.Migrate/MigrateProjects/migrproj-dec05/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-dec05/providers/Microsoft.DataReplication/replicationFabrics/srcappdec0514e7replicationfabric\",\"name\":\"srcappdec0514e7replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"v-demanc@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-12-05T20:02:42.4385763+00:00\",\"lastModifiedBy\":\"v-demanc@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-12-05T20:02:42.4385763+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"92d1af38-4c4e-4e37-ae0b-ce2d4ddff1f3\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-dec05/providers/Microsoft.OffAzure/HyperVSites/targappdec059728site\",\"applianceName\":[\"targappdec05\"],\"cluster\":{\"clusterName\":\"rnu-0103.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjvmmigtestrgu01u03/providers/Microsoft.AzureStackHCI/clusters/RNU-0103\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5636057359031840568\",\"fabricContainerId\":\"16915073994417\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-dec05/providers/Microsoft.Migrate/MigrateProjects/migrproj-dec05/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-dec05/providers/Microsoft.DataReplication/replicationFabrics/targappdec0576d2replicationfabric\",\"name\":\"targappdec0576d2replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"v-demanc@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-12-05T22:49:30.4192775+00:00\",\"lastModifiedBy\":\"v-demanc@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-12-05T22:49:30.4192775+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"5bb3f82c-b607-4ddd-bbf7-a5fbf95985c9\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-dec06/providers/Microsoft.OffAzure/HyperVSites/srcappdec068195site\",\"fabricResourceId\":\"5610840853493053484\",\"fabricContainerId\":\"17703815402175\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-dec06/providers/Microsoft.Migrate/MigrateProjects/migproj-dec06/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-dec06/providers/Microsoft.DataReplication/replicationFabrics/srcappdec0642ddreplicationfabric\",\"name\":\"srcappdec0642ddreplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"v-demanc@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-12-06T21:24:45.4546337+00:00\",\"lastModifiedBy\":\"v-demanc@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-12-06T21:24:45.4546337+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"991613ae-f712-45e1-9596-fda5a06c1d5e\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-dec06/providers/Microsoft.OffAzure/HyperVSites/targappdec060241site\",\"applianceName\":[\"targappdec06\"],\"cluster\":{\"clusterName\":\"rnu-0103.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjvmmigtestrgu01u03/providers/Microsoft.AzureStackHCI/clusters/RNU-0103\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5035577517626758062\",\"fabricContainerId\":\"17754062511463\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-dec06/providers/Microsoft.Migrate/MigrateProjects/migproj-dec06/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-dec06/providers/Microsoft.DataReplication/replicationFabrics/targappdec068469replicationfabric\",\"name\":\"targappdec068469replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"v-demanc@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-12-06T22:07:49.4223298+00:00\",\"lastModifiedBy\":\"v-demanc@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-12-06T22:07:49.4223298+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"94a07acc-edb7-43e2-af6e-1d8f300fd6df\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-dec07/providers/Microsoft.OffAzure/HyperVSites/srceappdec075547site\",\"fabricResourceId\":\"4891733518006123212\",\"fabricContainerId\":\"18806042798118\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-dec07/providers/Microsoft.Migrate/MigrateProjects/migrproj-dec07/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-dec07/providers/Microsoft.DataReplication/replicationFabrics/srceappdec078e6areplicationfabric\",\"name\":\"srceappdec078e6areplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"v-demanc@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-12-08T03:21:06.230237+00:00\",\"lastModifiedBy\":\"v-demanc@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-12-08T03:21:06.230237+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"0d9d01e8-5ad0-4060-8f29-25b2dbc5de15\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-dec07/providers/Microsoft.OffAzure/HyperVSites/targappdec072294site\",\"applianceName\":[\"targappdec07\"],\"cluster\":{\"clusterName\":\"rnu-0103.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjvmmigtestrgu01u03/providers/Microsoft.AzureStackHCI/clusters/RNU-0103\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4638807465819701736\",\"fabricContainerId\":\"19502834561365\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-dec07/providers/Microsoft.Migrate/MigrateProjects/migrproj-dec07/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-dec07/providers/Microsoft.DataReplication/replicationFabrics/targappdec07fa66replicationfabric\",\"name\":\"targappdec07fa66replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"v-demanc@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-12-08T23:23:10.1647548+00:00\",\"lastModifiedBy\":\"v-demanc@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-12-08T23:23:10.1647548+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"edad0958-49a0-4f90-b325-1f0d4a556e54\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-dec12/providers/Microsoft.OffAzure/HyperVSites/srcappdec123074site\",\"fabricResourceId\":\"5733163281173776728\",\"fabricContainerId\":\"23248524542681\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-dec12/providers/Microsoft.Migrate/MigrateProjects/migproj-dec12/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-dec12/providers/Microsoft.DataReplication/replicationFabrics/srcappdec12ed13replicationfabric\",\"name\":\"srcappdec12ed13replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"v-demanc@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-12-13T07:25:59.126087+00:00\",\"lastModifiedBy\":\"v-demanc@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-12-13T07:25:59.126087+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"bfd881f3-f18d-4136-89ca-e1b31bf77e3c\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-dec12/providers/Microsoft.OffAzure/HyperVSites/targappdec128836site\",\"applianceName\":[\"targappdec12\"],\"cluster\":{\"clusterName\":\"rnu-0103.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjvmmigtestrgu01u03/providers/Microsoft.AzureStackHCI/clusters/RNU-0103\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4699208852319011315\",\"fabricContainerId\":\"23266633299776\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-dec12/providers/Microsoft.Migrate/MigrateProjects/migproj-dec12/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-dec12/providers/Microsoft.DataReplication/replicationFabrics/targappdec12997areplicationfabric\",\"name\":\"targappdec12997areplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"v-demanc@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-12-13T07:56:09.698801+00:00\",\"lastModifiedBy\":\"v-demanc@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-12-13T07:56:09.698801+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"adff79e6-45d4-4fb0-9239-9418f8cd9a79\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/hafeworkdec14RG/providers/Microsoft.OffAzure/HyperVSites/dec14rn03src7860site\",\"fabricResourceId\":\"5742166304651966950\",\"fabricContainerId\":\"24435395839451\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/hafeworkdec14RG/providers/Microsoft.Migrate/MigrateProjects/hafeworkdec14pj/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/hafeworkdec14RG/providers/Microsoft.DataReplication/replicationFabrics/dec14rn03src3551replicationfabric\",\"name\":\"dec14rn03src3551replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"helenafework@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-12-14T16:24:06.8428781+00:00\",\"lastModifiedBy\":\"helenafework@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-12-14T16:24:06.8428781+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"351e81a0-1e3c-46b4-99e8-7f1f8f435896\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/hafeworkdec14RG/providers/Microsoft.OffAzure/HyperVSites/dec14rn03tar8309site\",\"applianceName\":[\"dec14rn03tar\"],\"cluster\":{\"clusterName\":\"clrn03u05.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgCLRN03U0507/providers/Microsoft.AzureStackHCI/clusters/CLRN03U05hci\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5094730322400936352\",\"fabricContainerId\":\"24495763427898\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/hafeworkdec14RG/providers/Microsoft.Migrate/MigrateProjects/hafeworkdec14pj/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/hafeworkdec14RG/providers/Microsoft.DataReplication/replicationFabrics/dec14rn03tarb1ffreplicationfabric\",\"name\":\"dec14rn03tarb1ffreplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"helenafework@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-12-14T18:04:43.5272998+00:00\",\"lastModifiedBy\":\"helenafework@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-12-14T18:04:43.5272998+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"41c6003a-787b-4136-8c5d-fb225146f04c\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/terry-migrate10001/providers/Microsoft.OffAzure/HyperVSites/source023966site\",\"fabricResourceId\":\"4699075731987497018\",\"fabricContainerId\":\"24598692905027\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/terry-migrate10001/providers/Microsoft.Migrate/MigrateProjects/migrate001/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/terry-migrate10001/providers/Microsoft.DataReplication/replicationFabrics/source023b73replicationfabric\",\"name\":\"source023b73replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"b-testo@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-12-14T20:35:44.9929444+00:00\",\"lastModifiedBy\":\"b-testo@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-12-14T20:35:44.9929444+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"54dd13a0-c953-4be0-b5c0-59a6146aeca7\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/terry-migrate10001/providers/Microsoft.OffAzure/HyperVSites/target014829site\",\"applianceName\":[\"target01\"],\"cluster\":{\"clusterName\":\"acuutech-01-cl.man.local\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/terrystorey/providers/Microsoft.AzureStackHCI/clusters/acuutech-01-cl\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5467591307371025312\",\"fabricContainerId\":\"24609171769739\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/terry-migrate10001/providers/Microsoft.Migrate/MigrateProjects/migrate001/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/terry-migrate10001/providers/Microsoft.DataReplication/replicationFabrics/target01e3b5replicationfabric\",\"name\":\"target01e3b5replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"b-testo@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-12-14T21:13:44.390181+00:00\",\"lastModifiedBy\":\"b-testo@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-12-14T21:13:44.390181+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"e44db8ef-6205-42db-90d4-c5d21eace086\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gd1215/providers/Microsoft.OffAzure/HyperVSites/gd1215src4780site\",\"fabricResourceId\":\"4817552003847534831\",\"fabricContainerId\":\"24936109864092\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gd1215/providers/Microsoft.Migrate/MigrateProjects/gd1215mp/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gd1215/providers/Microsoft.DataReplication/replicationFabrics/gd1215src63bcreplicationfabric\",\"name\":\"gd1215src63bcreplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"gadeshpa@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-12-15T05:58:06.2126144+00:00\",\"lastModifiedBy\":\"gadeshpa@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-12-15T05:58:06.2126144+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"5e16ed98-5394-495d-8144-e66c3b401d40\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/Arijit-RG1/providers/Microsoft.OffAzure/HyperVSites/AD-Appliance011789site\",\"fabricResourceId\":\"5286473434301656472\",\"fabricContainerId\":\"24949202583030\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/Arijit-RG1/providers/Microsoft.Migrate/MigrateProjects/ASZBugBash-001/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/Arijit-RG1/providers/Microsoft.DataReplication/replicationFabrics/AD-Appliance016437replicationfabric\",\"name\":\"AD-Appliance016437replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"arijitdey@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-12-15T06:19:55.7849616+00:00\",\"lastModifiedBy\":\"arijitdey@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-12-15T06:19:55.7849616+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"50a08645-08cd-4a08-afc4-9707d6e3d34b\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gd1215/providers/Microsoft.OffAzure/HyperVSites/gd1215tgt5417site\",\"applianceName\":[\"gd1215tgt\"],\"cluster\":{\"clusterName\":\"clrn03u05.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgCLRN03U0507/providers/Microsoft.AzureStackHCI/clusters/CLRN03U05hci\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5334523436534367813\",\"fabricContainerId\":\"24993406439323\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gd1215/providers/Microsoft.Migrate/MigrateProjects/gd1215mp/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gd1215/providers/Microsoft.DataReplication/replicationFabrics/gd1215tgta0e8replicationfabric\",\"name\":\"gd1215tgta0e8replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"gadeshpa@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-12-15T07:13:24.5195769+00:00\",\"lastModifiedBy\":\"gadeshpa@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-12-15T07:13:24.5195769+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"7ae44a7e-dbb9-4c0a-8220-833a443c3a06\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/Arijit-RG1/providers/Microsoft.OffAzure/HyperVSites/AD-Appliance021788site\",\"applianceName\":[\"AD-Appliance02\"],\"cluster\":{\"clusterName\":\"rn03-u0911.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/680d0dad-59aa-4464-adf3-b34b2b427e8c/resourceGroups/vjvmmigtest01RG/providers/Microsoft.AzureStackHCI/clusters/hciclu09011\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5479433486326844030\",\"fabricContainerId\":\"25114657401228\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/Arijit-RG1/providers/Microsoft.Migrate/MigrateProjects/ASZBugBash-001/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/Arijit-RG1/providers/Microsoft.DataReplication/replicationFabrics/AD-Appliance02e07ereplicationfabric\",\"name\":\"AD-Appliance02e07ereplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"arijitdey@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-12-15T11:16:13.2368256+00:00\",\"lastModifiedBy\":\"arijitdey@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-12-15T11:16:13.2368256+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"933ba0b2-dd33-46fb-b7db-9ebce57dea1b\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/bugbashsrtulasisea/providers/Microsoft.OffAzure/HyperVSites/srtulasisrcapp7809site\",\"fabricResourceId\":\"5114925015392559282\",\"fabricContainerId\":\"25142145727804\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/bugbashsrtulasisea/providers/Microsoft.Migrate/MigrateProjects/bugbashsrtulasisea/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/bugbashsrtulasisea/providers/Microsoft.DataReplication/replicationFabrics/srtulasisrcapp887ereplicationfabric\",\"name\":\"srtulasisrcapp887ereplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"srtulasi@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-12-15T11:21:18.6361763+00:00\",\"lastModifiedBy\":\"srtulasi@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-12-15T11:21:18.6361763+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"06eafecc-02a1-4369-994f-ac17ce2a009b\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/bugbashsrtulasisea/providers/Microsoft.OffAzure/HyperVSites/srtulasitgtapp0942site\",\"applianceName\":[\"srtulasitgtapp\"],\"cluster\":{\"clusterName\":\"clrn03u05.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgCLRN03U0507/providers/Microsoft.AzureStackHCI/clusters/CLRN03U05hci\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4857416563724844748\",\"fabricContainerId\":\"25177588164445\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/bugbashsrtulasisea/providers/Microsoft.Migrate/MigrateProjects/bugbashsrtulasisea/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/bugbashsrtulasisea/providers/Microsoft.DataReplication/replicationFabrics/srtulasitgtapp5d3creplicationfabric\",\"name\":\"srtulasitgtapp5d3creplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"srtulasi@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-12-15T13:01:05.805322+00:00\",\"lastModifiedBy\":\"srtulasi@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-12-15T13:01:05.805322+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"98058357-a383-4efa-aced-5b8db30a51c8\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/bugbashsrtulasisea/providers/Microsoft.OffAzure/HyperVSites/bugbashsrtsrc8224site\",\"fabricResourceId\":\"5691040864722584407\",\"fabricContainerId\":\"25247405302941\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/bugbashsrtulasisea/providers/Microsoft.Migrate/MigrateProjects/bugbashsrtulasisea/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/bugbashsrtulasisea/providers/Microsoft.DataReplication/replicationFabrics/bugbashsrtsrc552freplicationfabric\",\"name\":\"bugbashsrtsrc552freplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"srtulasi@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-12-15T14:16:44.9475462+00:00\",\"lastModifiedBy\":\"srtulasi@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-12-15T14:16:44.9475462+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"81cc0bba-eee9-4932-8cbd-2920b5c600a9\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarbugbash3/providers/Microsoft.OffAzure/HyperVSites/jnarsrcapp5426site\",\"fabricResourceId\":\"5274540800276695994\",\"fabricContainerId\":\"26384833363740\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarbugbash3/providers/Microsoft.Migrate/MigrateProjects/jnar12-16-22/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarbugbash3/providers/Microsoft.DataReplication/replicationFabrics/jnarsrcapp7192replicationfabric\",\"name\":\"jnarsrcapp7192replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-12-16T22:33:09.3307098+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-12-16T22:33:09.3307098+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"d9a7b43d-bb8d-418e-9ab4-e38c7aff4815\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarbugbash3/providers/Microsoft.OffAzure/HyperVSites/jnartgtapp2293site\",\"applianceName\":[\"jnartgtapp\"],\"cluster\":{\"clusterName\":\"rnu-0103.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjvmmigtestrgu01u03/providers/Microsoft.AzureStackHCI/clusters/RNU-0103\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4723919277074658365\",\"fabricContainerId\":\"26474056728818\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarbugbash3/providers/Microsoft.Migrate/MigrateProjects/jnar12-16-22/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarbugbash3/providers/Microsoft.DataReplication/replicationFabrics/jnartgtapp45d2replicationfabric\",\"name\":\"jnartgtapp45d2replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-12-17T00:41:10.1524965+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-12-17T00:41:10.1524965+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"a4087f0d-7942-4688-b53c-6e45ae305a16\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-dec19/providers/Microsoft.OffAzure/HyperVSites/srcappdec197547site\",\"fabricResourceId\":\"5082445506614427405\",\"fabricContainerId\":\"28951449902108\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-dec19/providers/Microsoft.Migrate/MigrateProjects/migproj-dec19/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-dec19/providers/Microsoft.DataReplication/replicationFabrics/srcappdec196564replicationfabric\",\"name\":\"srcappdec196564replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"v-demanc@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-12-19T21:10:09.8166109+00:00\",\"lastModifiedBy\":\"v-demanc@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-12-19T21:10:09.8166109+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"55cb7dea-6900-4d76-9bbf-bddfe536ac76\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-dec19/providers/Microsoft.OffAzure/HyperVSites/targappdec196067site\",\"applianceName\":[\"targappdec19\"],\"cluster\":{\"clusterName\":\"rnu-0103.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjvmmigtestrgu01u03/providers/Microsoft.AzureStackHCI/clusters/RNU-0103\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5581764238332624362\",\"fabricContainerId\":\"29018482273097\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-dec19/providers/Microsoft.Migrate/MigrateProjects/migproj-dec19/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgdp-dec19/providers/Microsoft.DataReplication/replicationFabrics/targappdec1955e1replicationfabric\",\"name\":\"targappdec1955e1replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"v-demanc@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-12-19T23:01:52.8984322+00:00\",\"lastModifiedBy\":\"v-demanc@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-12-19T23:01:52.8984322+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"051ae53f-7ef4-4c29-a6ed-78f3b20ca1db\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/hafeworkdec21RG/providers/Microsoft.OffAzure/HyperVSites/dec21src5561site\",\"fabricResourceId\":\"5488057207450428735\",\"fabricContainerId\":\"30699744647397\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/hafeworkdec21RG/providers/Microsoft.Migrate/MigrateProjects/hafeworkdec21pj/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/hafeworkdec21RG/providers/Microsoft.DataReplication/replicationFabrics/dec21srcd945replicationfabric\",\"name\":\"dec21srcd945replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"helenafework@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-12-21T21:43:58.3888908+00:00\",\"lastModifiedBy\":\"helenafework@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-12-21T21:43:58.3888908+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"58a6de15-a88d-4ae4-9dbd-a48211ce866c\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/hafeworkdec21RG/providers/Microsoft.OffAzure/HyperVSites/tardec213664site\",\"applianceName\":[\"tardec21\"],\"cluster\":{\"clusterName\":\"clrp09u15.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/clrp09u15RG/providers/Microsoft.AzureStackHCI/clusters/clrp09u15hci\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5396623578527882773\",\"fabricContainerId\":\"30700362831801\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/hafeworkdec21RG/providers/Microsoft.Migrate/MigrateProjects/hafeworkdec21pj/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/hafeworkdec21RG/providers/Microsoft.DataReplication/replicationFabrics/tardec21b6a2replicationfabric\",\"name\":\"tardec21b6a2replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"helenafework@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-12-21T22:05:00.0365807+00:00\",\"lastModifiedBy\":\"helenafework@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-12-21T22:05:00.0365807+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"9347e759-dce1-4535-a022-567eab06afdb\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/ac791cc4-rgdec27/providers/Microsoft.OffAzure/HyperVSites/srcappdec271485site\",\"fabricResourceId\":\"4987135023779407705\",\"fabricContainerId\":\"36106589039404\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/ac791cc4-rgdec27/providers/Microsoft.Migrate/MigrateProjects/migproj-dec27/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/ac791cc4-rgdec27/providers/Microsoft.DataReplication/replicationFabrics/srcappdec271ce2replicationfabric\",\"name\":\"srcappdec271ce2replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"v-demanc@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-12-28T04:15:10.9180926+00:00\",\"lastModifiedBy\":\"v-demanc@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-12-28T04:15:10.9180926+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"7db12408-77c1-4414-98d8-524a824a230c\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/ac791cc4-rgdec27/providers/Microsoft.OffAzure/HyperVSites/targappdec270415site\",\"applianceName\":[\"targappdec27\"],\"cluster\":{\"clusterName\":\"rnu-0103.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjvmmigtestrgu01u03/providers/Microsoft.AzureStackHCI/clusters/RNU-0103\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4905677567034467336\",\"fabricContainerId\":\"36131692670922\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/ac791cc4-rgdec27/providers/Microsoft.Migrate/MigrateProjects/migproj-dec27/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/ac791cc4-rgdec27/providers/Microsoft.DataReplication/replicationFabrics/targappdec270406replicationfabric\",\"name\":\"targappdec270406replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"v-demanc@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2022-12-28T04:57:01.9872008+00:00\",\"lastModifiedBy\":\"v-demanc@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2022-12-28T04:57:01.9872008+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"21d4ec6e-9de0-4f98-bc27-f7086a1b7263\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/hafeworkjan5RG/providers/Microsoft.OffAzure/HyperVSites/jan5wnzuphS7329site\",\"fabricResourceId\":\"5735507711422164078\",\"fabricContainerId\":\"43428638906368\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/hafeworkjan5RG/providers/Microsoft.Migrate/MigrateProjects/hafeworkjan5Pj/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/hafeworkjan5RG/providers/Microsoft.DataReplication/replicationFabrics/jan5wnzuphS4593replicationfabric\",\"name\":\"jan5wnzuphS4593replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"helenafework@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-01-05T15:18:51.5379821+00:00\",\"lastModifiedBy\":\"helenafework@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-01-05T15:18:51.5379821+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"3cf8a72f-5570-44d0-b671-8c13c9b7b14b\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/hafeworkjan5RG/providers/Microsoft.OffAzure/HyperVSites/jan5fvtoqeTar8068site\",\"applianceName\":[\"jan5fvtoqeTar\"],\"cluster\":{\"clusterName\":\"clrn03u05.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgCLRN03U0507/providers/Microsoft.AzureStackHCI/clusters/CLRN03U05hci\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4958557130282542895\",\"fabricContainerId\":\"43500264512863\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/hafeworkjan5RG/providers/Microsoft.Migrate/MigrateProjects/hafeworkjan5Pj/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/hafeworkjan5RG/providers/Microsoft.DataReplication/replicationFabrics/jan5fvtoqeTar175breplicationfabric\",\"name\":\"jan5fvtoqeTar175breplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"helenafework@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-01-05T17:37:44.4541545+00:00\",\"lastModifiedBy\":\"helenafework@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-01-05T17:37:44.4541545+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"a31694fe-c5f3-4efc-b7a6-dfae19d3ba55\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/migrationDemoRG/providers/Microsoft.OffAzure/HyperVSites/migDemoSource1346site\",\"fabricResourceId\":\"5691641679293355262\",\"fabricContainerId\":\"47057689407089\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/migrationDemoRG/providers/Microsoft.Migrate/MigrateProjects/migrationDemoProj/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/migrationDemoRG/providers/Microsoft.DataReplication/replicationFabrics/migDemoSource2f2freplicationfabric\",\"name\":\"migDemoSource2f2freplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-01-09T20:26:39.6710893+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-01-09T20:26:39.6710893+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"c5d8f6d3-c2c7-4acc-a6db-06d4144e67bc\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/migrationDemoRG/providers/Microsoft.OffAzure/HyperVSites/jnarDemoTgt5618site\",\"applianceName\":[\"jnarDemoTgt\"],\"cluster\":{\"clusterName\":\"clrn03u05.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgCLRN03U0507/providers/Microsoft.AzureStackHCI/clusters/CLRN03U05hci\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5389897017329252051\",\"fabricContainerId\":\"47185222188340\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/migrationDemoRG/providers/Microsoft.Migrate/MigrateProjects/migrationDemoProj/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/migrationDemoRG/providers/Microsoft.DataReplication/replicationFabrics/jnarDemoTgtfee9replicationfabric\",\"name\":\"jnarDemoTgtfee9replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-01-09T23:39:49.9371714+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-01-09T23:39:49.9371714+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"558ccc8c-7525-4967-94fb-32246d39ddd7\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/ac791cc4-rgjan09/providers/Microsoft.OffAzure/HyperVSites/srcappjan094812site\",\"fabricResourceId\":\"5289325090579467404\",\"fabricContainerId\":\"47220372891956\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/ac791cc4-rgjan09/providers/Microsoft.Migrate/MigrateProjects/migproj-jan09/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/ac791cc4-rgjan09/providers/Microsoft.DataReplication/replicationFabrics/srcappjan097f1areplicationfabric\",\"name\":\"srcappjan097f1areplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"v-demanc@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-01-10T01:19:06.6900167+00:00\",\"lastModifiedBy\":\"v-demanc@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-01-10T01:19:06.6900167+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"65377142-d637-4490-9675-c876b1a927fa\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/ac791cc4-rgjan09/providers/Microsoft.OffAzure/HyperVSites/targappjan098008site\",\"applianceName\":[\"targappjan09\"],\"cluster\":{\"clusterName\":\"rnu-0103.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjvmmigtestrgu01u03/providers/Microsoft.AzureStackHCI/clusters/RNU-0103\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4940684324635111746\",\"fabricContainerId\":\"47255332398506\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/ac791cc4-rgjan09/providers/Microsoft.Migrate/MigrateProjects/migproj-jan09/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/ac791cc4-rgjan09/providers/Microsoft.DataReplication/replicationFabrics/targappjan09810dreplicationfabric\",\"name\":\"targappjan09810dreplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"v-demanc@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-01-10T01:36:41.2139776+00:00\",\"lastModifiedBy\":\"v-demanc@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-01-10T01:36:41.2139776+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"4c2fb9b1-3fc5-4ad0-966c-f20b44dce910\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/ac791cc4-rgjan10/providers/Microsoft.OffAzure/HyperVSites/srcappjan102066site\",\"fabricResourceId\":\"5390878870581787057\",\"fabricContainerId\":\"47873086490281\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/ac791cc4-rgjan10/providers/Microsoft.Migrate/MigrateProjects/migproj-jan10/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/ac791cc4-rgjan10/providers/Microsoft.DataReplication/replicationFabrics/srcappjan1069f3replicationfabric\",\"name\":\"srcappjan1069f3replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"v-demanc@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-01-10T18:46:15.8266557+00:00\",\"lastModifiedBy\":\"v-demanc@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-01-10T18:46:15.8266557+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"aab2ba0e-bad5-4823-a237-8b4da36933d0\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/ac791cc4-rgjan10/providers/Microsoft.OffAzure/HyperVSites/targappjan101090site\",\"applianceName\":[\"targappjan10\"],\"cluster\":{\"clusterName\":\"rnu-0103.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjvmmigtestrgu01u03/providers/Microsoft.AzureStackHCI/clusters/RNU-0103\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5198203821770324494\",\"fabricContainerId\":\"47955258768117\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/ac791cc4-rgjan10/providers/Microsoft.Migrate/MigrateProjects/migproj-jan10/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/ac791cc4-rgjan10/providers/Microsoft.DataReplication/replicationFabrics/targappjan10ccb8replicationfabric\",\"name\":\"targappjan10ccb8replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"v-demanc@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-01-10T21:22:35.1776827+00:00\",\"lastModifiedBy\":\"v-demanc@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-01-10T21:22:35.1776827+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"9927eb9b-fd93-4acf-805a-e5eeb92499ea\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/applianceDemoRG/providers/Microsoft.OffAzure/HyperVSites/srcAppUXDemo0970site\",\"fabricResourceId\":\"5390806089357323163\",\"fabricContainerId\":\"1722373893216\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/applianceDemoRG/providers/Microsoft.Migrate/MigrateProjects/applianceDemoProj/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/applianceDemoRG/providers/Microsoft.DataReplication/replicationFabrics/srcAppUXDemo47bbreplicationfabric\",\"name\":\"srcAppUXDemo47bbreplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-01-12T22:11:57.0844168+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-01-12T22:11:57.0844168+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"355d9232-4887-46c2-9bbf-bed1ac7af476\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digot_0113/providers/Microsoft.OffAzure/HyperVSites/dg0113src11181site\",\"fabricResourceId\":\"5098717473689932338\",\"fabricContainerId\":\"2108414823105\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digot_0113/providers/Microsoft.Migrate/MigrateProjects/digot0113/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digot_0113/providers/Microsoft.DataReplication/replicationFabrics/dg0113src15fa7replicationfabric\",\"name\":\"dg0113src15fa7replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"digot@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-01-13T08:36:41.180452+00:00\",\"lastModifiedBy\":\"digot@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-01-13T08:36:41.180452+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"f93be94e-b220-4baa-b1f8-d689d2dc50ed\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digot_0113/providers/Microsoft.OffAzure/HyperVSites/dg0113tar17262site\",\"applianceName\":[\"dg0113tar1\"],\"cluster\":{\"clusterName\":\"rnu-0103.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjvmmigtestrgu01u03/providers/Microsoft.AzureStackHCI/clusters/RNU-0103\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5452366153575557454\",\"fabricContainerId\":\"2108143884972\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digot_0113/providers/Microsoft.Migrate/MigrateProjects/digot0113/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/digot_0113/providers/Microsoft.DataReplication/replicationFabrics/dg0113tar1ba12replicationfabric\",\"name\":\"dg0113tar1ba12replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"digot@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-01-13T09:13:32.4446168+00:00\",\"lastModifiedBy\":\"digot@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-01-13T09:13:32.4446168+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"704aa387-0150-44dc-81a1-0ddc97c1af1c\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestw2k19clu/providers/Microsoft.OffAzure/HyperVSites/HyperV-1ff247bsite\",\"fabricResourceId\":\"4961842334448395143\",\"fabricContainerId\":\"2263582892632\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestw2k19clu/providers/Microsoft.Migrate/MigrateProjects/aszmigtest1ff247b/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestw2k19clu/providers/Microsoft.DataReplication/replicationFabrics/HyperV-1ff247b38a4replicationfabric\",\"name\":\"HyperV-1ff247b38a4replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vmmige2etest@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-01-13T12:55:18.3651293+00:00\",\"lastModifiedBy\":\"vmmige2etest@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-01-13T12:55:18.3651293+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"54e77aef-2e64-4118-b4b0-3daf10db0a03\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestw2k19clu/providers/Microsoft.OffAzure/HyperVSites/asz-1ff247bsite\",\"applianceName\":[\"asz-1ff247b\"],\"cluster\":{\"clusterName\":\"clrn03u05.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgCLRN03U0507/providers/Microsoft.AzureStackHCI/clusters/CLRN03U05hci\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4690550020362435311\",\"fabricContainerId\":\"2250966545573\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestw2k19clu/providers/Microsoft.Migrate/MigrateProjects/aszmigtest1ff247b/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestw2k19clu/providers/Microsoft.DataReplication/replicationFabrics/asz-1ff247b11e4replicationfabric\",\"name\":\"asz-1ff247b11e4replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vmmige2etest@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-01-13T13:11:34.9862931+00:00\",\"lastModifiedBy\":\"vmmige2etest@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-01-13T13:11:34.9862931+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"23a60991-7dc8-487a-8fb4-3a3148e45941\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/kerimha011323/providers/Microsoft.OffAzure/HyperVSites/kerim0113234145site\",\"fabricResourceId\":\"5222625016434526609\",\"fabricContainerId\":\"2668793460743\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/kerimha011323/providers/Microsoft.Migrate/MigrateProjects/kerimha011323/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/kerimha011323/providers/Microsoft.DataReplication/replicationFabrics/kerim011323f0abreplicationfabric\",\"name\":\"kerim011323f0abreplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"kerimha@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-01-14T00:29:13.6583873+00:00\",\"lastModifiedBy\":\"kerimha@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-01-14T00:29:13.6583873+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"f167b9c4-1070-439c-b79c-3723783b917b\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/Kerimha1204/providers/Microsoft.OffAzure/HyperVSites/kerimtgt01138000site\",\"applianceName\":[\"kerimtgt0113\"],\"cluster\":{\"clusterName\":\"clrn03u05.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgCLRN03U0507/providers/Microsoft.AzureStackHCI/clusters/CLRN03U05hci\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4871786974180522436\",\"fabricContainerId\":\"2701595187003\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/Kerimha1204/providers/Microsoft.Migrate/MigrateProjects/kerimha1204az/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/Kerimha1204/providers/Microsoft.DataReplication/replicationFabrics/kerimtgt0113a8e7replicationfabric\",\"name\":\"kerimtgt0113a8e7replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"kerimha@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-01-14T01:23:54.9838097+00:00\",\"lastModifiedBy\":\"kerimha@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-01-14T01:23:54.9838097+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"361dcb3f-5802-4060-96ce-b47b29dddd9f\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/kerimha011323/providers/Microsoft.OffAzure/HyperVSites/kerimtgt0756site\",\"applianceName\":[\"kerimtgt\"],\"cluster\":{\"clusterName\":\"clrn03u05.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgCLRN03U0507/providers/Microsoft.AzureStackHCI/clusters/CLRN03U05hci\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4638804382712711999\",\"fabricContainerId\":\"2719486352433\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/kerimha011323/providers/Microsoft.Migrate/MigrateProjects/kerimha011323/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/kerimha011323/providers/Microsoft.DataReplication/replicationFabrics/kerimtgt4994replicationfabric\",\"name\":\"kerimtgt4994replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"kerimha@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-01-14T01:53:44.5399902+00:00\",\"lastModifiedBy\":\"kerimha@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-01-14T01:53:44.5399902+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"1e0f1dc9-80a2-4d0c-993e-2ad20f522d72\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/terry-migrate02/providers/Microsoft.OffAzure/HyperVSites/source016377site\",\"fabricResourceId\":\"5551953874418343369\",\"fabricContainerId\":\"4853919755183\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/terry-migrate02/providers/Microsoft.Migrate/MigrateProjects/terry-proj02/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/terry-migrate02/providers/Microsoft.DataReplication/replicationFabrics/source01bad6replicationfabric\",\"name\":\"source01bad6replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"b-testo@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-01-16T13:29:51.546184+00:00\",\"lastModifiedBy\":\"b-testo@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-01-16T13:29:51.546184+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"976a08f2-1a74-46a1-8522-29a0c665019a\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/terry-migrate02/providers/Microsoft.OffAzure/HyperVSites/target012417site\",\"applianceName\":[\"target01\"],\"cluster\":{\"clusterName\":\"ax640-cl1.man.local\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/terrystorey/providers/Microsoft.AzureStackHCI/clusters/ax640-cl1\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5089378141964208370\",\"fabricContainerId\":\"4888359300689\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/terry-migrate02/providers/Microsoft.Migrate/MigrateProjects/terry-proj02/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/terry-migrate02/providers/Microsoft.DataReplication/replicationFabrics/target01553dreplicationfabric\",\"name\":\"target01553dreplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"b-testo@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-01-16T13:49:54.952673+00:00\",\"lastModifiedBy\":\"b-testo@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-01-16T13:49:54.952673+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"431ceb11-9136-4b0c-baaf-aada50549e3c\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/myazmigrg/providers/Microsoft.OffAzure/HyperVSites/myazmigapp31884site\",\"fabricResourceId\":\"5407856914805353233\",\"fabricContainerId\":\"3452181184148\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/myazmigrg/providers/Microsoft.Migrate/MigrateProjects/myazmigrateproj3/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/myazmigrg/providers/Microsoft.DataReplication/replicationFabrics/myazmigapp37f8freplicationfabric\",\"name\":\"myazmigapp37f8freplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"alkohli@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-01-27T23:30:22.073519+00:00\",\"lastModifiedBy\":\"alkohli@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-01-27T23:30:22.073519+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"5c049809-a47d-4c56-8173-0836a89dc972\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/myazmigrg/providers/Microsoft.OffAzure/HyperVSites/myazmigtar13558site\",\"applianceName\":[\"myazmigtar1\"],\"cluster\":{\"clusterName\":\"rnu-0103.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vjvmmigtestrgu01u03/providers/Microsoft.AzureStackHCI/clusters/RNU-0103\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5500764853201311753\",\"fabricContainerId\":\"19735553096\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/myazmigrg/providers/Microsoft.Migrate/MigrateProjects/myazmigrateproj3/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/myazmigrg/providers/Microsoft.DataReplication/replicationFabrics/myazmigtar14500replicationfabric\",\"name\":\"myazmigtar14500replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"alkohli@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-02-08T16:26:53.886359+00:00\",\"lastModifiedBy\":\"alkohli@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-02-08T16:26:53.886359+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"8b376742-d453-401e-8ba5-55f386018d0f\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/Kerimha28/providers/Microsoft.OffAzure/HyperVSites/kerimha28src5352site\",\"fabricResourceId\":\"4620363723011745602\",\"fabricContainerId\":\"275505420724\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/Kerimha28/providers/Microsoft.Migrate/MigrateProjects/Kerimha28/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/Kerimha28/providers/Microsoft.DataReplication/replicationFabrics/kerimha28srccb4breplicationfabric\",\"name\":\"kerimha28srccb4breplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"kerimha@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-02-09T01:41:36.7323908+00:00\",\"lastModifiedBy\":\"kerimha@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-02-09T01:41:36.7323908+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"c68c3f1a-2079-411b-bf51-4ac42098518b\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/Kerimha28/providers/Microsoft.OffAzure/HyperVSites/kerimha28tgt4715site\",\"applianceName\":[\"kerimha28tgt\"],\"cluster\":{\"clusterName\":\"clrn03u05.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgCLRN03U0507/providers/Microsoft.AzureStackHCI/clusters/CLRN03U05hci\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4691379144230715162\",\"fabricContainerId\":\"547437981505\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/Kerimha28/providers/Microsoft.Migrate/MigrateProjects/Kerimha28/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/Kerimha28/providers/Microsoft.DataReplication/replicationFabrics/kerimha28tgt3152replicationfabric\",\"name\":\"kerimha28tgt3152replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"kerimha@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-02-09T07:06:28.9146454+00:00\",\"lastModifiedBy\":\"kerimha@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-02-09T07:06:28.9146454+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"9b657821-090c-4972-b07a-492e764dba35\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/migrationDemoRG/providers/Microsoft.OffAzure/HyperVSites/targetAppJnar7218site\",\"applianceName\":[\"targetAppJnar\"],\"cluster\":{\"clusterName\":\"clrn03u05.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgCLRN03U0507/providers/Microsoft.AzureStackHCI/clusters/CLRN03U05hci\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5292302461865130017\",\"fabricContainerId\":\"5417236550658\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/migrationDemoRG/providers/Microsoft.Migrate/MigrateProjects/migrationDemoProj/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/migrationDemoRG/providers/Microsoft.DataReplication/replicationFabrics/targetAppJnar5f17replicationfabric\",\"name\":\"targetAppJnar5f17replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-02-14T22:22:38.9245002+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-02-14T22:22:38.9245002+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"0261fbfe-d5d4-4256-bddb-002706b2ff35\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/migrationDemoRG/providers/Microsoft.OffAzure/HyperVSites/newTgtAppJnar7166site\",\"applianceName\":[\"newTgtAppJnar\"],\"cluster\":{\"clusterName\":\"clrn03u05.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgCLRN03U0507/providers/Microsoft.AzureStackHCI/clusters/CLRN03U05hci\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4780243161050119166\",\"fabricContainerId\":\"19036500399450\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/migrationDemoRG/providers/Microsoft.Migrate/MigrateProjects/migrationDemoProj/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/migrationDemoRG/providers/Microsoft.DataReplication/replicationFabrics/newTgtAppJnar3ae5replicationfabric\",\"name\":\"newTgtAppJnar3ae5replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-02-14T23:46:43.7052514+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-02-14T23:46:43.7052514+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"eb65f41f-5dd2-4fca-a93c-c6dd51c7f978\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/migrationDemoRG/providers/Microsoft.OffAzure/HyperVSites/newTarget6102site\",\"applianceName\":[\"newTargetAp\"],\"cluster\":{\"clusterName\":\"clrn03u05.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgCLRN03U0507/providers/Microsoft.AzureStackHCI/clusters/CLRN03U05hci\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5749511034765702175\",\"fabricContainerId\":\"19059077036601\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/migrationDemoRG/providers/Microsoft.Migrate/MigrateProjects/migrationDemoProj/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/migrationDemoRG/providers/Microsoft.DataReplication/replicationFabrics/newTargetApa6f7replicationfabric\",\"name\":\"newTargetApa6f7replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-02-15T00:24:21.4756154+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-02-15T00:24:21.4756154+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"86780606-e23f-4c78-bb40-b2191b262da1\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.OffAzure/HyperVSites/sourceVM18150site\",\"fabricResourceId\":\"5510402906554631686\",\"fabricContainerId\":\"12935367207847\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.Migrate/MigrateProjects/jnarProject-03-13/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.DataReplication/replicationFabrics/sourceVM1bc8breplicationfabric\",\"name\":\"sourceVM1bc8breplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-03-13T23:46:10.2732493+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-03-13T23:46:10.2732493+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"49d4d671-3410-4dc7-a44d-d12c9a239c03\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.OffAzure/HyperVSites/targetVM25023site\",\"applianceName\":[\"targetVM2\"],\"cluster\":{\"clusterName\":\"clrn03u05.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgCLRN03U0507/providers/Microsoft.AzureStackHCI/clusters/CLRN03U05hci\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5604505505848678001\",\"fabricContainerId\":\"13560457977584\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.Migrate/MigrateProjects/jnarProject-03-13/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.DataReplication/replicationFabrics/targetVM20b5ereplicationfabric\",\"name\":\"targetVM20b5ereplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-03-14T17:45:49.433009+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-03-14T17:45:49.433009+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"ababf520-3c8b-4107-9ba1-2e0c5624515c\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.OffAzure/HyperVSites/targetApp19313site\",\"applianceName\":[\"targetApp1\"],\"cluster\":{\"clusterName\":\"clrn03u05.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgCLRN03U0507/providers/Microsoft.AzureStackHCI/clusters/CLRN03U05hci\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4685780507880584480\",\"fabricContainerId\":\"3249691176240\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.Migrate/MigrateProjects/jnarProject03-20/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.DataReplication/replicationFabrics/targetApp188e1replicationfabric\",\"name\":\"targetApp188e1replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-03-21T05:55:19.8419537+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-03-21T05:55:19.8419537+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"8cca18b5-0f1f-4a9f-a32f-48d94e0c36b9\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.OffAzure/HyperVSites/sourceApp13977site\",\"fabricResourceId\":\"5377033108284119221\",\"fabricContainerId\":\"3586139307318\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.Migrate/MigrateProjects/jnarProject03-20/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.DataReplication/replicationFabrics/sourceApp1a5b6replicationfabric\",\"name\":\"sourceApp1a5b6replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-03-21T15:15:58.9867485+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-03-21T15:15:58.9867485+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"1fd52a7a-3c03-4eeb-bca3-1f0a754b0515\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.OffAzure/HyperVSites/testSourceApp9830site\",\"fabricResourceId\":\"5686704938602015354\",\"fabricContainerId\":\"10694512911302\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.Migrate/MigrateProjects/jnarProject03-20/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.DataReplication/replicationFabrics/testSourceApp9ee7replicationfabric\",\"name\":\"testSourceApp9ee7replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-03-29T20:43:21.0080757+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-03-29T20:43:21.0080757+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"df288836-2a8d-4838-a37e-1746e596ee65\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.OffAzure/HyperVSites/testSourceApp14661site\",\"fabricResourceId\":\"5203956158249338934\",\"fabricContainerId\":\"10741043407967\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.Migrate/MigrateProjects/jnarProject03-20/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.DataReplication/replicationFabrics/testSourceApp163ebreplicationfabric\",\"name\":\"testSourceApp163ebreplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-03-29T22:00:55.1138207+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-03-29T22:00:55.1138207+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"318e617c-bcec-435f-8779-962bdc0c5bb5\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.OffAzure/HyperVSites/testSourceApp24660site\",\"fabricResourceId\":\"4854806645958402428\",\"fabricContainerId\":\"10790000348590\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.Migrate/MigrateProjects/jnarProject03-20/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.DataReplication/replicationFabrics/testSourceApp23d3freplicationfabric\",\"name\":\"testSourceApp23d3freplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-03-29T23:22:36.0726649+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-03-29T23:22:36.0726649+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"e3223fdd-785c-4992-865b-5fc4cc0355ff\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.OffAzure/HyperVSites/testTgtApp6624site\",\"fabricResourceId\":\"5301432051711492061\",\"fabricContainerId\":\"11659567815658\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.Migrate/MigrateProjects/jnarProject03-20/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.DataReplication/replicationFabrics/testTgtAppd1d2replicationfabric\",\"name\":\"testTgtAppd1d2replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-03-30T23:31:52.8903596+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-03-30T23:31:52.8903596+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"4aa929d8-7a03-4b8e-8072-f46fb67aadf6\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.OffAzure/HyperVSites/testsrcapp3341site\",\"fabricResourceId\":\"5444423154093599192\",\"fabricContainerId\":\"12409681427666\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.Migrate/MigrateProjects/jnarProject03-20/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.DataReplication/replicationFabrics/testsrcappc129replicationfabric\",\"name\":\"testsrcappc129replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-03-31T20:22:04.4352292+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-03-31T20:22:04.4352292+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"b598a8bf-846d-499b-9ea6-7d670375e7ad\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.OffAzure/HyperVSites/testSrcApp13332site\",\"fabricResourceId\":\"5303978592891873471\",\"fabricContainerId\":\"16626752668076\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.Migrate/MigrateProjects/jnarProject03-20/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.DataReplication/replicationFabrics/testSrcApp126d7replicationfabric\",\"name\":\"testSrcApp126d7replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-04-05T17:30:37.1028447+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-04-05T17:30:37.1028447+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"236165f0-0259-40fc-bab8-0e54132f88f4\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.OffAzure/HyperVSites/testSrcApp23333site\",\"fabricResourceId\":\"4682620294427403760\",\"fabricContainerId\":\"16684235580562\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.Migrate/MigrateProjects/jnarProject03-20/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.DataReplication/replicationFabrics/testSrcApp28fd3replicationfabric\",\"name\":\"testSrcApp28fd3replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-04-05T19:06:21.8018+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-04-05T19:06:21.8018+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"e88d77a2-d3f7-4c9e-b203-5e6300d6ed30\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.OffAzure/HyperVSites/testSrcApp33334site\",\"fabricResourceId\":\"5521083254914774946\",\"fabricContainerId\":\"17635074917938\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.Migrate/MigrateProjects/jnarProject03-20/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.DataReplication/replicationFabrics/testSrcApp39f00replicationfabric\",\"name\":\"testSrcApp39f00replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-04-06T21:31:16.5850349+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-04-06T21:31:16.5850349+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"b8f693f6-a91d-4442-a815-ab813c4e8529\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.OffAzure/HyperVSites/testSrcApp43335site\",\"fabricResourceId\":\"4918679688164316150\",\"fabricContainerId\":\"17688075157153\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.Migrate/MigrateProjects/jnarProject03-20/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.DataReplication/replicationFabrics/testSrcApp4f00ereplicationfabric\",\"name\":\"testSrcApp4f00ereplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-04-06T22:59:26.0642352+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-04-06T22:59:26.0642352+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"184a8909-0935-4ddd-964a-5bebfd66e5ed\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.OffAzure/HyperVSites/jnarSrcApp9028site\",\"fabricResourceId\":\"5610650834418960649\",\"fabricContainerId\":\"24523933352703\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.Migrate/MigrateProjects/jnarProject4-14New/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.DataReplication/replicationFabrics/jnarSrcApp8ce6replicationfabric\",\"name\":\"jnarSrcApp8ce6replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-04-14T20:52:45.7941363+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-04-14T20:52:45.7941363+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"3253ac01-0107-464d-8f36-f0c5ff9020fe\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.OffAzure/HyperVSites/jnarTgtApp2161site\",\"applianceName\":[\"jnarTgtApp\"],\"cluster\":{\"clusterName\":\"clrn03u05.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgCLRN03U0507/providers/Microsoft.AzureStackHCI/clusters/CLRN03U05hci\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5065706286282419201\",\"fabricContainerId\":\"24577686860832\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.Migrate/MigrateProjects/jnarProject4-14New/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.DataReplication/replicationFabrics/jnarTgtApp807breplicationfabric\",\"name\":\"jnarTgtApp807breplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-04-14T22:22:10.8860358+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-04-14T22:22:10.8860358+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"a49f79d5-1e4c-4e2e-90fa-060d379607ca\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.OffAzure/HyperVSites/jnarTestTgt4528site\",\"applianceName\":[\"jnarTestTgt\"],\"cluster\":{\"clusterName\":\"clrn03u05.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgCLRN03U0507/providers/Microsoft.AzureStackHCI/clusters/CLRN03U05hci\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5633473498415331797\",\"fabricContainerId\":\"4370841921390\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.Migrate/MigrateProjects/jnarProject4-14New/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.DataReplication/replicationFabrics/jnarTestTgtba31replicationfabric\",\"name\":\"jnarTestTgtba31replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-04-26T05:47:06.7870368+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-04-26T05:47:06.7870368+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"6119ad6a-4d38-411f-8d21-31967b20d5f1\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/hafeworkmay8-rg/providers/Microsoft.OffAzure/HyperVSites/may8src1652site\",\"fabricResourceId\":\"4692554241285926250\",\"fabricContainerId\":\"16893619601005\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/hafeworkmay8-rg/providers/Microsoft.Migrate/MigrateProjects/hafeworkmay8Prj/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/hafeworkmay8-rg/providers/Microsoft.DataReplication/replicationFabrics/may8src7b22replicationfabric\",\"name\":\"may8src7b22replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"helenafework@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-05-10T17:20:30.0922936+00:00\",\"lastModifiedBy\":\"helenafework@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-05-10T17:20:30.0922936+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"2543ab0a-fbe1-4320-b8e9-03e2b63bf2d5\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/hafeworkmay8-rg/providers/Microsoft.OffAzure/HyperVSites/may8107tar2283site\",\"applianceName\":[\"may8107tar\"],\"cluster\":{\"clusterName\":\"clrp09u15.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/clrp09u15RG/providers/Microsoft.AzureStackHCI/clusters/clrp09u15hci\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4837142944207317770\",\"fabricContainerId\":\"16896677625787\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/hafeworkmay8-rg/providers/Microsoft.Migrate/MigrateProjects/hafeworkmay8Prj/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/hafeworkmay8-rg/providers/Microsoft.DataReplication/replicationFabrics/may8107tarf9d8replicationfabric\",\"name\":\"may8107tarf9d8replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"helenafework@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-05-10T18:01:21.380487+00:00\",\"lastModifiedBy\":\"helenafework@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-05-10T18:01:21.380487+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"0c74174a-81c4-4d1e-91a1-08f24e2a54fb\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.OffAzure/HyperVSites/SrcApp05114963site\",\"fabricResourceId\":\"5557021669244278602\",\"fabricContainerId\":\"17799784246143\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.Migrate/MigrateProjects/jnarProj0511/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.DataReplication/replicationFabrics/SrcApp051111b4replicationfabric\",\"name\":\"SrcApp051111b4replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-05-11T18:30:45.5358697+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-05-11T18:30:45.5358697+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"e6c8670c-66a8-473b-a090-98b35faf2c9f\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.OffAzure/HyperVSites/TgtApp0518587site\",\"applianceName\":[\"TgtApp051\"],\"cluster\":{\"clusterName\":\"clrn03u05.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgCLRN03U0507/providers/Microsoft.AzureStackHCI/clusters/CLRN03U05hci\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5132809075931244300\",\"fabricContainerId\":\"17896312046491\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.Migrate/MigrateProjects/jnarProj0511/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarProjectRG/providers/Microsoft.DataReplication/replicationFabrics/TgtApp051587breplicationfabric\",\"name\":\"TgtApp051587breplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-05-11T21:29:46.5840343+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-05-11T21:29:46.5840343+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"b2674720-4989-4305-8224-ca08ac7586f6\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg1/providers/Microsoft.OffAzure/HyperVSites/samlee3-srcsea3093site\",\"fabricResourceId\":\"4829347031177185056\",\"fabricContainerId\":\"21395255351417\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg1/providers/Microsoft.Migrate/MigrateProjects/samlee3valcanary/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg1/providers/Microsoft.DataReplication/replicationFabrics/samlee3-srcsea209ereplicationfabric\",\"name\":\"samlee3-srcsea209ereplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"samlee3@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-05-15T22:23:15.7233752+00:00\",\"lastModifiedBy\":\"samlee3@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-05-15T22:23:15.7233752+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"9366577b-1cc6-430b-9809-e03c116d4496\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg1/providers/Microsoft.OffAzure/HyperVSites/samlee3tgtsea16374site\",\"applianceName\":[\"samlee3tgtsea1\"],\"cluster\":{\"clusterName\":\"mayadahciclus3.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/clusters/mayadahciclus3\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4830986664487049083\",\"fabricContainerId\":\"21400329675776\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg1/providers/Microsoft.Migrate/MigrateProjects/samlee3valcanary/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg1/providers/Microsoft.DataReplication/replicationFabrics/samlee3tgtsea15ad3replicationfabric\",\"name\":\"samlee3tgtsea15ad3replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"samlee3@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-05-15T23:07:32.6952074+00:00\",\"lastModifiedBy\":\"samlee3@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-05-15T23:07:32.6952074+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"e39b2e9d-0f1d-44b2-84bd-d6e42a474bb4\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"vmwareSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadaseacanprj3-rg/providers/Microsoft.OffAzure/VMwareSites/vmwapp15539site\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadaseacanprj3-rg/providers/Microsoft.Migrate/MigrateProjects/mayadaseacanprj3/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"instanceType\":\"VMwareMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadaseacanprj3-rg/providers/Microsoft.DataReplication/replicationFabrics/vmwapp14983replicationfabric\",\"name\":\"vmwapp14983replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"mayada@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-06-13T05:34:59.2983908+00:00\",\"lastModifiedBy\":\"mayada@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-06-13T05:34:59.2983908+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"26b987a4-950a-49fc-8f7f-0ea7c0a31589\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadaseacanprj3-rg/providers/Microsoft.OffAzure/HyperVSites/hvapp25170site\",\"applianceName\":[\"hvapp2\"],\"cluster\":{\"clusterName\":\"mayadahciclus3.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/clusters/mayadahciclus3\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5331299929731729316\",\"fabricContainerId\":\"21372075130068\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadaseacanprj3-rg/providers/Microsoft.Migrate/MigrateProjects/mayadaseacanprj3/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadaseacanprj3-rg/providers/Microsoft.DataReplication/replicationFabrics/hvapp21e4dreplicationfabric\",\"name\":\"hvapp21e4dreplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"mayada@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-06-13T06:37:59.0498465+00:00\",\"lastModifiedBy\":\"mayada@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-06-13T06:37:59.0498465+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"b24b7d82-76e2-4480-85b9-5ca96d6ddd9c\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"vmwareSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarvmwarerg/providers/Microsoft.OffAzure/VMwareSites/sourcevmwApp8156site\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarvmwarerg/providers/Microsoft.Migrate/MigrateProjects/jnarvmw0615/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"instanceType\":\"VMwareMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarvmwarerg/providers/Microsoft.DataReplication/replicationFabrics/sourcevmwApp0e3dreplicationfabric\",\"name\":\"sourcevmwApp0e3dreplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-06-15T15:42:27.4040713+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-06-15T15:42:27.4040713+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"5a64766a-708d-4dd9-8d53-e819dce44bf5\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/hafeworkJune15-rg/providers/Microsoft.OffAzure/HyperVSites/srcjune158101site\",\"fabricResourceId\":\"5609638563275896426\",\"fabricContainerId\":\"24327983266716\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/hafeworkJune15-rg/providers/Microsoft.Migrate/MigrateProjects/hafeworkJune15prj/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/hafeworkJune15-rg/providers/Microsoft.DataReplication/replicationFabrics/srcjune15254ereplicationfabric\",\"name\":\"srcjune15254ereplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"helenafework@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-06-16T17:20:44.4345415+00:00\",\"lastModifiedBy\":\"helenafework@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-06-16T17:20:44.4345415+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"5f094c82-6a6b-4610-978f-61f887006f8d\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gdjune2/providers/Microsoft.OffAzure/HyperVSites/srca0100site\",\"fabricResourceId\":\"5048652191670815874\",\"fabricContainerId\":\"26787743398196\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gdjune2/providers/Microsoft.Migrate/MigrateProjects/gdjune2/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gdjune2/providers/Microsoft.DataReplication/replicationFabrics/srca1702replicationfabric\",\"name\":\"srca1702replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"gadeshpa@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-06-19T13:04:10.1476075+00:00\",\"lastModifiedBy\":\"gadeshpa@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-06-19T13:04:10.1476075+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"5b6efd0e-0765-45e2-90d9-e5cf9e9c63e5\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"vmwareSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarvmwarerg/providers/Microsoft.OffAzure/VMwareSites/srcAppvmw9589site\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarvmwarerg/providers/Microsoft.Migrate/MigrateProjects/jnarVMWare0613/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"instanceType\":\"VMwareMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarvmwarerg/providers/Microsoft.DataReplication/replicationFabrics/srcAppvmw006areplicationfabric\",\"name\":\"srcAppvmw006areplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-06-19T21:28:26.6358355+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-06-19T21:28:26.6358355+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"67701afb-600e-4781-bb29-707de50372aa\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarvmwarerg/providers/Microsoft.OffAzure/HyperVSites/tvtAppvmware0097site\",\"applianceName\":[\"tvtAppvmware\"],\"cluster\":{\"clusterName\":\"clrn03u05.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgCLRN03U0507/providers/Microsoft.AzureStackHCI/clusters/CLRN03U05hci\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5152505063669766907\",\"fabricContainerId\":\"27149285866394\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarvmwarerg/providers/Microsoft.Migrate/MigrateProjects/jnarVMWare0613/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarvmwarerg/providers/Microsoft.DataReplication/replicationFabrics/tvtAppvmware2af5replicationfabric\",\"name\":\"tvtAppvmware2af5replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-06-19T23:06:43.5977753+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-06-19T23:06:43.5977753+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"d84c9b88-0d01-4d53-a88a-73ef1833abd0\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"vmwareSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/migrateshsathee04-rg/providers/Microsoft.OffAzure/VMwareSites/appliance10847site\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/migrateshsathee04-rg/providers/Microsoft.Migrate/MigrateProjects/migrateshsathee04/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"instanceType\":\"VMwareMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/migrateshsathee04-rg/providers/Microsoft.DataReplication/replicationFabrics/appliance12359replicationfabric\",\"name\":\"appliance12359replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"shsathee@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-06-22T21:28:28.9667228+00:00\",\"lastModifiedBy\":\"shsathee@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-06-22T21:43:36.8159651+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"bb24cf3c-de8b-4778-9892-dd9c607a883c\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"vmwareSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarvmwarerg/providers/Microsoft.OffAzure/VMwareSites/sourceApp07055176site\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarvmwarerg/providers/Microsoft.Migrate/MigrateProjects/jnarvmw0705/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"instanceType\":\"VMwareMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarvmwarerg/providers/Microsoft.DataReplication/replicationFabrics/sourceApp07056d4freplicationfabric\",\"name\":\"sourceApp07056d4freplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-07-05T16:50:34.9569664+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-07-05T16:50:34.9569664+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"ddaf3b10-395b-43bb-ab3b-3fdc3f300392\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/migrateshsathee04-rg/providers/Microsoft.OffAzure/HyperVSites/ASZappliance2080site\",\"applianceName\":[\"ASZappliance\"],\"cluster\":{\"clusterName\":\"test1nodecluster.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/clusters/mayadahciclus3\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4880557687910120208\",\"fabricContainerId\":\"40954262124362\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/migrateshsathee04-rg/providers/Microsoft.Migrate/MigrateProjects/migrateshsathee04/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/migrateshsathee04-rg/providers/Microsoft.DataReplication/replicationFabrics/ASZappliance245areplicationfabric\",\"name\":\"ASZappliance245areplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"shsathee@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-07-05T22:35:11.2407747+00:00\",\"lastModifiedBy\":\"shsathee@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-07-05T22:35:11.2407747+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"0ba5508e-f0da-4007-8a5b-590407f02a9a\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"vmwareSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarvmwarerg/providers/Microsoft.OffAzure/VMwareSites/srcvmware4798site\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarvmwarerg/providers/Microsoft.Migrate/MigrateProjects/jnarvmw0705/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"instanceType\":\"VMwareMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarvmwarerg/providers/Microsoft.DataReplication/replicationFabrics/srcvmwarece7creplicationfabric\",\"name\":\"srcvmwarece7creplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-07-10T22:44:41.6931773+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-07-10T22:44:41.6931773+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"ced82a13-ede4-44ca-8716-1e605d6f0bc7\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg5/providers/Microsoft.OffAzure/HyperVSites/samlee3src1094site\",\"fabricResourceId\":\"4957035906853251603\",\"fabricContainerId\":\"46095082118892\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg5/providers/Microsoft.Migrate/MigrateProjects/samlee3proj5/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg5/providers/Microsoft.DataReplication/replicationFabrics/samlee3src31fereplicationfabric\",\"name\":\"samlee3src31fereplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"samlee3@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-07-11T21:23:16.3369045+00:00\",\"lastModifiedBy\":\"samlee3@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-07-11T21:31:33.515854+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"35c1b65e-0cc2-45c5-b4bf-ec82a797cc9c\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg5/providers/Microsoft.OffAzure/HyperVSites/samlee3t0362site\",\"applianceName\":[\"samlee3t\"],\"cluster\":{\"clusterName\":\"mayadahciclus3.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/clusters/mayadahciclus3\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5027438587294103134\",\"fabricContainerId\":\"232315193307\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg5/providers/Microsoft.Migrate/MigrateProjects/samlee3proj5/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg5/providers/Microsoft.DataReplication/replicationFabrics/samlee3t285dreplicationfabric\",\"name\":\"samlee3t285dreplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"samlee3@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-07-18T00:51:07.9333378+00:00\",\"lastModifiedBy\":\"samlee3@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-07-18T00:51:07.9333378+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"742bef41-faea-4dc5-9e5f-aa2a45ed13d0\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"vmwareSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadavmw102-rg/providers/Microsoft.OffAzure/VMwareSites/app1026693site\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadavmw102-rg/providers/Microsoft.Migrate/MigrateProjects/mayadavmw102/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"instanceType\":\"VMwareMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadavmw102-rg/providers/Microsoft.DataReplication/replicationFabrics/app102ee04replicationfabric\",\"name\":\"app102ee04replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"mayada@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-07-19T03:15:48.3140401+00:00\",\"lastModifiedBy\":\"mayada@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-07-19T03:24:28.1077486+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"ce3ecb33-f058-4ce6-b6fe-ab857936d20c\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadavmw102-rg/providers/Microsoft.OffAzure/HyperVSites/tgtapp1022496site\",\"applianceName\":[\"tgtapp102\"],\"cluster\":{\"clusterName\":\"mayadahciclus3.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/clusters/mayadahciclus3\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5541380655733984051\",\"fabricContainerId\":\"1277748242300\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadavmw102-rg/providers/Microsoft.Migrate/MigrateProjects/mayadavmw102/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadavmw102-rg/providers/Microsoft.DataReplication/replicationFabrics/tgtapp1027ba2replicationfabric\",\"name\":\"tgtapp1027ba2replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"mayada@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-07-19T05:53:31.3851829+00:00\",\"lastModifiedBy\":\"mayada@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-07-19T05:53:31.3851829+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"f541bc43-1396-4f80-85f7-c4fb838aaba3\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg6/providers/Microsoft.OffAzure/HyperVSites/samlee3src7972site\",\"fabricResourceId\":\"5728600265096019011\",\"fabricContainerId\":\"2599083485236\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg6/providers/Microsoft.Migrate/MigrateProjects/samlee3proj6/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg6/providers/Microsoft.DataReplication/replicationFabrics/samlee3src9777replicationfabric\",\"name\":\"samlee3src9777replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"samlee3@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-07-20T17:56:06.4062256+00:00\",\"lastModifiedBy\":\"samlee3@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-07-20T18:04:38.9955433+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"e8d87ead-0aaa-49a8-8c97-92851af53a60\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg6/providers/Microsoft.OffAzure/HyperVSites/samlee3tgt7335site\",\"applianceName\":[\"samlee3tgt\"],\"cluster\":{\"clusterName\":\"mayadahciclus3.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/clusters/mayadahciclus3\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5307503890023349933\",\"fabricContainerId\":\"2645148398969\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg6/providers/Microsoft.Migrate/MigrateProjects/samlee3proj6/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg6/providers/Microsoft.DataReplication/replicationFabrics/samlee3tgte2a7replicationfabric\",\"name\":\"samlee3tgte2a7replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"samlee3@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-07-20T19:12:51.1938115+00:00\",\"lastModifiedBy\":\"samlee3@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-07-20T19:12:51.1938115+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"6988f30e-a6d4-4df4-8fd6-3f84fd4e14a9\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/myazuremigrg/providers/Microsoft.OffAzure/HyperVSites/myazmigsapp6386site\",\"fabricResourceId\":\"5617298066471711502\",\"fabricContainerId\":\"11568720235881\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/myazuremigrg/providers/Microsoft.Migrate/MigrateProjects/myazmigproject1/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/myazuremigrg/providers/Microsoft.DataReplication/replicationFabrics/myazmigsappfd11replicationfabric\",\"name\":\"myazmigsappfd11replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"alkohli@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-08-04T22:18:53.6555325+00:00\",\"lastModifiedBy\":\"alkohli@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-08-04T22:31:06.1583503+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"3e4cfc9c-444f-4df7-b293-3f31f2075a70\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gdauto/providers/Microsoft.OffAzure/HyperVSites/gdennewproj2400site\",\"fabricResourceId\":\"5618034167306321052\",\"fabricContainerId\":\"13616256047688\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gdauto/providers/Microsoft.Migrate/MigrateProjects/gdauto/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/gdauto/providers/Microsoft.DataReplication/replicationFabrics/gdennewproj955freplicationfabric\",\"name\":\"gdennewproj955freplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"gadeshpa@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-08-07T07:31:05.8959353+00:00\",\"lastModifiedBy\":\"gadeshpa@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-08-07T07:31:05.8959353+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"bfb50ff2-b5e1-4c84-b8af-2e2fa8ee05e7\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/myazuremigrg/providers/Microsoft.OffAzure/HyperVSites/myazmigtarapp6208site\",\"applianceName\":[\"myazmigtarapp\"],\"cluster\":{\"clusterName\":\"mayadahciclus3.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/clusters/mayadahciclus3\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5513731824996913138\",\"fabricContainerId\":\"14074532515399\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/myazuremigrg/providers/Microsoft.Migrate/MigrateProjects/myazmigproject1/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/myazuremigrg/providers/Microsoft.DataReplication/replicationFabrics/myazmigtarappa7careplicationfabric\",\"name\":\"myazmigtarappa7careplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"alkohli@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-08-07T20:14:51.6278317+00:00\",\"lastModifiedBy\":\"alkohli@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-08-07T20:14:51.6278317+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"427982cf-b4ce-4a67-b826-a1d3282f44c0\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"vmwareSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vijain-vmwbb01-rg/providers/Microsoft.OffAzure/VMwareSites/vijain-appl5217site\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vijain-vmwbb01-rg/providers/Microsoft.Migrate/MigrateProjects/vijain-vmwstackselfhost/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"instanceType\":\"VMwareMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/vijain-vmwbb01-rg/providers/Microsoft.DataReplication/replicationFabrics/vijain-appl02c7replicationfabric\",\"name\":\"vijain-appl02c7replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vijain@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-08-09T05:19:09.4653461+00:00\",\"lastModifiedBy\":\"vijain@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-08-09T05:33:14.4026465+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"176fb1a6-5a00-43fd-942e-f562e95da640\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"vmwareSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarvmwarerg/providers/Microsoft.OffAzure/VMwareSites/jnarvmwApp8684site\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarvmwarerg/providers/Microsoft.Migrate/MigrateProjects/jnarvmw0808/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"instanceType\":\"VMwareMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarvmwarerg/providers/Microsoft.DataReplication/replicationFabrics/jnarvmwAppa7f3replicationfabric\",\"name\":\"jnarvmwAppa7f3replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-08-09T13:49:18.3991407+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-08-09T15:23:35.3422017+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"e460ec9b-59f8-4ef4-b256-627cc5cbaa52\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"vmwareSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srganesa-vmwbb01-rg/providers/Microsoft.OffAzure/VMwareSites/srganesasrc8483site\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srganesa-vmwbb01-rg/providers/Microsoft.Migrate/MigrateProjects/srganesa-vmwbb01/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"instanceType\":\"VMwareMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srganesa-vmwbb01-rg/providers/Microsoft.DataReplication/replicationFabrics/srganesasrca847replicationfabric\",\"name\":\"srganesasrca847replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"srganesa@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-08-09T20:24:24.9369376+00:00\",\"lastModifiedBy\":\"srganesa@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-08-09T20:45:58.2182207+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"a2acad14-6349-46a6-a4ca-7ee25e88b9ef\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarvmwarerg/providers/Microsoft.OffAzure/HyperVSites/jnarvmwtarget1694site\",\"applianceName\":[\"jnarvmwtarget\"],\"cluster\":{\"clusterName\":\"clrn03u05.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgCLRN03U0507/providers/Microsoft.AzureStackHCI/clusters/CLRN03U05hci\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5090865596701912340\",\"fabricContainerId\":\"15809248409725\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarvmwarerg/providers/Microsoft.Migrate/MigrateProjects/jnarvmw0808/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnarvmwarerg/providers/Microsoft.DataReplication/replicationFabrics/jnarvmwtarget2265replicationfabric\",\"name\":\"jnarvmwtarget2265replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-08-09T20:45:50.8788626+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-08-09T20:45:50.8788626+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"5da04194-f16e-4321-96d3-5737e2f799e8\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"vmwareSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rawang-vmwbb01-rg/providers/Microsoft.OffAzure/VMwareSites/rawang-app010966site\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rawang-vmwbb01-rg/providers/Microsoft.Migrate/MigrateProjects/rawang-vmwbb01/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"instanceType\":\"VMwareMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rawang-vmwbb01-rg/providers/Microsoft.DataReplication/replicationFabrics/rawang-app018bf2replicationfabric\",\"name\":\"rawang-app018bf2replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"rawang@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-08-09T21:29:59.6686215+00:00\",\"lastModifiedBy\":\"rawang@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-08-09T21:36:42.5425433+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"c1cd158e-1855-4b4d-be3b-8dc601132914\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site\",\"fabricResourceId\":\"5426019882654045582\",\"fabricContainerId\":\"15873549809437\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.Migrate/MigrateProjects/samlee3proj4/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationFabrics/samlee3src48adfreplicationfabric\",\"name\":\"samlee3src48adfreplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"samlee3@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-08-09T22:33:02.1830192+00:00\",\"lastModifiedBy\":\"samlee3@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-08-09T22:39:45.739396+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"9240c292-9a77-4fbb-815c-ec6090e2f410\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srganesa-vmwbb01-rg/providers/Microsoft.OffAzure/HyperVSites/srganesatgt9120site\",\"applianceName\":[\"srganesatgt\"],\"cluster\":{\"clusterName\":\"mayadahciclus3.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/clusters/mayadahciclus3\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5745355587986702994\",\"fabricContainerId\":\"15892542231950\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srganesa-vmwbb01-rg/providers/Microsoft.Migrate/MigrateProjects/srganesa-vmwbb01/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/srganesa-vmwbb01-rg/providers/Microsoft.DataReplication/replicationFabrics/srganesatgt16f5replicationfabric\",\"name\":\"srganesatgt16f5replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"srganesa@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-08-09T22:44:55.1311107+00:00\",\"lastModifiedBy\":\"srganesa@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-08-09T22:44:55.1311107+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"0566da75-1cd8-44c3-a515-882ff8da67cf\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3t3384site\",\"applianceName\":[\"samlee3t\"],\"cluster\":{\"clusterName\":\"mayadahciclus3.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/clusters/mayadahciclus3\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4954835729166817909\",\"fabricContainerId\":\"15925759403486\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.Migrate/MigrateProjects/samlee3proj4/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationFabrics/samlee3te2acreplicationfabric\",\"name\":\"samlee3te2acreplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"samlee3@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-08-09T23:20:40.0582924+00:00\",\"lastModifiedBy\":\"samlee3@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-08-09T23:20:40.0582924+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"5d84ccde-113a-4352-8475-3678105b7aeb\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rawang-vmwbb01-rg/providers/Microsoft.OffAzure/HyperVSites/rawang-appt18858site\",\"applianceName\":[\"rawang-appt1\"],\"cluster\":{\"clusterName\":\"mayadahciclus3.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/clusters/mayadahciclus3\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4850958691006205150\",\"fabricContainerId\":\"16822411069497\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rawang-vmwbb01-rg/providers/Microsoft.Migrate/MigrateProjects/rawang-vmwbb01/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rawang-vmwbb01-rg/providers/Microsoft.DataReplication/replicationFabrics/rawang-appt15d31replicationfabric\",\"name\":\"rawang-appt15d31replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"rawang@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-08-11T00:15:03.8903211+00:00\",\"lastModifiedBy\":\"rawang@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-08-11T00:15:03.8903211+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"87f87c8f-3de5-4de7-888e-2366481f163c\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"vmwareSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-vmwbb01-rg/providers/Microsoft.OffAzure/VMwareSites/vmwbb01-src0411site\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-vmwbb01-rg/providers/Microsoft.Migrate/MigrateProjects/samlee3-vmwbb01/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"instanceType\":\"VMwareMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-vmwbb01-rg/providers/Microsoft.DataReplication/replicationFabrics/vmwbb01-srcb179replicationfabric\",\"name\":\"vmwbb01-srcb179replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"samlee3@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-08-11T18:39:04.4734211+00:00\",\"lastModifiedBy\":\"samlee3@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-08-11T18:48:29.6062974+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"69627bd0-1c95-4377-a66c-82112571854b\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"vmwareSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/lumawari-vmwbb01-rg/providers/Microsoft.OffAzure/VMwareSites/lmwvmwbb01-src2261site\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/lumawari-vmwbb01-rg/providers/Microsoft.Migrate/MigrateProjects/lumawari-vmwbb01/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"instanceType\":\"VMwareMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/lumawari-vmwbb01-rg/providers/Microsoft.DataReplication/replicationFabrics/lmwvmwbb01-srcbe3creplicationfabric\",\"name\":\"lmwvmwbb01-srcbe3creplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"lumawari@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-08-11T19:31:58.5571397+00:00\",\"lastModifiedBy\":\"lumawari@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-08-11T20:00:18.3314405+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"0a363afb-738e-4bd1-a0c2-ac08aa43a110\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-vmwbb01-rg/providers/Microsoft.OffAzure/HyperVSites/vmwbb01-tgt9774site\",\"applianceName\":[\"vmwbb01-tgt\"],\"cluster\":{\"clusterName\":\"mayadahciclus3.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/clusters/mayadahciclus3\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5463274876870998779\",\"fabricContainerId\":\"17579409171699\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-vmwbb01-rg/providers/Microsoft.Migrate/MigrateProjects/samlee3-vmwbb01/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-vmwbb01-rg/providers/Microsoft.DataReplication/replicationFabrics/vmwbb01-tgt9090replicationfabric\",\"name\":\"vmwbb01-tgt9090replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"samlee3@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-08-11T21:16:46.2494185+00:00\",\"lastModifiedBy\":\"samlee3@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-08-11T21:16:46.2494185+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"9dc00554-fce8-498c-9f55-aac1ff7712d1\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/lumawari-vmwbb01-rg/providers/Microsoft.OffAzure/HyperVSites/lmwvmwbb01-tgt2898site\",\"applianceName\":[\"lmwvmwbb01-tgt\"],\"cluster\":{\"clusterName\":\"mayadahciclus3.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/clusters/mayadahciclus3\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5299888937517450580\",\"fabricContainerId\":\"17608709857109\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/lumawari-vmwbb01-rg/providers/Microsoft.Migrate/MigrateProjects/lumawari-vmwbb01/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/lumawari-vmwbb01-rg/providers/Microsoft.DataReplication/replicationFabrics/lmwvmwbb01-tgtbfdareplicationfabric\",\"name\":\"lmwvmwbb01-tgtbfdareplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"lumawari@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-08-11T22:25:15.1941105+00:00\",\"lastModifiedBy\":\"lumawari@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-08-11T22:25:15.1941105+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"40695f37-6310-4350-a652-77e14d4b9c12\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/chengrwu_aszmige2etestw2k19sa172f/providers/Microsoft.OffAzure/HyperVSites/HyperV-1f7d087site\",\"fabricResourceId\":\"4850485720129298231\",\"fabricContainerId\":\"17942234008672\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/chengrwu_aszmige2etestw2k19sa172f/providers/Microsoft.Migrate/MigrateProjects/aszmigtest1f7d087/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/chengrwu_aszmige2etestw2k19sa172f/providers/Microsoft.DataReplication/replicationFabrics/HyperV-1f7d087e0f0replicationfabric\",\"name\":\"HyperV-1f7d087e0f0replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vmmige2etest@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-08-12T07:41:09.2348606+00:00\",\"lastModifiedBy\":\"vmmige2etest@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-08-12T07:41:09.2348606+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"95c5e855-1cf5-433a-834f-14253e6b3f31\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/chengrwu_aszmige2etestw2k19sa172f/providers/Microsoft.OffAzure/HyperVSites/asz-1f7d087site\",\"applianceName\":[\"asz-1f7d087\"],\"cluster\":{\"clusterName\":\"rn03-u0911.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/680d0dad-59aa-4464-adf3-b34b2b427e8c/resourceGroups/vjvmmigtest01RG/providers/Microsoft.AzureStackHCI/clusters/hciclu09011\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4844216190295730261\",\"fabricContainerId\":\"17941613112792\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/chengrwu_aszmige2etestw2k19sa172f/providers/Microsoft.Migrate/MigrateProjects/aszmigtest1f7d087/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/chengrwu_aszmige2etestw2k19sa172f/providers/Microsoft.DataReplication/replicationFabrics/asz-1f7d0874f0ereplicationfabric\",\"name\":\"asz-1f7d0874f0ereplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vmmige2etest@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-08-12T07:59:50.2542486+00:00\",\"lastModifiedBy\":\"vmmige2etest@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-08-12T07:59:50.2542486+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"68e6b3a3-a4d4-41d2-a248-caefeede311b\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"vmwareSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/helenafework-vmwbb01-rg/providers/Microsoft.OffAzure/VMwareSites/hafeworkSrc5000site\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/helenafework-vmwbb01-rg/providers/Microsoft.Migrate/MigrateProjects/helenafework-vmwbb01/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"instanceType\":\"VMwareMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/helenafework-vmwbb01-rg/providers/Microsoft.DataReplication/replicationFabrics/hafeworkSrc1165replicationfabric\",\"name\":\"hafeworkSrc1165replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"helenafework@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-08-14T14:42:55.7736262+00:00\",\"lastModifiedBy\":\"helenafework@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-08-14T14:54:16.272195+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"dcec06c6-7eb8-42c5-ba05-fdd7fe8cf514\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/helenafework-vmwbb01-rg/providers/Microsoft.OffAzure/HyperVSites/hafeworkTar5449site\",\"applianceName\":[\"hafeworkTar\"],\"cluster\":{\"clusterName\":\"mayadahciclus3.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/clusters/mayadahciclus3\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4811391109360780998\",\"fabricContainerId\":\"19983312792375\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/helenafework-vmwbb01-rg/providers/Microsoft.Migrate/MigrateProjects/helenafework-vmwbb01/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/helenafework-vmwbb01-rg/providers/Microsoft.DataReplication/replicationFabrics/hafeworkTar23e2replicationfabric\",\"name\":\"hafeworkTar23e2replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"helenafework@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-08-14T16:22:58.6560617+00:00\",\"lastModifiedBy\":\"helenafework@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-08-14T16:22:58.6560617+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"8859639c-0e03-4680-8423-d15c62b60ecd\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"vmwareSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnar-vmwbb01-rg/providers/Microsoft.OffAzure/VMwareSites/srcAppliancebb3396site\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnar-vmwbb01-rg/providers/Microsoft.Migrate/MigrateProjects/jnar-vmwbb01/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"instanceType\":\"VMwareMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnar-vmwbb01-rg/providers/Microsoft.DataReplication/replicationFabrics/srcAppliancebbb5e4replicationfabric\",\"name\":\"srcAppliancebbb5e4replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-08-14T21:53:11.9339794+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-08-14T22:01:51.8074061+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"3ae8de78-fb81-4207-b2aa-2dde015dd3e1\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnar-vmwbb01-rg/providers/Microsoft.OffAzure/HyperVSites/jnartgta0952site\",\"applianceName\":[\"jnartgta\"],\"cluster\":{\"clusterName\":\"mayadahciclus3.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/clusters/mayadahciclus3\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4758048063797911160\",\"fabricContainerId\":\"20380084512601\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnar-vmwbb01-rg/providers/Microsoft.Migrate/MigrateProjects/jnar-vmwbb01/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/jnar-vmwbb01-rg/providers/Microsoft.DataReplication/replicationFabrics/jnartgtaf016replicationfabric\",\"name\":\"jnartgtaf016replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"jnarvaez@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-08-15T03:24:15.2402588+00:00\",\"lastModifiedBy\":\"jnarvaez@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-08-15T03:24:15.2402588+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"01a07096-7cf8-4362-ba2b-cb014c472558\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestMF/providers/Microsoft.OffAzure/HyperVSites/HyperV-1252e8csite\",\"fabricResourceId\":\"4855580752879841430\",\"fabricContainerId\":\"22195253756089\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestMF/providers/Microsoft.Migrate/MigrateProjects/aszmigtest1252e8c/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestMF/providers/Microsoft.DataReplication/replicationFabrics/HyperV-1252e8c02c0replicationfabric\",\"name\":\"HyperV-1252e8c02c0replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vmmige2etest@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-08-17T05:29:54.3756551+00:00\",\"lastModifiedBy\":\"vmmige2etest@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-08-17T05:29:54.3756551+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"a1cd531d-1275-41f2-a2d4-2bb71202a031\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestMF/providers/Microsoft.OffAzure/HyperVSites/asz-1252e8csite\",\"applianceName\":[\"asz-1252e8c\"],\"cluster\":{\"clusterName\":\"clrn03u05.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgCLRN03U0507/providers/Microsoft.AzureStackHCI/clusters/CLRN03U05hci\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4751880853264356125\",\"fabricContainerId\":\"22181753040190\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestMF/providers/Microsoft.Migrate/MigrateProjects/aszmigtest1252e8c/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestMF/providers/Microsoft.DataReplication/replicationFabrics/asz-1252e8c0c6dreplicationfabric\",\"name\":\"asz-1252e8c0c6dreplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vmmige2etest@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-08-17T05:46:50.1359434+00:00\",\"lastModifiedBy\":\"vmmige2etest@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-08-17T05:46:50.1359434+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"6f2f73d0-03da-45b7-b659-d4e0fdd4536e\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestRF/providers/Microsoft.OffAzure/HyperVSites/HyperV-1a0841bsite\",\"fabricResourceId\":\"5023488146058212304\",\"fabricContainerId\":\"22410722491073\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestRF/providers/Microsoft.Migrate/MigrateProjects/aszmigtest1a0841b/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestRF/providers/Microsoft.DataReplication/replicationFabrics/HyperV-1a0841b1364replicationfabric\",\"name\":\"HyperV-1a0841b1364replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vmmige2etest@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-08-17T11:29:02.0888261+00:00\",\"lastModifiedBy\":\"vmmige2etest@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-08-17T11:29:02.0888261+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"8ae346dd-6361-4f44-a5a6-cc64657555db\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestRF/providers/Microsoft.OffAzure/HyperVSites/asz-1a0841bsite\",\"applianceName\":[\"asz-1a0841b\"],\"cluster\":{\"clusterName\":\"clrn03u05.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgCLRN03U0507/providers/Microsoft.AzureStackHCI/clusters/CLRN03U05hci\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5711799498005759709\",\"fabricContainerId\":\"22409025553036\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestRF/providers/Microsoft.Migrate/MigrateProjects/aszmigtest1a0841b/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestRF/providers/Microsoft.DataReplication/replicationFabrics/asz-1a0841b8a5breplicationfabric\",\"name\":\"asz-1a0841b8a5breplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vmmige2etest@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-08-17T11:45:53.2136423+00:00\",\"lastModifiedBy\":\"vmmige2etest@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-08-17T11:45:53.2136423+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"256b1786-5a82-47cb-9148-f9be4a05c9f1\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestDF-2/providers/Microsoft.OffAzure/HyperVSites/HyperV-1ded86fsite\",\"fabricResourceId\":\"5173328111985170310\",\"fabricContainerId\":\"23652572956873\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestDF-2/providers/Microsoft.Migrate/MigrateProjects/aszmigtest1ded86f/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestDF-2/providers/Microsoft.DataReplication/replicationFabrics/HyperV-1ded86fe350replicationfabric\",\"name\":\"HyperV-1ded86fe350replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vmmige2etest@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-08-18T22:38:15.729654+00:00\",\"lastModifiedBy\":\"vmmige2etest@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-08-18T22:38:15.729654+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"e8c71934-b82b-4194-bb53-7ca0514403e7\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestw2k16clu/providers/Microsoft.OffAzure/HyperVSites/HyperV-1d47a74site\",\"fabricResourceId\":\"4725604407746959668\",\"fabricContainerId\":\"2138082096149\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestw2k16clu/providers/Microsoft.Migrate/MigrateProjects/aszmigtest1d47a74/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestw2k16clu/providers/Microsoft.DataReplication/replicationFabrics/HyperV-1d47a744fd8replicationfabric\",\"name\":\"HyperV-1d47a744fd8replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vmmige2etest@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-08-21T17:24:21.5558858+00:00\",\"lastModifiedBy\":\"vmmige2etest@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-08-21T17:24:21.5558858+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"df3a6122-ad3b-417d-b5fc-9ee9756e0b6b\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestw2k16clu/providers/Microsoft.OffAzure/HyperVSites/asz-1d47a74site\",\"applianceName\":[\"asz-1d47a74\"],\"cluster\":{\"clusterName\":\"clrn03u05.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/rgCLRN03U0507/providers/Microsoft.AzureStackHCI/clusters/CLRN03U05hci\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4719118457213968674\",\"fabricContainerId\":\"2147994361112\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestw2k16clu/providers/Microsoft.Migrate/MigrateProjects/aszmigtest1d47a74/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestw2k16clu/providers/Microsoft.DataReplication/replicationFabrics/asz-1d47a74b1e9replicationfabric\",\"name\":\"asz-1d47a74b1e9replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vmmige2etest@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-08-21T17:40:51.2989446+00:00\",\"lastModifiedBy\":\"vmmige2etest@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-08-21T17:40:51.2989446+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"bd860f94-dc0f-4099-a09c-5c00b099ef41\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestw2k16sa/providers/Microsoft.OffAzure/HyperVSites/HyperV-1a7032dsite\",\"fabricResourceId\":\"4654993650026418068\",\"fabricContainerId\":\"2653777840583\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestw2k16sa/providers/Microsoft.Migrate/MigrateProjects/aszmigtest1a7032d/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestw2k16sa/providers/Microsoft.DataReplication/replicationFabrics/HyperV-1a7032dd1f8replicationfabric\",\"name\":\"HyperV-1a7032dd1f8replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vmmige2etest@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-08-22T07:43:51.803398+00:00\",\"lastModifiedBy\":\"vmmige2etest@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-08-22T07:43:51.803398+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"da227f41-eebe-488b-9e65-e6a6e5620090\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestw2k16sa/providers/Microsoft.OffAzure/HyperVSites/asz-1a7032dsite\",\"applianceName\":[\"asz-1a7032d\"],\"cluster\":{\"clusterName\":\"rn03-u0911.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/680d0dad-59aa-4464-adf3-b34b2b427e8c/resourceGroups/vjvmmigtest01RG/providers/Microsoft.AzureStackHCI/clusters/hciclu09011\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"5227534295964483393\",\"fabricContainerId\":\"2663869452777\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestw2k16sa/providers/Microsoft.Migrate/MigrateProjects/aszmigtest1a7032d/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestw2k16sa/providers/Microsoft.DataReplication/replicationFabrics/asz-1a7032d738dreplicationfabric\",\"name\":\"asz-1a7032d738dreplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vmmige2etest@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-08-22T08:00:39.8967234+00:00\",\"lastModifiedBy\":\"vmmige2etest@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-08-22T08:00:39.8967234+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"48a5df80-285d-42df-91fa-315aa878895c\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestw2k19sa/providers/Microsoft.OffAzure/HyperVSites/HyperV-193f8b3site\",\"fabricResourceId\":\"4818614507425619840\",\"fabricContainerId\":\"3002193939867\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestw2k19sa/providers/Microsoft.Migrate/MigrateProjects/aszmigtest193f8b3/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestw2k19sa/providers/Microsoft.DataReplication/replicationFabrics/HyperV-193f8b369careplicationfabric\",\"name\":\"HyperV-193f8b369careplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vmmige2etest@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-08-22T17:24:34.0210911+00:00\",\"lastModifiedBy\":\"vmmige2etest@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-08-22T17:24:34.0210911+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"cecfbc97-55f6-40eb-a5a3-0e23d547911c\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestw2k19sa/providers/Microsoft.OffAzure/HyperVSites/asz-193f8b3site\",\"applianceName\":[\"asz-193f8b3\"],\"cluster\":{\"clusterName\":\"rn03-u0911.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/680d0dad-59aa-4464-adf3-b34b2b427e8c/resourceGroups/vjvmmigtest01RG/providers/Microsoft.AzureStackHCI/clusters/hciclu09011\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4677927156474428567\",\"fabricContainerId\":\"3012147185338\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestw2k19sa/providers/Microsoft.Migrate/MigrateProjects/aszmigtest193f8b3/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestw2k19sa/providers/Microsoft.DataReplication/replicationFabrics/asz-193f8b359c3replicationfabric\",\"name\":\"asz-193f8b359c3replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vmmige2etest@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-08-22T17:41:08.0609125+00:00\",\"lastModifiedBy\":\"vmmige2etest@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-08-22T17:41:08.0609125+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"db0ed99a-1393-412e-9e37-da2d4a625362\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestdomainjoin/providers/Microsoft.OffAzure/HyperVSites/HyperV-172ae08site\",\"fabricResourceId\":\"4696712987150309786\",\"fabricContainerId\":\"3115299975897\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestdomainjoin/providers/Microsoft.Migrate/MigrateProjects/aszmigtest172ae08/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestdomainjoin/providers/Microsoft.DataReplication/replicationFabrics/HyperV-172ae084558replicationfabric\",\"name\":\"HyperV-172ae084558replicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vmmige2etest@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-08-22T20:13:19.3175695+00:00\",\"lastModifiedBy\":\"vmmige2etest@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-08-22T20:13:19.3175695+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"5787ba91-f15b-402f-a774-7d83ab3f44cc\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestdomainjoin/providers/Microsoft.OffAzure/HyperVSites/asz-172ae08site\",\"applianceName\":[\"asz-172ae08\"],\"cluster\":{\"clusterName\":\"rn03-u0911.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/680d0dad-59aa-4464-adf3-b34b2b427e8c/resourceGroups/vjvmmigtest01RG/providers/Microsoft.AzureStackHCI/clusters/hciclu09011\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4625180716945619601\",\"fabricContainerId\":\"3101743377960\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestdomainjoin/providers/Microsoft.Migrate/MigrateProjects/aszmigtest172ae08/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/aszmige2etestdomainjoin/providers/Microsoft.DataReplication/replicationFabrics/asz-172ae08923freplicationfabric\",\"name\":\"asz-172ae08923freplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"vmmige2etest@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-08-22T20:30:01.2403385+00:00\",\"lastModifiedBy\":\"vmmige2etest@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-08-22T20:30:01.2403385+00:00\"},\"tags\":{}}]}", + "isContentBase64": false + } + }, + "Get-AzMigrateHCIReplicationFabric+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationFabrics/samlee3src48adfreplicationfabric?api-version=2021-02-16-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationFabrics/samlee3src48adfreplicationfabric?api-version=2021-02-16-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "2" ], + "x-ms-client-request-id": [ "c071fdb6-81aa-4d89-adbd-5d8cd82a8d95" ], + "CommandName": [ "Get-AzMigrateHCIReplicationFabric" ], + "FullCommandName": [ "Get-AzMigrateHCIReplicationFabric_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.6", "Az.Migrate/1.0.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "api-supported-versions": [ "2021-02-16-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-request-id": [ "2369ab33-c769-47fe-8920-54b5309d8d25" ], + "x-ms-correlation-request-id": [ "2369ab33-c769-47fe-8920-54b5309d8d25" ], + "x-ms-routing-request-id": [ "WESTUS2:20230822T210725Z:2369ab33-c769-47fe-8920-54b5309d8d25" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 3D0CACC5D4C24EA1AB4B1E499101CD4C Ref B: CO6AA3150220023 Ref C: 2023-08-22T21:07:24Z" ], + "Date": [ "Tue, 22 Aug 2023 21:07:25 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1297" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"c1cd158e-1855-4b4d-be3b-8dc601132914\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site\",\"fabricResourceId\":\"5426019882654045582\",\"fabricContainerId\":\"15873549809437\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.Migrate/MigrateProjects/samlee3proj4/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationFabrics/samlee3src48adfreplicationfabric\",\"name\":\"samlee3src48adfreplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"samlee3@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-08-09T22:33:02.1830192+00:00\",\"lastModifiedBy\":\"samlee3@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-08-09T22:39:45.739396+00:00\"},\"tags\":{}}", + "isContentBase64": false + } + }, + "Get-AzMigrateHCIReplicationFabric+[NoContext]+List1+$GET+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationFabrics?api-version=2021-02-16-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationFabrics?api-version=2021-02-16-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "3" ], + "x-ms-client-request-id": [ "6e26dab5-5679-4bd3-aa4e-4e909d183f2d" ], + "CommandName": [ "Get-AzMigrateHCIReplicationFabric" ], + "FullCommandName": [ "Get-AzMigrateHCIReplicationFabric_List1" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.6", "Az.Migrate/1.0.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "api-supported-versions": [ "2021-02-16-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11998" ], + "x-ms-request-id": [ "4a129491-0635-45b7-a2f4-5995b5345acb" ], + "x-ms-correlation-request-id": [ "4a129491-0635-45b7-a2f4-5995b5345acb" ], + "x-ms-routing-request-id": [ "WESTUS2:20230822T210726Z:4a129491-0635-45b7-a2f4-5995b5345acb" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 1D7198497AD345EE81DFEBD45803429D Ref B: CO6AA3150220023 Ref C: 2023-08-22T21:07:25Z" ], + "Date": [ "Tue, 22 Aug 2023 21:07:26 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "2926" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"c1cd158e-1855-4b4d-be3b-8dc601132914\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site\",\"fabricResourceId\":\"5426019882654045582\",\"fabricContainerId\":\"15873549809437\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.Migrate/MigrateProjects/samlee3proj4/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationFabrics/samlee3src48adfreplicationfabric\",\"name\":\"samlee3src48adfreplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"samlee3@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-08-09T22:33:02.1830192+00:00\",\"lastModifiedBy\":\"samlee3@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-08-09T22:39:45.739396+00:00\"},\"tags\":{}},{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"0566da75-1cd8-44c3-a515-882ff8da67cf\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"azStackHciSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3t3384site\",\"applianceName\":[\"samlee3t\"],\"cluster\":{\"clusterName\":\"mayadahciclus3.cfdev.nttest.microsoft.com\",\"resourceName\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/clusters/mayadahciclus3\",\"storageAccountName\":null,\"storageContainers\":null},\"fabricResourceId\":\"4954835729166817909\",\"fabricContainerId\":\"15925759403486\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.Migrate/MigrateProjects/samlee3proj4/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"AzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationFabrics/samlee3te2acreplicationfabric\",\"name\":\"samlee3te2acreplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"samlee3@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-08-09T23:20:40.0582924+00:00\",\"lastModifiedBy\":\"samlee3@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-08-09T23:20:40.0582924+00:00\"},\"tags\":{}}],\"nextLink\":null}", + "isContentBase64": false + } + }, + "Get-AzMigrateHCIReplicationFabric+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationFabrics/samlee3src48adfreplicationfabric?api-version=2021-02-16-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationFabrics/samlee3src48adfreplicationfabric?api-version=2021-02-16-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "4" ], + "x-ms-client-request-id": [ "15122b6b-2583-4530-ad96-b6b641f11e85" ], + "CommandName": [ "Get-AzMigrateHCIReplicationFabric" ], + "FullCommandName": [ "Get-AzMigrateHCIReplicationFabric_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.6", "Az.Migrate/1.0.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "api-supported-versions": [ "2021-02-16-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-request-id": [ "8dd46607-c738-4508-aac1-2c2b6cdc81fb" ], + "x-ms-correlation-request-id": [ "8dd46607-c738-4508-aac1-2c2b6cdc81fb" ], + "x-ms-routing-request-id": [ "NORTHCENTRALUS:20230822T210728Z:8dd46607-c738-4508-aac1-2c2b6cdc81fb" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 0B557A71678346D294A7B753BC867D91 Ref B: CO6AA3150220023 Ref C: 2023-08-22T21:07:26Z" ], + "Date": [ "Tue, 22 Aug 2023 21:07:28 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1297" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"c1cd158e-1855-4b4d-be3b-8dc601132914\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site\",\"fabricResourceId\":\"5426019882654045582\",\"fabricContainerId\":\"15873549809437\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.Migrate/MigrateProjects/samlee3proj4/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationFabrics/samlee3src48adfreplicationfabric\",\"name\":\"samlee3src48adfreplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"samlee3@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-08-09T22:33:02.1830192+00:00\",\"lastModifiedBy\":\"samlee3@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-08-09T22:39:45.739396+00:00\"},\"tags\":{}}", + "isContentBase64": false + } + }, + "Get-AzMigrateHCIReplicationFabric+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationFabrics/samlee3src48adfreplicationfabric?api-version=2021-02-16-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationFabrics/samlee3src48adfreplicationfabric?api-version=2021-02-16-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "5" ], + "x-ms-client-request-id": [ "20d1913e-bc93-4fe6-89e3-7c0bc0f7242b" ], + "CommandName": [ "Get-AzMigrateHCIReplicationFabric" ], + "FullCommandName": [ "Get-AzMigrateHCIReplicationFabric_GetViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.6", "Az.Migrate/1.0.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "api-supported-versions": [ "2021-02-16-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-request-id": [ "866056fe-a62b-4b81-8903-a18234f17187" ], + "x-ms-correlation-request-id": [ "866056fe-a62b-4b81-8903-a18234f17187" ], + "x-ms-routing-request-id": [ "CENTRALUS:20230822T210729Z:866056fe-a62b-4b81-8903-a18234f17187" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 8C88AC3D0532495AB4C48A097303D349 Ref B: CO6AA3150220023 Ref C: 2023-08-22T21:07:28Z" ], + "Date": [ "Tue, 22 Aug 2023 21:07:29 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1297" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"southeastasia\",\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceEndpoint\":\"https://agent-can01-asrrp1.sea.siterecovery.azure.com\",\"serviceResourceId\":\"c1cd158e-1855-4b4d-be3b-8dc601132914\",\"health\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"hyperVSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site\",\"fabricResourceId\":\"5426019882654045582\",\"fabricContainerId\":\"15873549809437\",\"migrationSolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.Migrate/MigrateProjects/samlee3proj4/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"migrationHubUri\":null,\"instanceType\":\"HyperVMigrate\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationFabrics/samlee3src48adfreplicationfabric\",\"name\":\"samlee3src48adfreplicationfabric\",\"type\":\"Microsoft.DataReplication/replicationFabrics\",\"systemData\":{\"createdBy\":\"samlee3@microsoft.com\",\"createdByType\":\"User\",\"createdAt\":\"2023-08-09T22:33:02.1830192+00:00\",\"lastModifiedBy\":\"samlee3@microsoft.com\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2023-08-09T22:39:45.739396+00:00\"},\"tags\":{}}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/test/Get-AzMigrateHCIReplicationFabric.Tests.ps1 b/src/Migrate/Migrate.Autorest/test/Get-AzMigrateHCIReplicationFabric.Tests.ps1 new file mode 100644 index 000000000000..d0815aa60542 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/test/Get-AzMigrateHCIReplicationFabric.Tests.ps1 @@ -0,0 +1,48 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzMigrateHCIReplicationFabric')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzMigrateHCIReplicationFabric.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-AzMigrateHCIReplicationFabric' { + It 'List' { + $output = Get-AzMigrateHCIReplicationFabric ` + -SubscriptionId $env.hciSubscriptionId + $output.Count | Should -BeGreaterOrEqual 1 + } + + It 'Get' { + $output = Get-AzMigrateHCIReplicationFabric ` + -ResourceGroupName $env.hciMigResourceGroup ` + -SubscriptionId $env.hciSubscriptionId ` + -Name $env.hciSourceReplicationFabricName + $output.Count | Should -BeGreaterOrEqual 1 + } + + It 'List1' { + $output = Get-AzMigrateHCIReplicationFabric ` + -ResourceGroupName $env.hciMigResourceGroup ` + -SubscriptionId $env.hciSubscriptionId + $output.Count | Should -BeGreaterOrEqual 1 + } + + It 'GetViaIdentity' { + $output = Get-AzMigrateHCIReplicationFabric ` + -ResourceGroupName $env.hciMigResourceGroup ` + -SubscriptionId $env.hciSubscriptionId ` + -Name $env.hciSourceReplicationFabricName + + $output1 = Get-AzMigrateHCIReplicationFabric -InputObject $output + $output1.Count | Should -BeGreaterOrEqual 1 + } +} diff --git a/src/Migrate/Migrate.Autorest/test/Get-AzMigrateHCIServerReplication.Recording.json b/src/Migrate/Migrate.Autorest/test/Get-AzMigrateHCIServerReplication.Recording.json new file mode 100644 index 000000000000..c395c6806190 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/test/Get-AzMigrateHCIServerReplication.Recording.json @@ -0,0 +1,344 @@ +{ + "Get-AzMigrateHCIServerReplication+[NoContext]+ListByName+$GET+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.Migrate/migrateProjects/samlee3proj4/solutions/Servers-Migration-ServerMigration_DataReplication?api-version=2018-09-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.Migrate/migrateProjects/samlee3proj4/solutions/Servers-Migration-ServerMigration_DataReplication?api-version=2018-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "1" ], + "x-ms-client-request-id": [ "5721fff3-6d99-482b-b767-ab2b5959c8fc" ], + "CommandName": [ "Az.Migrate\\Get-AzMigrateSolution" ], + "FullCommandName": [ "Get-AzMigrateSolution_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.6", "Az.Migrate/1.0.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "8f38616f-0acc-4751-be66-a5766438c8bb" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-correlation-request-id": [ "2f96fcd3-3882-4a89-b42f-75b9ff2f580a" ], + "x-ms-routing-request-id": [ "WESTCENTRALUS:20230916T233501Z:2f96fcd3-3882-4a89-b42f-75b9ff2f580a" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 12B047E132BC4D8D897BA7436EE83133 Ref B: CO6AA3150219045 Ref C: 2023-09-16T23:34:59Z" ], + "Date": [ "Sat, 16 Sep 2023 23:35:01 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1120" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.Migrate/MigrateProjects/samlee3proj4/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"name\":\"Servers-Migration-ServerMigration_DataReplication\",\"type\":\"Microsoft.Migrate/MigrateProjects/Solutions\",\"etag\":\"\\\"3f00a2ae-0000-1800-0000-65063ab80000\\\"\",\"properties\":{\"tool\":\"ServerMigration_DataReplication\",\"purpose\":\"Migration\",\"goal\":\"Servers\",\"status\":\"Inactive\",\"cleanupState\":\"None\",\"summary\":{\"instanceType\":\"Servers\",\"discoveredCount\":0,\"assessedCount\":0,\"replicatingCount\":0,\"testMigratedCount\":0,\"migratedCount\":0},\"details\":{\"groupCount\":0,\"assessmentCount\":0,\"extendedDetails\":{\"serversOnWindows\":\"0\",\"serversOnLinux\":\"0\",\"serversOnOther\":\"0\",\"dependencyEnabledMachines\":\"0\",\"machinesHavingSqlServers\":\"0\",\"machinesHavingWebServers\":\"0\",\"vaultId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault\",\"aszreplicatingCount\":\"22\",\"asztestMigratedCount\":\"0\",\"aszmigratedCount\":\"5\"}}}}", + "isContentBase64": false + } + }, + "Get-AzMigrateHCIServerReplication+[NoContext]+ListByName+$GET+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems?api-version=2021-02-16-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems?api-version=2021-02-16-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "2" ], + "x-ms-client-request-id": [ "fca84b7c-849a-4c5b-b4e5-35835a1359f4" ], + "CommandName": [ "Az.Migrate.Internal\\Get-AzMigrateProtectedItem" ], + "FullCommandName": [ "Get-AzMigrateProtectedItem_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.6", "Az.Migrate/1.0.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "api-supported-versions": [ "2021-02-16-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-request-id": [ "e52517dc-bc85-4e46-9299-07d023c76a80" ], + "x-ms-correlation-request-id": [ "e52517dc-bc85-4e46-9299-07d023c76a80" ], + "x-ms-routing-request-id": [ "WESTCENTRALUS:20230916T233503Z:e52517dc-bc85-4e46-9299-07d023c76a80" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: B0EA6CE2F2F64093BA0FAF39844F7095 Ref B: CO6AA3150219045 Ref C: 2023-09-16T23:35:01Z" ], + "Date": [ "Sat, 16 Sep 2023 23:35:03 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "7894" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"properties\":{\"policyName\":\"samlee3proj46422replicationvaultHyperVToAzStackHCIpolicy\",\"replicationExtensionName\":\"samlee3src48adfreplicationfabric-samlee3te2acreplicationfabric-MigReplicationExtn\",\"correlationId\":\"c1f6b6a9-a15b-43eb-84d9-2292ae42e1da\",\"provisioningState\":\"Succeeded\",\"protectionState\":\"InitialReplicationInProgress\",\"protectionStateDescription\":\"Initial replication is in progress\",\"testFailoverState\":\"None\",\"testFailoverStateDescription\":\"None\",\"resynchronizationState\":\"None\",\"fabricObjectId\":\"6e6e15ee-3d3b-5f95-9460-157e67b6aa32\",\"fabricObjectName\":\"testsamlee1\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"fabricId\":\"c1cd158e-1855-4b4d-be3b-8dc601132914\",\"targetFabricId\":\"0566da75-1cd8-44c3-a515-882ff8da67cf\",\"draId\":\"d961e8a1-901b-4715-9266-8eef2dbe9673\",\"targetDraId\":\"4f127877-8fc2-4d92-b473-ff87c88d7ad9\",\"resyncRequired\":\"false\",\"allowedJobs\":[\"DisableProtection\"],\"replicationHealth\":\"Critical\",\"healthErrors\":[{\"childErrors\":[],\"code\":\"HyperVToAzStackHCIRcmServiceReplicationCycleFailed\",\"healthCategory\":\"Replication\",\"category\":\"SystemError\",\"severity\":\"Error\",\"source\":\"ASR\",\"creationTime\":\"2023-09-16T23:23:16.2127792Z\",\"isCustomerResolvable\":\"false\",\"summary\":\"\",\"message\":\"ErrorCode: \u0027499\u0027 VM: \u0027\u0027. Appliance: \u0027samlee3src4\u0027. Error: An internal error occurred. [Sequence contains no elements]\",\"causes\":\"The operation failed due to an internal error.\",\"recommendation\":\"Retry the operation. If the issue persists, contact support.\"}],\"customProperties\":{\"activeLocation\":\"Primary\",\"targetHciClusterId\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/clusters/mayadahciclus3\",\"targetArcClusterCustomLocationId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.ExtendedLocation/customLocations/mayadahciclus3-CL\",\"targetAzStackHciClusterName\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.ExtendedLocation/customLocations/mayadahciclus3-CL\",\"fabricDiscoveryMachineId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/machines/0560e6aa-9b2d-45e5-92cd-4ff618d09bec\",\"disksToInclude\":null,\"nicsToInclude\":null,\"sourceVmName\":\"testsamlee1\",\"sourceCpuCores\":1,\"sourceMemoryInMegaBytes\":16384.0,\"targetVmName\":\"hciVm1\",\"targetResourceGroupId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg-tgt\",\"storageContainerId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/storageContainers/bbcontainer4\",\"hyperVGeneration\":\"1\",\"targetNetworkId\":null,\"testNetworkId\":null,\"targetCpuCores\":1,\"isDynamicRam\":true,\"dynamicMemoryConfig\":{\"maximumMemoryInMegaBytes\":1048576,\"minimumMemoryInMegaBytes\":1024,\"targetMemoryBufferPercentage\":20},\"targetMemoryInMegaBytes\":16384,\"runAsAccountId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/runasaccounts/851ad7af-b65d-53e6-8c3a-3a5058cbad77\",\"sourceDraName\":\"samlee3src48adfdra\",\"targetDraName\":\"samlee3te2acdra\",\"sourceApplianceName\":\"samlee3src4\",\"targetApplianceName\":\"samlee3t\",\"osType\":\"otherguestfamily\",\"osName\":null,\"firmwareType\":\"BIOS\",\"targetLocation\":\"Southeast Asia\",\"customLocationRegion\":\"eastus\",\"failoverRecoveryPointId\":null,\"lastRecoveryPointId\":null,\"initialReplicationProgressPercentage\":0,\"resyncProgressPercentage\":null,\"protectedDisks\":[],\"protectedNics\":[],\"targetVmBiosId\":null,\"lastReplicationUpdateTime\":\"2023-09-16T23:30:06.4336581Z\",\"instanceType\":\"HyperVToAzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0560e6aa-9b2d-45e5-92cd-4ff618d09bec\",\"name\":\"0560e6aa-9b2d-45e5-92cd-4ff618d09bec\",\"type\":\"Microsoft.DataReplication/replicationVaults/protectedItems\",\"systemData\":null,\"tags\":null},{\"properties\":{\"policyName\":\"samlee3proj46422replicationvaultHyperVToAzStackHCIpolicy\",\"replicationExtensionName\":\"samlee3src48adfreplicationfabric-samlee3te2acreplicationfabric-MigReplicationExtn\",\"correlationId\":\"0b4e166f-834a-4dc6-ac6c-19aac39be27f\",\"provisioningState\":\"Succeeded\",\"protectionState\":\"InitialReplicationInProgress\",\"protectionStateDescription\":\"Initial replication is in progress\",\"testFailoverState\":\"None\",\"testFailoverStateDescription\":\"None\",\"resynchronizationState\":\"None\",\"fabricObjectId\":\"c01ab1ac-441f-5ac9-b48c-58bca6993ca4\",\"fabricObjectName\":\"testsamlee2\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"fabricId\":\"c1cd158e-1855-4b4d-be3b-8dc601132914\",\"targetFabricId\":\"0566da75-1cd8-44c3-a515-882ff8da67cf\",\"draId\":\"d961e8a1-901b-4715-9266-8eef2dbe9673\",\"targetDraId\":\"4f127877-8fc2-4d92-b473-ff87c88d7ad9\",\"resyncRequired\":\"false\",\"allowedJobs\":[\"DisableProtection\"],\"replicationHealth\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"activeLocation\":\"Primary\",\"targetHciClusterId\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/clusters/mayadahciclus3\",\"targetArcClusterCustomLocationId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.ExtendedLocation/customLocations/mayadahciclus3-CL\",\"targetAzStackHciClusterName\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.ExtendedLocation/customLocations/mayadahciclus3-CL\",\"fabricDiscoveryMachineId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/machines/a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b\",\"disksToInclude\":null,\"nicsToInclude\":null,\"sourceVmName\":\"testsamlee2\",\"sourceCpuCores\":1,\"sourceMemoryInMegaBytes\":16384.0,\"targetVmName\":\"hciVm2\",\"targetResourceGroupId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg-tgt\",\"storageContainerId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/storageContainers/bbcontainer4\",\"hyperVGeneration\":\"1\",\"targetNetworkId\":null,\"testNetworkId\":null,\"targetCpuCores\":1,\"isDynamicRam\":false,\"dynamicMemoryConfig\":{\"maximumMemoryInMegaBytes\":1048576,\"minimumMemoryInMegaBytes\":1024,\"targetMemoryBufferPercentage\":20},\"targetMemoryInMegaBytes\":16384,\"runAsAccountId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/runasaccounts/851ad7af-b65d-53e6-8c3a-3a5058cbad77\",\"sourceDraName\":\"samlee3src48adfdra\",\"targetDraName\":\"samlee3te2acdra\",\"sourceApplianceName\":\"samlee3src4\",\"targetApplianceName\":\"samlee3t\",\"osType\":\"otherguestfamily\",\"osName\":null,\"firmwareType\":\"BIOS\",\"targetLocation\":\"Southeast Asia\",\"customLocationRegion\":\"eastus\",\"failoverRecoveryPointId\":null,\"lastRecoveryPointId\":null,\"initialReplicationProgressPercentage\":0,\"resyncProgressPercentage\":null,\"protectedDisks\":[],\"protectedNics\":[],\"targetVmBiosId\":null,\"lastReplicationUpdateTime\":\"2023-09-16T23:31:02.4411859Z\",\"instanceType\":\"HyperVToAzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b\",\"name\":\"a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b\",\"type\":\"Microsoft.DataReplication/replicationVaults/protectedItems\",\"systemData\":null,\"tags\":null}],\"nextLink\":null}", + "isContentBase64": false + } + }, + "Get-AzMigrateHCIServerReplication+[NoContext]+GetByItemID+$GET+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0560e6aa-9b2d-45e5-92cd-4ff618d09bec?api-version=2021-02-16-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0560e6aa-9b2d-45e5-92cd-4ff618d09bec?api-version=2021-02-16-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "3" ], + "x-ms-client-request-id": [ "9852a6ae-9acc-42b8-b01a-3380680f2be7" ], + "CommandName": [ "Az.Migrate.Internal\\Get-AzMigrateProtectedItem" ], + "FullCommandName": [ "Get-AzMigrateProtectedItem_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.6", "Az.Migrate/1.0.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "api-supported-versions": [ "2021-02-16-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-request-id": [ "f1cdfa33-aba7-4d2e-9a24-a3f1b645453d" ], + "x-ms-correlation-request-id": [ "f1cdfa33-aba7-4d2e-9a24-a3f1b645453d" ], + "x-ms-routing-request-id": [ "WESTCENTRALUS:20230916T233506Z:f1cdfa33-aba7-4d2e-9a24-a3f1b645453d" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: ABC5627F103045D881958B4D13612D2A Ref B: CO6AA3150219045 Ref C: 2023-09-16T23:35:04Z" ], + "Date": [ "Sat, 16 Sep 2023 23:35:06 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "5608" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"policyName\":\"samlee3proj46422replicationvaultHyperVToAzStackHCIpolicy\",\"replicationExtensionName\":\"samlee3src48adfreplicationfabric-samlee3te2acreplicationfabric-MigReplicationExtn\",\"correlationId\":\"c1f6b6a9-a15b-43eb-84d9-2292ae42e1da\",\"provisioningState\":\"Succeeded\",\"protectionState\":\"InitialReplicationInProgress\",\"protectionStateDescription\":\"Initial replication is in progress\",\"testFailoverState\":\"None\",\"testFailoverStateDescription\":\"None\",\"resynchronizationState\":\"None\",\"fabricObjectId\":\"6e6e15ee-3d3b-5f95-9460-157e67b6aa32\",\"fabricObjectName\":\"testsamlee1\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"fabricId\":\"c1cd158e-1855-4b4d-be3b-8dc601132914\",\"targetFabricId\":\"0566da75-1cd8-44c3-a515-882ff8da67cf\",\"draId\":\"d961e8a1-901b-4715-9266-8eef2dbe9673\",\"targetDraId\":\"4f127877-8fc2-4d92-b473-ff87c88d7ad9\",\"resyncRequired\":\"false\",\"allowedJobs\":[\"DisableProtection\"],\"replicationHealth\":\"Critical\",\"healthErrors\":[{\"childErrors\":[],\"code\":\"HyperVToAzStackHCIRcmServiceReplicationCycleFailed\",\"healthCategory\":\"Replication\",\"category\":\"SystemError\",\"severity\":\"Error\",\"source\":\"ASR\",\"creationTime\":\"2023-09-16T23:23:16.2127792Z\",\"isCustomerResolvable\":\"false\",\"summary\":\"\",\"message\":\"ErrorCode: \u0027499\u0027 VM: \u0027\u0027. Appliance: \u0027samlee3src4\u0027. Error: An internal error occurred. [Sequence contains no elements]\",\"causes\":\"The operation failed due to an internal error.\",\"recommendation\":\"Retry the operation. If the issue persists, contact support.\"}],\"customProperties\":{\"activeLocation\":\"Primary\",\"targetHciClusterId\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/clusters/mayadahciclus3\",\"targetArcClusterCustomLocationId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.ExtendedLocation/customLocations/mayadahciclus3-CL\",\"targetAzStackHciClusterName\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.ExtendedLocation/customLocations/mayadahciclus3-CL\",\"fabricDiscoveryMachineId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/machines/0560e6aa-9b2d-45e5-92cd-4ff618d09bec\",\"disksToInclude\":null,\"nicsToInclude\":null,\"sourceVmName\":\"testsamlee1\",\"sourceCpuCores\":1,\"sourceMemoryInMegaBytes\":16384.0,\"targetVmName\":\"hciVm1\",\"targetResourceGroupId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg-tgt\",\"storageContainerId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/storageContainers/bbcontainer4\",\"hyperVGeneration\":\"1\",\"targetNetworkId\":null,\"testNetworkId\":null,\"targetCpuCores\":1,\"isDynamicRam\":true,\"dynamicMemoryConfig\":{\"maximumMemoryInMegaBytes\":1048576,\"minimumMemoryInMegaBytes\":1024,\"targetMemoryBufferPercentage\":20},\"targetMemoryInMegaBytes\":16384,\"runAsAccountId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/runasaccounts/851ad7af-b65d-53e6-8c3a-3a5058cbad77\",\"sourceDraName\":\"samlee3src48adfdra\",\"targetDraName\":\"samlee3te2acdra\",\"sourceApplianceName\":\"samlee3src4\",\"targetApplianceName\":\"samlee3t\",\"osType\":\"otherguestfamily\",\"osName\":null,\"firmwareType\":\"BIOS\",\"targetLocation\":\"Southeast Asia\",\"customLocationRegion\":\"eastus\",\"failoverRecoveryPointId\":null,\"lastRecoveryPointId\":null,\"initialReplicationProgressPercentage\":0,\"resyncProgressPercentage\":null,\"protectedDisks\":[{\"storageContainerId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/storageContainers/bbcontainer4\",\"storageContainerLocalPath\":\"c:\\\\clusterstorage\\\\volume03\\\\migratedvms\\\\d206abfad9d93a1\",\"sourceDiskId\":\"Microsoft:0560E6AA-9B2D-45E5-92CD-4FF618D09BEC\\\\83F8638B-8DCA-4152-9EDA-2CA8B33039B4\\\\0\\\\0\\\\L\",\"sourceDiskName\":\"14393.0.amd64fre.rs1_release.160715-1616_server_serverdatacentereval_en-us_138E9ECD-3547-4241-975F-4404FD4F5132\",\"seedDiskName\":\"hciVm1-OSdisk-14393-0-amd6-3934-seed\",\"testMigrateDiskName\":\"hciVm1-OSdisk-14393-0-amd6-0d5c-test\",\"migrateDiskName\":\"hciVm1-OSdisk-14393-0-amd6-0d5c\",\"isOsDisk\":true,\"capacityInBytes\":42949672960,\"isDynamic\":true,\"diskType\":\"VHDX\"}],\"protectedNics\":[{\"nicId\":\"Microsoft:0560E6AA-9B2D-45E5-92CD-4FF618D09BEC\\\\617EFC72-6B3C-47F4-9198-A58C24E787B6\",\"macAddress\":\"00:15:5d:e6:4f:f1\",\"networkName\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/virtualnetworks/external\",\"targetNetworkId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/virtualnetworks/external\",\"testNetworkId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/virtualnetworks/external\",\"selectionTypeForFailover\":\"SelectedByUser\"}],\"targetVmBiosId\":null,\"lastReplicationUpdateTime\":\"2023-09-16T23:30:06.4336581Z\",\"instanceType\":\"HyperVToAzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0560e6aa-9b2d-45e5-92cd-4ff618d09bec\",\"name\":\"0560e6aa-9b2d-45e5-92cd-4ff618d09bec\",\"type\":\"Microsoft.DataReplication/replicationVaults/protectedItems\",\"systemData\":null,\"tags\":null}", + "isContentBase64": false + } + }, + "Get-AzMigrateHCIServerReplication+[NoContext]+GetBySDSID+$GET+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site?api-version=2020-01-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site?api-version=2020-01-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "4" ], + "x-ms-client-request-id": [ "2f289a1e-733d-44bc-b67d-80a361f98e93" ], + "CommandName": [ "Az.Migrate.Internal\\Get-AzMigrateHyperVSite" ], + "FullCommandName": [ "Get-AzMigrateHyperVSite_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.6", "Az.Migrate/1.0.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"2e015a83-0000-1800-0000-65063a460000\"" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-request-id": [ "f0ff7880-ce3f-4dc2-bddb-b38ab97f18df" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11998" ], + "x-ms-correlation-request-id": [ "2387ddaa-c49e-4af2-ab09-a528695697be" ], + "x-ms-routing-request-id": [ "WESTCENTRALUS:20230916T233507Z:2387ddaa-c49e-4af2-ab09-a528695697be" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 4EA955D45B764E1E95C3C66BCCD8910F Ref B: CO6AA3150219045 Ref C: 2023-09-16T23:35:06Z" ], + "Date": [ "Sat, 16 Sep 2023 23:35:07 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "2629" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site\",\"name\":\"samlee3src41244site\",\"type\":\"Microsoft.OffAzure/HyperVSites\",\"etag\":\"\\\"2e015a83-0000-1800-0000-65063a460000\\\"\",\"location\":\"southeastasia\",\"kind\":\"Migrate\",\"properties\":{\"masterSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/MasterSites/samlee3proj46422mastersite\",\"servicePrincipalIdentityDetails\":{\"tenantId\":\"c76bd4d1-bea3-45ea-be1b-4a745a675d07\",\"applicationId\":\"e2344540-afb8-4d15-843d-2e7c35b090ab\",\"objectId\":\"c8c56849-02b1-4b12-95af-c2e94b9aaf1e\",\"audience\":\"e2344540-afb8-4d15-843d-2e7c35b090ab\",\"aadAuthority\":\"https://login.microsoftonline.com/c76bd4d1-bea3-45ea-be1b-4a745a675d07\",\"rawCertData\":\"MIIDNDCCAhygAwIBAgIQdGNdN/CjS8ufM+qldDz6xzANBgkqhkiG9w0BAQsFADAXMRUwEwYDVQQDEwxBZ2VudFNwbkNlcnQwHhcNMjMwODA5MjIyMTE2WhcNMjQwODA5MjIzMTE2WjAXMRUwEwYDVQQDEwxBZ2VudFNwbkNlcnQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDuy6pxPqzVD9WVHGBw3+EQNSAbkvCMGDU+yNu6e1a1+OGonopJYJ+W5IF9pgCgGY/VK5Yokgv4gj+dDCaHEDXshLxh9cLoaxXwvP83UdoR2e7lA3cbGAXqxJQw2/9jfaoa+ipvnenejKiWEjWzZmxPglWGGaO+NnhQm6l99a+Az2SGT+7Z8BD+eiNLu/kvblhu2I2zlBDxtaq+HtRtcduO0PRpbrTV7WTUCIpRKnELs4+Kz1VleCK3idxUZgwQiKcc/BbjS0jtF2tKr7KiUUNqTDGm2RtYqx4RShYjt+baXs477XtjEjl0NTK85XOMFyyXyTn8P9rW42eDZzgorlY1AgMBAAGjfDB6MA4GA1UdDwEB/wQEAwIFoDAJBgNVHRMEAjAAMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjAfBgNVHSMEGDAWgBQvwkawBAIeLPXDn6aMqPWc4S2M3jAdBgNVHQ4EFgQUL8JGsAQCHiz1w5+mjKj1nOEtjN4wDQYJKoZIhvcNAQELBQADggEBAArSSHkrEHcJyz75KC1DNFdrpESEo5Wy3oV4gZe4cOtfQd8tu4iJUSgagy1NdoQ2puatD7CJQ0nvAUGzAu5MMbeotihBvtHLSJTxbxumRgshsblrZA+a38q9qwUSLlJP9dUtG/cN0G0jB6xLj9ZoeHXKviQodLlXqHPb7qhHHqMxKFKZViWU2tV863QYLVSDR7eZOD7qiFXPxm0RNQyrHctrvT4k3Ra1E22gxH171PSDfdab9GBGDitzw9lErLK2qfIwE7SoaSUm1YXu0A5z7eQJSDcojdfi4lzhOUtmJN/Gmln/JrZ4AGhAs9gghe5n/c6vp85UomtWAc6lXJkWZK4=\"},\"agentDetails\":{\"id\":\"38144592-82bd-4537-806a-2529e6f42f4d-agent\",\"version\":\"2.0.2199.56\",\"lastHeartBeatUtc\":\"2023-09-16T23:30:57.6714648Z\",\"keyVaultUri\":\"https://samlee3proj46422kv.vault.azure.net\",\"keyVaultId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.KeyVault/vaults/samlee3proj46422kv\"},\"applianceName\":\"samlee3src4\",\"discoverySolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.Migrate/MigrateProjects/samlee3proj4/Solutions/Servers-Discovery-ServerDiscovery\",\"serviceEndpoint\":\"https://discoverysrv.sea.test.migration.windowsazure.com/\",\"provisioningState\":\"Succeeded\"}}", + "isContentBase64": false + } + }, + "Get-AzMigrateHCIServerReplication+[NoContext]+GetBySDSID+$GET+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.Migrate/migrateProjects/samlee3proj4/solutions/Servers-Migration-ServerMigration_DataReplication?api-version=2018-09-01-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.Migrate/migrateProjects/samlee3proj4/solutions/Servers-Migration-ServerMigration_DataReplication?api-version=2018-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "5" ], + "x-ms-client-request-id": [ "318dbc6d-3fdb-4472-816b-e94762b9a777" ], + "CommandName": [ "Az.Migrate\\Get-AzMigrateSolution" ], + "FullCommandName": [ "Get-AzMigrateSolution_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.6", "Az.Migrate/1.0.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "28b2964f-a92c-4c39-99d3-7efee7a0f7b3" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-correlation-request-id": [ "9ba8f296-3f6e-45db-926c-d4ac3296d74f" ], + "x-ms-routing-request-id": [ "WESTCENTRALUS:20230916T233509Z:9ba8f296-3f6e-45db-926c-d4ac3296d74f" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 2A02DFC89EB84F60B140EBF155912FB9 Ref B: CO6AA3150219045 Ref C: 2023-09-16T23:35:07Z" ], + "Date": [ "Sat, 16 Sep 2023 23:35:09 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1120" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.Migrate/MigrateProjects/samlee3proj4/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"name\":\"Servers-Migration-ServerMigration_DataReplication\",\"type\":\"Microsoft.Migrate/MigrateProjects/Solutions\",\"etag\":\"\\\"3f00a2ae-0000-1800-0000-65063ab80000\\\"\",\"properties\":{\"tool\":\"ServerMigration_DataReplication\",\"purpose\":\"Migration\",\"goal\":\"Servers\",\"status\":\"Inactive\",\"cleanupState\":\"None\",\"summary\":{\"instanceType\":\"Servers\",\"discoveredCount\":0,\"assessedCount\":0,\"replicatingCount\":0,\"testMigratedCount\":0,\"migratedCount\":0},\"details\":{\"groupCount\":0,\"assessmentCount\":0,\"extendedDetails\":{\"serversOnWindows\":\"0\",\"serversOnLinux\":\"0\",\"serversOnOther\":\"0\",\"dependencyEnabledMachines\":\"0\",\"machinesHavingSqlServers\":\"0\",\"machinesHavingWebServers\":\"0\",\"vaultId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault\",\"aszreplicatingCount\":\"22\",\"asztestMigratedCount\":\"0\",\"aszmigratedCount\":\"5\"}}}}", + "isContentBase64": false + } + }, + "Get-AzMigrateHCIServerReplication+[NoContext]+GetBySDSID+$GET+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0560e6aa-9b2d-45e5-92cd-4ff618d09bec?api-version=2021-02-16-preview+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0560e6aa-9b2d-45e5-92cd-4ff618d09bec?api-version=2021-02-16-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "6" ], + "x-ms-client-request-id": [ "3de9c86e-69c8-47da-a02f-248de2e28ab9" ], + "CommandName": [ "Az.Migrate.Internal\\Get-AzMigrateProtectedItem" ], + "FullCommandName": [ "Get-AzMigrateProtectedItem_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.6", "Az.Migrate/1.0.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "api-supported-versions": [ "2021-02-16-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-request-id": [ "3c737b61-264d-4c83-bfd3-55e4a42af212" ], + "x-ms-correlation-request-id": [ "3c737b61-264d-4c83-bfd3-55e4a42af212" ], + "x-ms-routing-request-id": [ "WESTCENTRALUS:20230916T233511Z:3c737b61-264d-4c83-bfd3-55e4a42af212" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: BB8BD30420174E519B08E6F2ABDAA74C Ref B: CO6AA3150219045 Ref C: 2023-09-16T23:35:09Z" ], + "Date": [ "Sat, 16 Sep 2023 23:35:10 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "5608" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"policyName\":\"samlee3proj46422replicationvaultHyperVToAzStackHCIpolicy\",\"replicationExtensionName\":\"samlee3src48adfreplicationfabric-samlee3te2acreplicationfabric-MigReplicationExtn\",\"correlationId\":\"c1f6b6a9-a15b-43eb-84d9-2292ae42e1da\",\"provisioningState\":\"Succeeded\",\"protectionState\":\"InitialReplicationInProgress\",\"protectionStateDescription\":\"Initial replication is in progress\",\"testFailoverState\":\"None\",\"testFailoverStateDescription\":\"None\",\"resynchronizationState\":\"None\",\"fabricObjectId\":\"6e6e15ee-3d3b-5f95-9460-157e67b6aa32\",\"fabricObjectName\":\"testsamlee1\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"fabricId\":\"c1cd158e-1855-4b4d-be3b-8dc601132914\",\"targetFabricId\":\"0566da75-1cd8-44c3-a515-882ff8da67cf\",\"draId\":\"d961e8a1-901b-4715-9266-8eef2dbe9673\",\"targetDraId\":\"4f127877-8fc2-4d92-b473-ff87c88d7ad9\",\"resyncRequired\":\"false\",\"allowedJobs\":[\"DisableProtection\"],\"replicationHealth\":\"Critical\",\"healthErrors\":[{\"childErrors\":[],\"code\":\"HyperVToAzStackHCIRcmServiceReplicationCycleFailed\",\"healthCategory\":\"Replication\",\"category\":\"SystemError\",\"severity\":\"Error\",\"source\":\"ASR\",\"creationTime\":\"2023-09-16T23:23:16.2127792Z\",\"isCustomerResolvable\":\"false\",\"summary\":\"\",\"message\":\"ErrorCode: \u0027499\u0027 VM: \u0027\u0027. Appliance: \u0027samlee3src4\u0027. Error: An internal error occurred. [Sequence contains no elements]\",\"causes\":\"The operation failed due to an internal error.\",\"recommendation\":\"Retry the operation. If the issue persists, contact support.\"}],\"customProperties\":{\"activeLocation\":\"Primary\",\"targetHciClusterId\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/clusters/mayadahciclus3\",\"targetArcClusterCustomLocationId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.ExtendedLocation/customLocations/mayadahciclus3-CL\",\"targetAzStackHciClusterName\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.ExtendedLocation/customLocations/mayadahciclus3-CL\",\"fabricDiscoveryMachineId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/machines/0560e6aa-9b2d-45e5-92cd-4ff618d09bec\",\"disksToInclude\":null,\"nicsToInclude\":null,\"sourceVmName\":\"testsamlee1\",\"sourceCpuCores\":1,\"sourceMemoryInMegaBytes\":16384.0,\"targetVmName\":\"hciVm1\",\"targetResourceGroupId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg-tgt\",\"storageContainerId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/storageContainers/bbcontainer4\",\"hyperVGeneration\":\"1\",\"targetNetworkId\":null,\"testNetworkId\":null,\"targetCpuCores\":1,\"isDynamicRam\":true,\"dynamicMemoryConfig\":{\"maximumMemoryInMegaBytes\":1048576,\"minimumMemoryInMegaBytes\":1024,\"targetMemoryBufferPercentage\":20},\"targetMemoryInMegaBytes\":16384,\"runAsAccountId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/runasaccounts/851ad7af-b65d-53e6-8c3a-3a5058cbad77\",\"sourceDraName\":\"samlee3src48adfdra\",\"targetDraName\":\"samlee3te2acdra\",\"sourceApplianceName\":\"samlee3src4\",\"targetApplianceName\":\"samlee3t\",\"osType\":\"otherguestfamily\",\"osName\":null,\"firmwareType\":\"BIOS\",\"targetLocation\":\"Southeast Asia\",\"customLocationRegion\":\"eastus\",\"failoverRecoveryPointId\":null,\"lastRecoveryPointId\":null,\"initialReplicationProgressPercentage\":0,\"resyncProgressPercentage\":null,\"protectedDisks\":[{\"storageContainerId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/storageContainers/bbcontainer4\",\"storageContainerLocalPath\":\"c:\\\\clusterstorage\\\\volume03\\\\migratedvms\\\\d206abfad9d93a1\",\"sourceDiskId\":\"Microsoft:0560E6AA-9B2D-45E5-92CD-4FF618D09BEC\\\\83F8638B-8DCA-4152-9EDA-2CA8B33039B4\\\\0\\\\0\\\\L\",\"sourceDiskName\":\"14393.0.amd64fre.rs1_release.160715-1616_server_serverdatacentereval_en-us_138E9ECD-3547-4241-975F-4404FD4F5132\",\"seedDiskName\":\"hciVm1-OSdisk-14393-0-amd6-3934-seed\",\"testMigrateDiskName\":\"hciVm1-OSdisk-14393-0-amd6-0d5c-test\",\"migrateDiskName\":\"hciVm1-OSdisk-14393-0-amd6-0d5c\",\"isOsDisk\":true,\"capacityInBytes\":42949672960,\"isDynamic\":true,\"diskType\":\"VHDX\"}],\"protectedNics\":[{\"nicId\":\"Microsoft:0560E6AA-9B2D-45E5-92CD-4FF618D09BEC\\\\617EFC72-6B3C-47F4-9198-A58C24E787B6\",\"macAddress\":\"00:15:5d:e6:4f:f1\",\"networkName\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/virtualnetworks/external\",\"targetNetworkId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/virtualnetworks/external\",\"testNetworkId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/virtualnetworks/external\",\"selectionTypeForFailover\":\"SelectedByUser\"}],\"targetVmBiosId\":null,\"lastReplicationUpdateTime\":\"2023-09-16T23:30:06.4336581Z\",\"instanceType\":\"HyperVToAzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0560e6aa-9b2d-45e5-92cd-4ff618d09bec\",\"name\":\"0560e6aa-9b2d-45e5-92cd-4ff618d09bec\",\"type\":\"Microsoft.DataReplication/replicationVaults/protectedItems\",\"systemData\":null,\"tags\":null}", + "isContentBase64": false + } + }, + "Get-AzMigrateHCIServerReplication+[NoContext]+GetByInputObject+$GET+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0560e6aa-9b2d-45e5-92cd-4ff618d09bec?api-version=2021-02-16-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0560e6aa-9b2d-45e5-92cd-4ff618d09bec?api-version=2021-02-16-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "7" ], + "x-ms-client-request-id": [ "cc604ca7-7339-4909-81d8-eabea507e901" ], + "CommandName": [ "Az.Migrate.Internal\\Get-AzMigrateProtectedItem" ], + "FullCommandName": [ "Get-AzMigrateProtectedItem_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.6", "Az.Migrate/1.0.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "api-supported-versions": [ "2021-02-16-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11997" ], + "x-ms-request-id": [ "a678e2dc-ce09-4d6e-b229-c96385b4a13c" ], + "x-ms-correlation-request-id": [ "a678e2dc-ce09-4d6e-b229-c96385b4a13c" ], + "x-ms-routing-request-id": [ "WESTCENTRALUS:20230916T233513Z:a678e2dc-ce09-4d6e-b229-c96385b4a13c" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 19B1ACE142CE422D80A7207A24F9DFA4 Ref B: CO6AA3150219045 Ref C: 2023-09-16T23:35:11Z" ], + "Date": [ "Sat, 16 Sep 2023 23:35:13 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "5608" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"policyName\":\"samlee3proj46422replicationvaultHyperVToAzStackHCIpolicy\",\"replicationExtensionName\":\"samlee3src48adfreplicationfabric-samlee3te2acreplicationfabric-MigReplicationExtn\",\"correlationId\":\"c1f6b6a9-a15b-43eb-84d9-2292ae42e1da\",\"provisioningState\":\"Succeeded\",\"protectionState\":\"InitialReplicationInProgress\",\"protectionStateDescription\":\"Initial replication is in progress\",\"testFailoverState\":\"None\",\"testFailoverStateDescription\":\"None\",\"resynchronizationState\":\"None\",\"fabricObjectId\":\"6e6e15ee-3d3b-5f95-9460-157e67b6aa32\",\"fabricObjectName\":\"testsamlee1\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"fabricId\":\"c1cd158e-1855-4b4d-be3b-8dc601132914\",\"targetFabricId\":\"0566da75-1cd8-44c3-a515-882ff8da67cf\",\"draId\":\"d961e8a1-901b-4715-9266-8eef2dbe9673\",\"targetDraId\":\"4f127877-8fc2-4d92-b473-ff87c88d7ad9\",\"resyncRequired\":\"false\",\"allowedJobs\":[\"DisableProtection\"],\"replicationHealth\":\"Critical\",\"healthErrors\":[{\"childErrors\":[],\"code\":\"HyperVToAzStackHCIRcmServiceReplicationCycleFailed\",\"healthCategory\":\"Replication\",\"category\":\"SystemError\",\"severity\":\"Error\",\"source\":\"ASR\",\"creationTime\":\"2023-09-16T23:23:16.2127792Z\",\"isCustomerResolvable\":\"false\",\"summary\":\"\",\"message\":\"ErrorCode: \u0027499\u0027 VM: \u0027\u0027. Appliance: \u0027samlee3src4\u0027. Error: An internal error occurred. [Sequence contains no elements]\",\"causes\":\"The operation failed due to an internal error.\",\"recommendation\":\"Retry the operation. If the issue persists, contact support.\"}],\"customProperties\":{\"activeLocation\":\"Primary\",\"targetHciClusterId\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/clusters/mayadahciclus3\",\"targetArcClusterCustomLocationId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.ExtendedLocation/customLocations/mayadahciclus3-CL\",\"targetAzStackHciClusterName\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.ExtendedLocation/customLocations/mayadahciclus3-CL\",\"fabricDiscoveryMachineId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/machines/0560e6aa-9b2d-45e5-92cd-4ff618d09bec\",\"disksToInclude\":null,\"nicsToInclude\":null,\"sourceVmName\":\"testsamlee1\",\"sourceCpuCores\":1,\"sourceMemoryInMegaBytes\":16384.0,\"targetVmName\":\"hciVm1\",\"targetResourceGroupId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg-tgt\",\"storageContainerId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/storageContainers/bbcontainer4\",\"hyperVGeneration\":\"1\",\"targetNetworkId\":null,\"testNetworkId\":null,\"targetCpuCores\":1,\"isDynamicRam\":true,\"dynamicMemoryConfig\":{\"maximumMemoryInMegaBytes\":1048576,\"minimumMemoryInMegaBytes\":1024,\"targetMemoryBufferPercentage\":20},\"targetMemoryInMegaBytes\":16384,\"runAsAccountId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/runasaccounts/851ad7af-b65d-53e6-8c3a-3a5058cbad77\",\"sourceDraName\":\"samlee3src48adfdra\",\"targetDraName\":\"samlee3te2acdra\",\"sourceApplianceName\":\"samlee3src4\",\"targetApplianceName\":\"samlee3t\",\"osType\":\"otherguestfamily\",\"osName\":null,\"firmwareType\":\"BIOS\",\"targetLocation\":\"Southeast Asia\",\"customLocationRegion\":\"eastus\",\"failoverRecoveryPointId\":null,\"lastRecoveryPointId\":null,\"initialReplicationProgressPercentage\":0,\"resyncProgressPercentage\":null,\"protectedDisks\":[{\"storageContainerId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/storageContainers/bbcontainer4\",\"storageContainerLocalPath\":\"c:\\\\clusterstorage\\\\volume03\\\\migratedvms\\\\d206abfad9d93a1\",\"sourceDiskId\":\"Microsoft:0560E6AA-9B2D-45E5-92CD-4FF618D09BEC\\\\83F8638B-8DCA-4152-9EDA-2CA8B33039B4\\\\0\\\\0\\\\L\",\"sourceDiskName\":\"14393.0.amd64fre.rs1_release.160715-1616_server_serverdatacentereval_en-us_138E9ECD-3547-4241-975F-4404FD4F5132\",\"seedDiskName\":\"hciVm1-OSdisk-14393-0-amd6-3934-seed\",\"testMigrateDiskName\":\"hciVm1-OSdisk-14393-0-amd6-0d5c-test\",\"migrateDiskName\":\"hciVm1-OSdisk-14393-0-amd6-0d5c\",\"isOsDisk\":true,\"capacityInBytes\":42949672960,\"isDynamic\":true,\"diskType\":\"VHDX\"}],\"protectedNics\":[{\"nicId\":\"Microsoft:0560E6AA-9B2D-45E5-92CD-4FF618D09BEC\\\\617EFC72-6B3C-47F4-9198-A58C24E787B6\",\"macAddress\":\"00:15:5d:e6:4f:f1\",\"networkName\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/virtualnetworks/external\",\"targetNetworkId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/virtualnetworks/external\",\"testNetworkId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/virtualnetworks/external\",\"selectionTypeForFailover\":\"SelectedByUser\"}],\"targetVmBiosId\":null,\"lastReplicationUpdateTime\":\"2023-09-16T23:30:06.4336581Z\",\"instanceType\":\"HyperVToAzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0560e6aa-9b2d-45e5-92cd-4ff618d09bec\",\"name\":\"0560e6aa-9b2d-45e5-92cd-4ff618d09bec\",\"type\":\"Microsoft.DataReplication/replicationVaults/protectedItems\",\"systemData\":null,\"tags\":null}", + "isContentBase64": false + } + }, + "Get-AzMigrateHCIServerReplication+[NoContext]+GetByInputObject+$GET+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0560e6aa-9b2d-45e5-92cd-4ff618d09bec?api-version=2021-02-16-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0560e6aa-9b2d-45e5-92cd-4ff618d09bec?api-version=2021-02-16-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "8" ], + "x-ms-client-request-id": [ "11de60d1-19a9-47ec-88ff-382fbdd1eccd" ], + "CommandName": [ "Az.Migrate.Internal\\Get-AzMigrateProtectedItem" ], + "FullCommandName": [ "Get-AzMigrateProtectedItem_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.6", "Az.Migrate/1.0.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "api-supported-versions": [ "2021-02-16-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-request-id": [ "4b1aeece-7042-4066-a23b-99932954d074" ], + "x-ms-correlation-request-id": [ "4b1aeece-7042-4066-a23b-99932954d074" ], + "x-ms-routing-request-id": [ "WESTCENTRALUS:20230916T233514Z:4b1aeece-7042-4066-a23b-99932954d074" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 883C892055D143948881AA328F631936 Ref B: CO6AA3150219045 Ref C: 2023-09-16T23:35:13Z" ], + "Date": [ "Sat, 16 Sep 2023 23:35:14 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "5608" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"policyName\":\"samlee3proj46422replicationvaultHyperVToAzStackHCIpolicy\",\"replicationExtensionName\":\"samlee3src48adfreplicationfabric-samlee3te2acreplicationfabric-MigReplicationExtn\",\"correlationId\":\"c1f6b6a9-a15b-43eb-84d9-2292ae42e1da\",\"provisioningState\":\"Succeeded\",\"protectionState\":\"InitialReplicationInProgress\",\"protectionStateDescription\":\"Initial replication is in progress\",\"testFailoverState\":\"None\",\"testFailoverStateDescription\":\"None\",\"resynchronizationState\":\"None\",\"fabricObjectId\":\"6e6e15ee-3d3b-5f95-9460-157e67b6aa32\",\"fabricObjectName\":\"testsamlee1\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"fabricId\":\"c1cd158e-1855-4b4d-be3b-8dc601132914\",\"targetFabricId\":\"0566da75-1cd8-44c3-a515-882ff8da67cf\",\"draId\":\"d961e8a1-901b-4715-9266-8eef2dbe9673\",\"targetDraId\":\"4f127877-8fc2-4d92-b473-ff87c88d7ad9\",\"resyncRequired\":\"false\",\"allowedJobs\":[\"DisableProtection\"],\"replicationHealth\":\"Critical\",\"healthErrors\":[{\"childErrors\":[],\"code\":\"HyperVToAzStackHCIRcmServiceReplicationCycleFailed\",\"healthCategory\":\"Replication\",\"category\":\"SystemError\",\"severity\":\"Error\",\"source\":\"ASR\",\"creationTime\":\"2023-09-16T23:23:16.2127792Z\",\"isCustomerResolvable\":\"false\",\"summary\":\"\",\"message\":\"ErrorCode: \u0027499\u0027 VM: \u0027\u0027. Appliance: \u0027samlee3src4\u0027. Error: An internal error occurred. [Sequence contains no elements]\",\"causes\":\"The operation failed due to an internal error.\",\"recommendation\":\"Retry the operation. If the issue persists, contact support.\"}],\"customProperties\":{\"activeLocation\":\"Primary\",\"targetHciClusterId\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/clusters/mayadahciclus3\",\"targetArcClusterCustomLocationId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.ExtendedLocation/customLocations/mayadahciclus3-CL\",\"targetAzStackHciClusterName\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.ExtendedLocation/customLocations/mayadahciclus3-CL\",\"fabricDiscoveryMachineId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/machines/0560e6aa-9b2d-45e5-92cd-4ff618d09bec\",\"disksToInclude\":null,\"nicsToInclude\":null,\"sourceVmName\":\"testsamlee1\",\"sourceCpuCores\":1,\"sourceMemoryInMegaBytes\":16384.0,\"targetVmName\":\"hciVm1\",\"targetResourceGroupId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg-tgt\",\"storageContainerId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/storageContainers/bbcontainer4\",\"hyperVGeneration\":\"1\",\"targetNetworkId\":null,\"testNetworkId\":null,\"targetCpuCores\":1,\"isDynamicRam\":true,\"dynamicMemoryConfig\":{\"maximumMemoryInMegaBytes\":1048576,\"minimumMemoryInMegaBytes\":1024,\"targetMemoryBufferPercentage\":20},\"targetMemoryInMegaBytes\":16384,\"runAsAccountId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/runasaccounts/851ad7af-b65d-53e6-8c3a-3a5058cbad77\",\"sourceDraName\":\"samlee3src48adfdra\",\"targetDraName\":\"samlee3te2acdra\",\"sourceApplianceName\":\"samlee3src4\",\"targetApplianceName\":\"samlee3t\",\"osType\":\"otherguestfamily\",\"osName\":null,\"firmwareType\":\"BIOS\",\"targetLocation\":\"Southeast Asia\",\"customLocationRegion\":\"eastus\",\"failoverRecoveryPointId\":null,\"lastRecoveryPointId\":null,\"initialReplicationProgressPercentage\":0,\"resyncProgressPercentage\":null,\"protectedDisks\":[{\"storageContainerId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/storageContainers/bbcontainer4\",\"storageContainerLocalPath\":\"c:\\\\clusterstorage\\\\volume03\\\\migratedvms\\\\d206abfad9d93a1\",\"sourceDiskId\":\"Microsoft:0560E6AA-9B2D-45E5-92CD-4FF618D09BEC\\\\83F8638B-8DCA-4152-9EDA-2CA8B33039B4\\\\0\\\\0\\\\L\",\"sourceDiskName\":\"14393.0.amd64fre.rs1_release.160715-1616_server_serverdatacentereval_en-us_138E9ECD-3547-4241-975F-4404FD4F5132\",\"seedDiskName\":\"hciVm1-OSdisk-14393-0-amd6-3934-seed\",\"testMigrateDiskName\":\"hciVm1-OSdisk-14393-0-amd6-0d5c-test\",\"migrateDiskName\":\"hciVm1-OSdisk-14393-0-amd6-0d5c\",\"isOsDisk\":true,\"capacityInBytes\":42949672960,\"isDynamic\":true,\"diskType\":\"VHDX\"}],\"protectedNics\":[{\"nicId\":\"Microsoft:0560E6AA-9B2D-45E5-92CD-4FF618D09BEC\\\\617EFC72-6B3C-47F4-9198-A58C24E787B6\",\"macAddress\":\"00:15:5d:e6:4f:f1\",\"networkName\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/virtualnetworks/external\",\"targetNetworkId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/virtualnetworks/external\",\"testNetworkId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/virtualnetworks/external\",\"selectionTypeForFailover\":\"SelectedByUser\"}],\"targetVmBiosId\":null,\"lastReplicationUpdateTime\":\"2023-09-16T23:30:06.4336581Z\",\"instanceType\":\"HyperVToAzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0560e6aa-9b2d-45e5-92cd-4ff618d09bec\",\"name\":\"0560e6aa-9b2d-45e5-92cd-4ff618d09bec\",\"type\":\"Microsoft.DataReplication/replicationVaults/protectedItems\",\"systemData\":null,\"tags\":null}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/test/Get-AzMigrateHCIServerReplication.Tests.ps1 b/src/Migrate/Migrate.Autorest/test/Get-AzMigrateHCIServerReplication.Tests.ps1 new file mode 100644 index 000000000000..78f6d2065e03 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/test/Get-AzMigrateHCIServerReplication.Tests.ps1 @@ -0,0 +1,38 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzMigrateHCIServerReplication')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzMigrateHCIServerReplication.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-AzMigrateHCIServerReplication' { + It 'ListByName' { + $output = Get-AzMigrateHCIServerReplication -ProjectName $env.hciProjectName -ResourceGroupName $env.hciMigResourceGroup -SubscriptionId $env.hciSubscriptionId + $output.Count | Should -BeGreaterOrEqual 1 + } + + It 'GetByItemID' { + $output = Get-AzMigrateHCIServerReplication -TargetObjectID $env.hciProtectedItem1 -SubscriptionId $env.hciSubscriptionId + $output.Count | Should -BeGreaterOrEqual 1 + } + + It 'GetBySDSID' { + $output = Get-AzMigrateHCIServerReplication -DiscoveredMachineId $env.hciSDSMachineID1 -SubscriptionId $env.hciSubscriptionId + $output.Count | Should -BeGreaterOrEqual 1 + } + + It 'GetByInputObject' { + $output = Get-AzMigrateHCIServerReplication -TargetObjectID $env.hciProtectedItem1 -SubscriptionId $env.hciSubscriptionId + $output = Get-AzMigrateHCIServerReplication -InputObject $output -SubscriptionId $env.hciSubscriptionId + $output.Count | Should -BeGreaterOrEqual 1 + } +} diff --git a/src/Migrate/Migrate.Autorest/test/Initialize-AzMigrateHCIReplicationInfrastructure.Tests.ps1 b/src/Migrate/Migrate.Autorest/test/Initialize-AzMigrateHCIReplicationInfrastructure.Tests.ps1 new file mode 100644 index 000000000000..a7e421971979 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/test/Initialize-AzMigrateHCIReplicationInfrastructure.Tests.ps1 @@ -0,0 +1,29 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Initialize-AzMigrateHCIReplicationInfrastructure')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Initialize-AzMigrateHCIReplicationInfrastructure.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 'Initialize-AzMigrateHCIReplicationInfrastructure' -Tag 'LiveOnly' { + It 'Default' { + $output = Initialize-AzMigrateHCIReplicationInfrastructure ` + -ProjectName $env.hciProjectName ` + -ResourceGroupName $env.hciMigResourceGroup ` + -SubscriptionId $env.hciSubscriptionId ` + -SourceApplianceName $env.hciSourceApplianceName ` + -TargetApplianceName $env.hciTargetApplianceName ` + -CacheStorageAccountId $env.hciReplicationStorageAccountId ` + -PassThru + $output | Should -Be $true + } +} diff --git a/src/Migrate/Migrate.Autorest/test/New-AzMigrateHCIDiskMappingObject.Tests.ps1 b/src/Migrate/Migrate.Autorest/test/New-AzMigrateHCIDiskMappingObject.Tests.ps1 new file mode 100644 index 000000000000..87a97edad4e3 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/test/New-AzMigrateHCIDiskMappingObject.Tests.ps1 @@ -0,0 +1,23 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzMigrateHCIDiskMappingObject')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzMigrateHCIDiskMappingObject.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-AzMigrateHCIDiskMappingObject' { + It '__AllParameterSets' { + $output = New-AzMigrateHCIDiskMappingObject -DiskID a -IsOSDisk true -IsDynamic true -Size 1 -Format VHDX + $output.Count | Should -BeGreaterOrEqual 1 + $output.DiskId | Should -Be a + } +} diff --git a/src/Migrate/Migrate.Autorest/test/New-AzMigrateHCINicMappingObject.Tests.ps1 b/src/Migrate/Migrate.Autorest/test/New-AzMigrateHCINicMappingObject.Tests.ps1 new file mode 100644 index 000000000000..15cb547f0d9d --- /dev/null +++ b/src/Migrate/Migrate.Autorest/test/New-AzMigrateHCINicMappingObject.Tests.ps1 @@ -0,0 +1,23 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzMigrateHCINicMappingObject')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzMigrateHCINicMappingObject.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-AzMigrateHCINicMappingObject' { + It '__AllParameterSets' { + $output = New-AzMigrateHCINicMappingObject -NicID a -TargetVirtualSwitchId "/subscriptions/xxx-xxx-xxx/resourceGroups/hciclus-rg/providers/Microsoft.AzureStackHCI/virtualnetworks/external" + $output.Count | Should -BeGreaterOrEqual 1 + $output.NicID | Should -Be a + } +} diff --git a/src/Migrate/Migrate.Autorest/test/New-AzMigrateHCIServerReplication.Recording.json b/src/Migrate/Migrate.Autorest/test/New-AzMigrateHCIServerReplication.Recording.json new file mode 100644 index 000000000000..5739fabf8aac --- /dev/null +++ b/src/Migrate/Migrate.Autorest/test/New-AzMigrateHCIServerReplication.Recording.json @@ -0,0 +1,426 @@ +{ + "New-AzMigrateHCIServerReplication+[NoContext]+ByIdDefaultUser+$GET+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/machines/0560e6aa-9b2d-45e5-92cd-4ff618d09bec?api-version=2020-01-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/machines/0560e6aa-9b2d-45e5-92cd-4ff618d09bec?api-version=2020-01-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "1" ], + "x-ms-client-request-id": [ "e09ae545-f52e-4adc-882a-e5484358757f" ], + "CommandName": [ "Az.Migrate.Internal\\Get-AzMigrateHyperVMachine" ], + "FullCommandName": [ "Get-AzMigrateHyperVMachine_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.6", "Az.Migrate/1.0.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-request-id": [ "504ab966-7456-48da-988a-dc89f65f2c6e" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11998" ], + "x-ms-correlation-request-id": [ "ccf78cdd-f58c-46ec-a091-bc95d99dc32f" ], + "x-ms-routing-request-id": [ "WESTCENTRALUS:20230916T232828Z:ccf78cdd-f58c-46ec-a091-bc95d99dc32f" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 63F49957AAA64B62B508B1B616FC3301 Ref B: CO6AA3150219045 Ref C: 2023-09-16T23:28:27Z" ], + "Date": [ "Sat, 16 Sep 2023 23:28:27 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "4504" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"instanceUuid\":\"0560e6aa-9b2d-45e5-92cd-4ff618d09bec\",\"hostFqdn\":\"RRN44-13-33.CFDEV.NTTEST.MICROSOFT.COM\",\"hostId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/hosts/rrn44-13-33-cfdev-nttest-micros-8c18e4d9-da77-4eb3-aecd-61afae77325f\",\"generation\":1,\"version\":\"5.0\",\"highAvailability\":\"No\",\"clusterFqdn\":null,\"clusterId\":null,\"maxMemoryMB\":1048576,\"isDynamicMemoryEnabled\":false,\"disks\":[{\"instanceId\":\"Microsoft:0560E6AA-9B2D-45E5-92CD-4FF618D09BEC\\\\83F8638B-8DCA-4152-9EDA-2CA8B33039B4\\\\0\\\\0\\\\L\",\"vhdId\":\"01d7a152-d18d-490f-ad07-db8620f6a09d\",\"maxSizeInBytes\":42949672960,\"name\":\"14393.0.amd64fre.rs1_release.160715-1616_server_serverdatacentereval_en-us_138E9ECD-3547-4241-975F-4404FD4F5132\",\"diskType\":\"Differencing\",\"lun\":0,\"path\":\"F:\\\\samlee3vms\\\\testsamlee1vm\\\\14393.0.amd64fre.rs1_release.160715-1616_server_serverdatacentereval_en-us_138E9ECD-3547-4241-975F-4404FD4F5132.avhd\"}],\"networkAdapters\":[{\"networkId\":\"\",\"subnetName\":\"\",\"staticIpAdress\":null,\"nicType\":\"NicType\",\"nicId\":\"Microsoft:0560E6AA-9B2D-45E5-92CD-4FF618D09BEC\\\\617EFC72-6B3C-47F4-9198-A58C24E787B6\",\"macAddress\":\"00:15:5d:e6:4f:f1\",\"ipAddressList\":[],\"networkName\":null,\"ipAddressType\":\"Dynamic\"}],\"managementServerType\":\"Host\",\"secureBootTemplateId\":\"\",\"secureBootEnabled\":false,\"secureBootTemplate\":\"\",\"tpmEnabled\":false,\"ksdEnabled\":false,\"shieldingRequested\":false,\"dataProtectionRequested\":false,\"encryptStateAndVmMigrationTraffic\":false,\"virtualizationBasedSecurityOptOut\":false,\"powerStatus\":\"PowerOff\",\"vmFqdn\":\"\",\"vmConfigurationFileLocation\":\"F:\\\\samlee3vms\\\\testsamlee1vm\\\\testsamlee1\\\\Virtual Machines\\\\0560E6AA-9B2D-45E5-92CD-4FF618D09BEC.xml\",\"firmware\":\"BIOS\",\"guestOSDetails\":{\"osType\":null,\"osName\":null,\"osVersion\":null,\"osArchitecture\":null},\"numberOfApplications\":-1,\"guestDetailsDiscoveryTimestamp\":null,\"isFileServerSupported\":null,\"isGuestDetailsDiscoveryInProgress\":true,\"dependencyMapping\":\"Disabled\",\"dependencyMappingStartTime\":null,\"dependencyMappingEndTime\":null,\"runAsAccountId\":null,\"applianceNames\":[],\"errors\":[],\"applicationDiscovery\":{\"discoveryScopeStatus\":\"RunAsAccountNotAssociated\",\"errors\":[],\"hydratedRunAsAccountId\":null},\"dependencyMapDiscovery\":{\"discoveryScopeStatus\":\"RunAsAccountNotAssociated\",\"errors\":[],\"hydratedRunAsAccountId\":null},\"staticDiscovery\":{\"discoveryScopeStatus\":\"DiscoverySucceeded\",\"errors\":[],\"hydratedRunAsAccountId\":null},\"sqlDiscovery\":{\"successfullyDiscoveredServerCount\":-1,\"totalServerCount\":-1,\"sqlMetadataHydratedRunAsAccountId\":null,\"sqlMetadataDiscoveryPipe\":\"Unknown\",\"discoveryScopeStatus\":\"RunAsAccountNotAssociated\"},\"webAppDiscovery\":{\"totalWebServerCount\":0,\"totalWebApplicationCount\":0,\"discoveryScopeStatus\":\"RunAsAccountNotAssociated\"},\"oracleDiscovery\":{\"totalInstanceCount\":0,\"totalDatabaseCount\":0,\"shallowDiscoveryStatus\":\"Disabled\",\"discoveryScopeStatus\":\"DiscoverySucceeded\"},\"springBootDiscovery\":{\"totalInstanceCount\":0,\"totalApplicationCount\":0,\"shallowDiscoveryStatus\":\"Disabled\",\"discoveryScopeStatus\":\"DiscoverySucceeded\"},\"mySQLDiscovery\":{\"totalInstanceCount\":0,\"totalDatabaseCount\":0,\"shallowDiscoveryStatus\":\"Disabled\",\"discoveryScopeStatus\":\"DiscoverySucceeded\"},\"iisDiscovery\":{\"totalWebServerCount\":0,\"totalWebApplicationCount\":0,\"discoveryScopeStatus\":\"RunAsAccountNotAssociated\"},\"tomcatDiscovery\":{\"totalWebServerCount\":0,\"totalWebApplicationCount\":0,\"discoveryScopeStatus\":\"RunAsAccountNotAssociated\"},\"appsAndRoles\":null,\"productSupportStatus\":{\"currentVersion\":null,\"esuStatus\":\"Unknown\",\"supportStatus\":\"Unknown\",\"supportEndDate\":\"0001-01-01T00:00:00\",\"esuYear\":\"Unknown\"},\"eTag\":\"\\\"1c04a172-0000-1800-0000-650639570000\\\"\",\"numberOfProcessorCore\":1,\"allocatedMemoryInMB\":16384.0,\"operatingSystemDetails\":{\"osType\":\"otherguestfamily\",\"osName\":null,\"osVersion\":null,\"osArchitecture\":null},\"biosSerialNumber\":\"6736-3103-4448-5783-4045-8105-00\",\"biosGuid\":\"52CE3FBC-60FD-400B-8D9F-D0839790B885\",\"displayName\":\"testsamlee1\",\"isDeleted\":false,\"createdTimestamp\":\"2023-08-31T22:45:58.1940880Z\",\"tags\":{\"asrprotectedmachine\":\"false\"},\"updatedTimestamp\":\"2023-09-16T23:25:11.1017631Z\"},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/machines/0560e6aa-9b2d-45e5-92cd-4ff618d09bec\",\"name\":\"0560e6aa-9b2d-45e5-92cd-4ff618d09bec\",\"type\":\"Microsoft.OffAzure/HyperVSites/machines\",\"tags\":{\"asrprotectedmachine\":\"false\"}}", + "isContentBase64": false + } + }, + "New-AzMigrateHCIServerReplication+[NoContext]+ByIdDefaultUser+$GET+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site?api-version=2020-01-01+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site?api-version=2020-01-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "2" ], + "x-ms-client-request-id": [ "cb5709ca-6c29-4130-badb-3b2d88ba9c14" ], + "CommandName": [ "Az.Migrate.Internal\\Get-AzMigrateHyperVSite" ], + "FullCommandName": [ "Get-AzMigrateHyperVSite_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.6", "Az.Migrate/1.0.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"2e01917f-0000-1800-0000-650639670000\"" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-request-id": [ "e859993e-9f0e-44da-9f2b-0f275a4e66fe" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-correlation-request-id": [ "22bf65f7-0508-4d65-b45b-e39ac18eb286" ], + "x-ms-routing-request-id": [ "WESTCENTRALUS:20230916T232830Z:22bf65f7-0508-4d65-b45b-e39ac18eb286" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 20795FAB8FE846C78839D31C30C67ECA Ref B: CO6AA3150219045 Ref C: 2023-09-16T23:28:28Z" ], + "Date": [ "Sat, 16 Sep 2023 23:28:29 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "2629" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site\",\"name\":\"samlee3src41244site\",\"type\":\"Microsoft.OffAzure/HyperVSites\",\"etag\":\"\\\"2e01917f-0000-1800-0000-650639670000\\\"\",\"location\":\"southeastasia\",\"kind\":\"Migrate\",\"properties\":{\"masterSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/MasterSites/samlee3proj46422mastersite\",\"servicePrincipalIdentityDetails\":{\"tenantId\":\"c76bd4d1-bea3-45ea-be1b-4a745a675d07\",\"applicationId\":\"e2344540-afb8-4d15-843d-2e7c35b090ab\",\"objectId\":\"c8c56849-02b1-4b12-95af-c2e94b9aaf1e\",\"audience\":\"e2344540-afb8-4d15-843d-2e7c35b090ab\",\"aadAuthority\":\"https://login.microsoftonline.com/c76bd4d1-bea3-45ea-be1b-4a745a675d07\",\"rawCertData\":\"MIIDNDCCAhygAwIBAgIQdGNdN/CjS8ufM+qldDz6xzANBgkqhkiG9w0BAQsFADAXMRUwEwYDVQQDEwxBZ2VudFNwbkNlcnQwHhcNMjMwODA5MjIyMTE2WhcNMjQwODA5MjIzMTE2WjAXMRUwEwYDVQQDEwxBZ2VudFNwbkNlcnQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDuy6pxPqzVD9WVHGBw3+EQNSAbkvCMGDU+yNu6e1a1+OGonopJYJ+W5IF9pgCgGY/VK5Yokgv4gj+dDCaHEDXshLxh9cLoaxXwvP83UdoR2e7lA3cbGAXqxJQw2/9jfaoa+ipvnenejKiWEjWzZmxPglWGGaO+NnhQm6l99a+Az2SGT+7Z8BD+eiNLu/kvblhu2I2zlBDxtaq+HtRtcduO0PRpbrTV7WTUCIpRKnELs4+Kz1VleCK3idxUZgwQiKcc/BbjS0jtF2tKr7KiUUNqTDGm2RtYqx4RShYjt+baXs477XtjEjl0NTK85XOMFyyXyTn8P9rW42eDZzgorlY1AgMBAAGjfDB6MA4GA1UdDwEB/wQEAwIFoDAJBgNVHRMEAjAAMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjAfBgNVHSMEGDAWgBQvwkawBAIeLPXDn6aMqPWc4S2M3jAdBgNVHQ4EFgQUL8JGsAQCHiz1w5+mjKj1nOEtjN4wDQYJKoZIhvcNAQELBQADggEBAArSSHkrEHcJyz75KC1DNFdrpESEo5Wy3oV4gZe4cOtfQd8tu4iJUSgagy1NdoQ2puatD7CJQ0nvAUGzAu5MMbeotihBvtHLSJTxbxumRgshsblrZA+a38q9qwUSLlJP9dUtG/cN0G0jB6xLj9ZoeHXKviQodLlXqHPb7qhHHqMxKFKZViWU2tV863QYLVSDR7eZOD7qiFXPxm0RNQyrHctrvT4k3Ra1E22gxH171PSDfdab9GBGDitzw9lErLK2qfIwE7SoaSUm1YXu0A5z7eQJSDcojdfi4lzhOUtmJN/Gmln/JrZ4AGhAs9gghe5n/c6vp85UomtWAc6lXJkWZK4=\"},\"agentDetails\":{\"id\":\"38144592-82bd-4537-806a-2529e6f42f4d-agent\",\"version\":\"2.0.2199.56\",\"lastHeartBeatUtc\":\"2023-09-16T23:20:33.5941976Z\",\"keyVaultUri\":\"https://samlee3proj46422kv.vault.azure.net\",\"keyVaultId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.KeyVault/vaults/samlee3proj46422kv\"},\"applianceName\":\"samlee3src4\",\"discoverySolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.Migrate/MigrateProjects/samlee3proj4/Solutions/Servers-Discovery-ServerDiscovery\",\"serviceEndpoint\":\"https://discoverysrv.sea.test.migration.windowsazure.com/\",\"provisioningState\":\"Succeeded\"}}", + "isContentBase64": false + } + }, + "New-AzMigrateHCIServerReplication+[NoContext]+ByIdDefaultUser+$GET+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.Migrate/migrateProjects/samlee3proj4/solutions/Servers-Migration-ServerMigration_DataReplication?api-version=2018-09-01-preview+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.Migrate/migrateProjects/samlee3proj4/solutions/Servers-Migration-ServerMigration_DataReplication?api-version=2018-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "3" ], + "x-ms-client-request-id": [ "ce0d126f-ae95-4c23-a54f-50c8ab799a79" ], + "CommandName": [ "Az.Migrate\\Get-AzMigrateSolution" ], + "FullCommandName": [ "Get-AzMigrateSolution_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.6", "Az.Migrate/1.0.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "162755bc-3e6a-42cc-875d-31c36e9c5977" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-correlation-request-id": [ "dce561f7-cdea-42e7-be9e-894289ba6989" ], + "x-ms-routing-request-id": [ "WESTCENTRALUS:20230916T232831Z:dce561f7-cdea-42e7-be9e-894289ba6989" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 9D9478C2454741F68B956FF77C7D85AC Ref B: CO6AA3150219045 Ref C: 2023-09-16T23:28:30Z" ], + "Date": [ "Sat, 16 Sep 2023 23:28:31 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1120" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.Migrate/MigrateProjects/samlee3proj4/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"name\":\"Servers-Migration-ServerMigration_DataReplication\",\"type\":\"Microsoft.Migrate/MigrateProjects/Solutions\",\"etag\":\"\\\"3f005dae-0000-1800-0000-650638f80000\\\"\",\"properties\":{\"tool\":\"ServerMigration_DataReplication\",\"purpose\":\"Migration\",\"goal\":\"Servers\",\"status\":\"Inactive\",\"cleanupState\":\"None\",\"summary\":{\"instanceType\":\"Servers\",\"discoveredCount\":0,\"assessedCount\":0,\"replicatingCount\":0,\"testMigratedCount\":0,\"migratedCount\":0},\"details\":{\"groupCount\":0,\"assessmentCount\":0,\"extendedDetails\":{\"serversOnWindows\":\"0\",\"serversOnLinux\":\"0\",\"serversOnOther\":\"0\",\"dependencyEnabledMachines\":\"0\",\"machinesHavingSqlServers\":\"0\",\"machinesHavingWebServers\":\"0\",\"vaultId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault\",\"aszreplicatingCount\":\"20\",\"asztestMigratedCount\":\"0\",\"aszmigratedCount\":\"5\"}}}}", + "isContentBase64": false + } + }, + "New-AzMigrateHCIServerReplication+[NoContext]+ByIdDefaultUser+$PUT+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0560e6aa-9b2d-45e5-92cd-4ff618d09bec?api-version=2021-02-16-preview+4": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0560e6aa-9b2d-45e5-92cd-4ff618d09bec?api-version=2021-02-16-preview", + "Content": "{\r\n \"properties\": {\r\n \"policyName\": \"samlee3proj46422replicationvaultHyperVToAzStackHCIpolicy\",\r\n \"replicationExtensionName\": \"samlee3src48adfreplicationfabric-samlee3te2acreplicationfabric-MigReplicationExtn\",\r\n \"customProperties\": {\r\n \"instanceType\": \"HyperVToAzStackHCI\",\r\n \"targetHciClusterId\": \"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/clusters/mayadahciclus3\",\r\n \"targetArcClusterCustomLocationId\": \"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.ExtendedLocation/customLocations/mayadahciclus3-CL\",\r\n \"fabricDiscoveryMachineId\": \"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/machines/0560e6aa-9b2d-45e5-92cd-4ff618d09bec\",\r\n \"disksToInclude\": [\r\n {\r\n \"diskId\": \"Microsoft:0560E6AA-9B2D-45E5-92CD-4FF618D09BEC\\\\83F8638B-8DCA-4152-9EDA-2CA8B33039B4\\\\0\\\\0\\\\L\",\r\n \"isDynamic\": true,\r\n \"diskSizeGB\": 40,\r\n \"diskFileFormat\": \"VHDX\",\r\n \"isOsDisk\": true\r\n }\r\n ],\r\n \"nicsToInclude\": [\r\n {\r\n \"nicId\": \"Microsoft:0560E6AA-9B2D-45E5-92CD-4FF618D09BEC\\\\617EFC72-6B3C-47F4-9198-A58C24E787B6\",\r\n \"targetNetworkId\": \"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/virtualnetworks/external\",\r\n \"testNetworkId\": \"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/virtualnetworks/external\",\r\n \"selectionTypeForFailover\": \"SelectedByUser\"\r\n }\r\n ],\r\n \"targetVmName\": \"hciVm1\",\r\n \"targetResourceGroupId\": \"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg-tgt\",\r\n \"storageContainerId\": \"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/storageContainers/bbcontainer4\",\r\n \"hyperVGeneration\": \"1\",\r\n \"targetCpuCores\": 1,\r\n \"isDynamicRam\": true,\r\n \"dynamicMemoryConfig\": {\r\n \"maximumMemoryInMegaBytes\": 1048576,\r\n \"minimumMemoryInMegaBytes\": 1024,\r\n \"targetMemoryBufferPercentage\": 20\r\n },\r\n \"targetMemoryInMegaBytes\": 16384,\r\n \"runAsAccountId\": \"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/runasaccounts/851ad7af-b65d-53e6-8c3a-3a5058cbad77\",\r\n \"sourceDraName\": \"samlee3src48adfdra\",\r\n \"targetDraName\": \"samlee3te2acdra\",\r\n \"customLocationRegion\": \"eastus\"\r\n }\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "2765" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0560e6aa-9b2d-45e5-92cd-4ff618d09bec/operations/21507a4a-28d3-4b65-83e2-3d666f61a3f9?api-version=2021-02-16-preview" ], + "Retry-After": [ "15" ], + "Azure-AsyncOperation": [ "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0560e6aa-9b2d-45e5-92cd-4ff618d09bec/operations/21507a4a-28d3-4b65-83e2-3d666f61a3f9?api-version=2021-02-16-preview" ], + "x-ms-client-request-id": [ "e35834e8-6f0e-4360-a3cf-fbc5dc921cac" ], + "api-supported-versions": [ "2021-02-16-preview" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], + "x-ms-request-id": [ "d9a16538-982f-473e-b464-03ecaac8f0bc" ], + "x-ms-correlation-request-id": [ "d9a16538-982f-473e-b464-03ecaac8f0bc" ], + "x-ms-routing-request-id": [ "WESTCENTRALUS:20230916T232845Z:d9a16538-982f-473e-b464-03ecaac8f0bc" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 541A62B76E3B4DA1BB5F51B9D79D8AC5 Ref B: CO6AA3150219045 Ref C: 2023-09-16T23:28:42Z" ], + "Date": [ "Sat, 16 Sep 2023 23:28:44 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "3789" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"policyName\":\"samlee3proj46422replicationvaultHyperVToAzStackHCIpolicy\",\"replicationExtensionName\":\"samlee3src48adfreplicationfabric-samlee3te2acreplicationfabric-MigReplicationExtn\",\"correlationId\":null,\"provisioningState\":\"Creating\",\"protectionState\":\"UnprotectedStatesBegin\",\"protectionStateDescription\":null,\"testFailoverState\":\"None\",\"testFailoverStateDescription\":null,\"resynchronizationState\":\"None\",\"fabricObjectId\":null,\"fabricObjectName\":null,\"sourceFabricProviderId\":null,\"targetFabricProviderId\":null,\"fabricId\":null,\"targetFabricId\":null,\"draId\":null,\"targetDraId\":null,\"resyncRequired\":\"false\",\"allowedJobs\":null,\"replicationHealth\":\"Normal\",\"healthErrors\":null,\"customProperties\":{\"activeLocation\":\"Primary\",\"targetHciClusterId\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/clusters/mayadahciclus3\",\"targetArcClusterCustomLocationId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.ExtendedLocation/customLocations/mayadahciclus3-CL\",\"targetAzStackHciClusterName\":null,\"fabricDiscoveryMachineId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/machines/0560e6aa-9b2d-45e5-92cd-4ff618d09bec\",\"disksToInclude\":[{\"diskId\":\"Microsoft:0560E6AA-9B2D-45E5-92CD-4FF618D09BEC\\\\83F8638B-8DCA-4152-9EDA-2CA8B33039B4\\\\0\\\\0\\\\L\",\"storageContainerId\":null,\"isDynamic\":true,\"diskSizeGB\":40,\"diskFileFormat\":\"VHDX\",\"isOsDisk\":true}],\"nicsToInclude\":[{\"nicId\":\"Microsoft:0560E6AA-9B2D-45E5-92CD-4FF618D09BEC\\\\617EFC72-6B3C-47F4-9198-A58C24E787B6\",\"networkName\":null,\"targetNetworkId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/virtualnetworks/external\",\"testNetworkId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/virtualnetworks/external\",\"selectionTypeForFailover\":\"SelectedByUser\"}],\"sourceVmName\":null,\"sourceCpuCores\":null,\"sourceMemoryInMegaBytes\":null,\"targetVmName\":\"hciVm1\",\"targetResourceGroupId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg-tgt\",\"storageContainerId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/storageContainers/bbcontainer4\",\"hyperVGeneration\":\"1\",\"targetNetworkId\":null,\"testNetworkId\":null,\"targetCpuCores\":1,\"isDynamicRam\":true,\"dynamicMemoryConfig\":{\"maximumMemoryInMegaBytes\":1048576,\"minimumMemoryInMegaBytes\":1024,\"targetMemoryBufferPercentage\":20},\"targetMemoryInMegaBytes\":16384,\"runAsAccountId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/runasaccounts/851ad7af-b65d-53e6-8c3a-3a5058cbad77\",\"sourceDraName\":\"samlee3src48adfdra\",\"targetDraName\":\"samlee3te2acdra\",\"sourceApplianceName\":null,\"targetApplianceName\":null,\"osType\":null,\"osName\":null,\"firmwareType\":null,\"targetLocation\":null,\"customLocationRegion\":\"eastus\",\"failoverRecoveryPointId\":null,\"lastRecoveryPointId\":null,\"initialReplicationProgressPercentage\":null,\"resyncProgressPercentage\":null,\"protectedDisks\":[],\"protectedNics\":[],\"targetVmBiosId\":null,\"lastReplicationUpdateTime\":null,\"instanceType\":\"HyperVToAzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0560e6aa-9b2d-45e5-92cd-4ff618d09bec\",\"name\":\"0560e6aa-9b2d-45e5-92cd-4ff618d09bec\",\"type\":\"Microsoft.DataReplication/replicationVaults/protectedItems\",\"systemData\":null,\"tags\":null}", + "isContentBase64": false + } + }, + "New-AzMigrateHCIServerReplication+[NoContext]+ByIdDefaultUser+$GET+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/21507a4a-28d3-4b65-83e2-3d666f61a3f9?api-version=2021-02-16-preview+5": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/21507a4a-28d3-4b65-83e2-3d666f61a3f9?api-version=2021-02-16-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "11" ], + "x-ms-client-request-id": [ "40f31d9c-f0b3-4e98-9ca5-fa828d08ca31" ], + "CommandName": [ "Az.Migrate.Internal\\Get-AzMigrateWorkflow" ], + "FullCommandName": [ "Get-AzMigrateWorkflow_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v9.6.0", "PSVersion/v7.3.6", "Az.Migrate/1.0.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "api-supported-versions": [ "2021-02-16-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11996" ], + "x-ms-request-id": [ "c1e158b8-9119-4369-8ab1-20ff042d0899" ], + "x-ms-correlation-request-id": [ "c1e158b8-9119-4369-8ab1-20ff042d0899" ], + "x-ms-routing-request-id": [ "WESTCENTRALUS:20230916T232846Z:c1e158b8-9119-4369-8ab1-20ff042d0899" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 09C1931EB08643BD83BC618CCC66DE6E Ref B: CO6AA3150219045 Ref C: 2023-09-16T23:28:45Z" ], + "Date": [ "Sat, 16 Sep 2023 23:28:45 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "2068" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Started\",\"startTime\":\"2023-09-16T23:28:45.182144Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0560e6aa-9b2d-45e5-92cd-4ff618d09bec\",\"objectName\":\"0560e6aa-9b2d-45e5-92cd-4ff618d09bec\",\"objectInternalId\":\"6e6e15ee-3d3b-5f95-9460-157e67b6aa32\",\"objectInternalName\":\"testsamlee1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Cancel\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":[{\"taskName\":\"Creating or updating the protected item\",\"state\":\"Started\",\"startTime\":\"2023-09-16T23:28:45.7187977Z\",\"customProperties\":{\"instanceType\":\"TaskDetails\"},\"childrenWorkflows\":[]},{\"taskName\":\"Initializing Protection\",\"state\":\"Pending\",\"customProperties\":{\"instanceType\":\"TaskDetails\"},\"childrenWorkflows\":[]},{\"taskName\":\"Enabling Protection\",\"state\":\"Pending\",\"customProperties\":{\"instanceType\":\"TaskDetails\"},\"childrenWorkflows\":[]},{\"taskName\":\"Starting Replication\",\"state\":\"Pending\",\"customProperties\":{\"instanceType\":\"TaskDetails\"},\"childrenWorkflows\":[]}],\"errors\":[],\"customProperties\":{\"instanceType\":\"WorkflowDetails\",\"affectedObjectDetails\":{\"PolicyName\":\"samlee3proj46422replicationvaultHyperVToAzStackHCIpolicy\",\"ReplicationExtensionName\":\"samlee3src48adfreplicationfabric-samlee3te2acreplicationfabric-MigReplicationExtn\",\"VaultId\":\"62ef9ab2-1017-434a-ac4e-2f2ec988323d\"}}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/21507a4a-28d3-4b65-83e2-3d666f61a3f9\",\"name\":\"21507a4a-28d3-4b65-83e2-3d666f61a3f9\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null}", + "isContentBase64": false + } + }, + "New-AzMigrateHCIServerReplication+[NoContext]+ByIdPowerUser+$GET+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/machines/a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b?api-version=2020-01-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/machines/a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b?api-version=2020-01-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "12" ], + "x-ms-client-request-id": [ "1b8dd35c-1389-420a-8f10-db4105795d17" ], + "CommandName": [ "Az.Migrate.Internal\\Get-AzMigrateHyperVMachine" ], + "FullCommandName": [ "Get-AzMigrateHyperVMachine_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v9.6.0", "PSVersion/v7.3.6", "Az.Migrate/1.0.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-request-id": [ "d7c9f23c-a911-4cdb-aa0f-458dcda1bf42" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11997" ], + "x-ms-correlation-request-id": [ "be42d847-2c31-4607-a7d1-f69368869dfe" ], + "x-ms-routing-request-id": [ "WESTCENTRALUS:20230916T232848Z:be42d847-2c31-4607-a7d1-f69368869dfe" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: B7C94C0BE7A14D839804577E92CEE272 Ref B: CO6AA3150219045 Ref C: 2023-09-16T23:28:47Z" ], + "Date": [ "Sat, 16 Sep 2023 23:28:48 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "4424" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"instanceUuid\":\"a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b\",\"hostFqdn\":\"RRN44-13-33.CFDEV.NTTEST.MICROSOFT.COM\",\"hostId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/hosts/rrn44-13-33-cfdev-nttest-micros-8c18e4d9-da77-4eb3-aecd-61afae77325f\",\"generation\":1,\"version\":\"5.0\",\"highAvailability\":\"No\",\"clusterFqdn\":null,\"clusterId\":null,\"maxMemoryMB\":1048576,\"isDynamicMemoryEnabled\":false,\"disks\":[{\"instanceId\":\"Microsoft:A0247DB0-CECA-4CB1-AE6C-1D4AC98CA82B\\\\83F8638B-8DCA-4152-9EDA-2CA8B33039B4\\\\0\\\\0\\\\L\",\"vhdId\":\"4845656d-75b2-1246-bc8f-13d900000000\",\"maxSizeInBytes\":42949672960,\"name\":\"14393.0.amd64fre.rs1_release.160715-1616_server_serverdatacentereval_en-us\",\"diskType\":\"Dynamic\",\"lun\":0,\"path\":\"F:\\\\samlee3vms\\\\testsamlee2vm\\\\14393.0.amd64fre.rs1_release.160715-1616_server_serverdatacentereval_en-us.vhd\"}],\"networkAdapters\":[{\"networkId\":\"\",\"subnetName\":\"\",\"staticIpAdress\":null,\"nicType\":\"NicType\",\"nicId\":\"Microsoft:A0247DB0-CECA-4CB1-AE6C-1D4AC98CA82B\\\\8A3C8701-4ACE-4F99-832E-294ACC0F51C3\",\"macAddress\":\"00:15:5d:e6:4f:f2\",\"ipAddressList\":[],\"networkName\":null,\"ipAddressType\":\"Dynamic\"}],\"managementServerType\":\"Host\",\"secureBootTemplateId\":\"\",\"secureBootEnabled\":false,\"secureBootTemplate\":\"\",\"tpmEnabled\":false,\"ksdEnabled\":false,\"shieldingRequested\":false,\"dataProtectionRequested\":false,\"encryptStateAndVmMigrationTraffic\":false,\"virtualizationBasedSecurityOptOut\":false,\"powerStatus\":\"PowerOff\",\"vmFqdn\":\"\",\"vmConfigurationFileLocation\":\"F:\\\\samlee3vms\\\\testsamlee2vm\\\\testsamlee2\\\\Virtual Machines\\\\A0247DB0-CECA-4CB1-AE6C-1D4AC98CA82B.xml\",\"firmware\":\"BIOS\",\"guestOSDetails\":{\"osType\":null,\"osName\":null,\"osVersion\":null,\"osArchitecture\":null},\"numberOfApplications\":-1,\"guestDetailsDiscoveryTimestamp\":null,\"isFileServerSupported\":null,\"isGuestDetailsDiscoveryInProgress\":true,\"dependencyMapping\":\"Disabled\",\"dependencyMappingStartTime\":null,\"dependencyMappingEndTime\":null,\"runAsAccountId\":null,\"applianceNames\":[],\"errors\":[],\"applicationDiscovery\":{\"discoveryScopeStatus\":\"RunAsAccountNotAssociated\",\"errors\":[],\"hydratedRunAsAccountId\":null},\"dependencyMapDiscovery\":{\"discoveryScopeStatus\":\"RunAsAccountNotAssociated\",\"errors\":[],\"hydratedRunAsAccountId\":null},\"staticDiscovery\":{\"discoveryScopeStatus\":\"DiscoverySucceeded\",\"errors\":[],\"hydratedRunAsAccountId\":null},\"sqlDiscovery\":{\"successfullyDiscoveredServerCount\":-1,\"totalServerCount\":-1,\"sqlMetadataHydratedRunAsAccountId\":null,\"sqlMetadataDiscoveryPipe\":\"Unknown\",\"discoveryScopeStatus\":\"RunAsAccountNotAssociated\"},\"webAppDiscovery\":{\"totalWebServerCount\":0,\"totalWebApplicationCount\":0,\"discoveryScopeStatus\":\"RunAsAccountNotAssociated\"},\"oracleDiscovery\":{\"totalInstanceCount\":0,\"totalDatabaseCount\":0,\"shallowDiscoveryStatus\":\"Disabled\",\"discoveryScopeStatus\":\"DiscoverySucceeded\"},\"springBootDiscovery\":{\"totalInstanceCount\":0,\"totalApplicationCount\":0,\"shallowDiscoveryStatus\":\"Disabled\",\"discoveryScopeStatus\":\"DiscoverySucceeded\"},\"mySQLDiscovery\":{\"totalInstanceCount\":0,\"totalDatabaseCount\":0,\"shallowDiscoveryStatus\":\"Disabled\",\"discoveryScopeStatus\":\"DiscoverySucceeded\"},\"iisDiscovery\":{\"totalWebServerCount\":0,\"totalWebApplicationCount\":0,\"discoveryScopeStatus\":\"RunAsAccountNotAssociated\"},\"tomcatDiscovery\":{\"totalWebServerCount\":0,\"totalWebApplicationCount\":0,\"discoveryScopeStatus\":\"RunAsAccountNotAssociated\"},\"appsAndRoles\":null,\"productSupportStatus\":{\"currentVersion\":null,\"esuStatus\":\"Unknown\",\"supportStatus\":\"Unknown\",\"supportEndDate\":\"0001-01-01T00:00:00\",\"esuYear\":\"Unknown\"},\"eTag\":\"\\\"1c04c974-0000-1800-0000-650639670000\\\"\",\"numberOfProcessorCore\":1,\"allocatedMemoryInMB\":16384.0,\"operatingSystemDetails\":{\"osType\":\"otherguestfamily\",\"osName\":null,\"osVersion\":null,\"osArchitecture\":null},\"biosSerialNumber\":\"5037-6767-6873-1912-7398-8259-21\",\"biosGuid\":\"B978BF06-9676-49C3-A95A-FFC99A03DD31\",\"displayName\":\"testsamlee2\",\"isDeleted\":false,\"createdTimestamp\":\"2023-08-31T22:45:57.9440957Z\",\"tags\":{\"asrprotectedmachine\":\"false\"},\"updatedTimestamp\":\"2023-09-16T23:25:27.3675010Z\"},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/machines/a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b\",\"name\":\"a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b\",\"type\":\"Microsoft.OffAzure/HyperVSites/machines\",\"tags\":{\"asrprotectedmachine\":\"false\"}}", + "isContentBase64": false + } + }, + "New-AzMigrateHCIServerReplication+[NoContext]+ByIdPowerUser+$GET+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site?api-version=2020-01-01+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site?api-version=2020-01-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "13" ], + "x-ms-client-request-id": [ "2f8c1ba4-c789-4e14-ba1a-440aceefbd26" ], + "CommandName": [ "Az.Migrate.Internal\\Get-AzMigrateHyperVSite" ], + "FullCommandName": [ "Get-AzMigrateHyperVSite_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v9.6.0", "PSVersion/v7.3.6", "Az.Migrate/1.0.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "ETag": [ "\"2e01917f-0000-1800-0000-650639670000\"" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-request-id": [ "37476ad6-e126-469e-ade9-5b612aac973c" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11998" ], + "x-ms-correlation-request-id": [ "6d1ee8e6-6039-459d-81b7-9b1369e25364" ], + "x-ms-routing-request-id": [ "WESTCENTRALUS:20230916T232850Z:6d1ee8e6-6039-459d-81b7-9b1369e25364" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: D0D546FDC93D4FED839636E78A79B7CE Ref B: CO6AA3150219045 Ref C: 2023-09-16T23:28:48Z" ], + "Date": [ "Sat, 16 Sep 2023 23:28:49 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "2629" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site\",\"name\":\"samlee3src41244site\",\"type\":\"Microsoft.OffAzure/HyperVSites\",\"etag\":\"\\\"2e01917f-0000-1800-0000-650639670000\\\"\",\"location\":\"southeastasia\",\"kind\":\"Migrate\",\"properties\":{\"masterSiteId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/MasterSites/samlee3proj46422mastersite\",\"servicePrincipalIdentityDetails\":{\"tenantId\":\"c76bd4d1-bea3-45ea-be1b-4a745a675d07\",\"applicationId\":\"e2344540-afb8-4d15-843d-2e7c35b090ab\",\"objectId\":\"c8c56849-02b1-4b12-95af-c2e94b9aaf1e\",\"audience\":\"e2344540-afb8-4d15-843d-2e7c35b090ab\",\"aadAuthority\":\"https://login.microsoftonline.com/c76bd4d1-bea3-45ea-be1b-4a745a675d07\",\"rawCertData\":\"MIIDNDCCAhygAwIBAgIQdGNdN/CjS8ufM+qldDz6xzANBgkqhkiG9w0BAQsFADAXMRUwEwYDVQQDEwxBZ2VudFNwbkNlcnQwHhcNMjMwODA5MjIyMTE2WhcNMjQwODA5MjIzMTE2WjAXMRUwEwYDVQQDEwxBZ2VudFNwbkNlcnQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDuy6pxPqzVD9WVHGBw3+EQNSAbkvCMGDU+yNu6e1a1+OGonopJYJ+W5IF9pgCgGY/VK5Yokgv4gj+dDCaHEDXshLxh9cLoaxXwvP83UdoR2e7lA3cbGAXqxJQw2/9jfaoa+ipvnenejKiWEjWzZmxPglWGGaO+NnhQm6l99a+Az2SGT+7Z8BD+eiNLu/kvblhu2I2zlBDxtaq+HtRtcduO0PRpbrTV7WTUCIpRKnELs4+Kz1VleCK3idxUZgwQiKcc/BbjS0jtF2tKr7KiUUNqTDGm2RtYqx4RShYjt+baXs477XtjEjl0NTK85XOMFyyXyTn8P9rW42eDZzgorlY1AgMBAAGjfDB6MA4GA1UdDwEB/wQEAwIFoDAJBgNVHRMEAjAAMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjAfBgNVHSMEGDAWgBQvwkawBAIeLPXDn6aMqPWc4S2M3jAdBgNVHQ4EFgQUL8JGsAQCHiz1w5+mjKj1nOEtjN4wDQYJKoZIhvcNAQELBQADggEBAArSSHkrEHcJyz75KC1DNFdrpESEo5Wy3oV4gZe4cOtfQd8tu4iJUSgagy1NdoQ2puatD7CJQ0nvAUGzAu5MMbeotihBvtHLSJTxbxumRgshsblrZA+a38q9qwUSLlJP9dUtG/cN0G0jB6xLj9ZoeHXKviQodLlXqHPb7qhHHqMxKFKZViWU2tV863QYLVSDR7eZOD7qiFXPxm0RNQyrHctrvT4k3Ra1E22gxH171PSDfdab9GBGDitzw9lErLK2qfIwE7SoaSUm1YXu0A5z7eQJSDcojdfi4lzhOUtmJN/Gmln/JrZ4AGhAs9gghe5n/c6vp85UomtWAc6lXJkWZK4=\"},\"agentDetails\":{\"id\":\"38144592-82bd-4537-806a-2529e6f42f4d-agent\",\"version\":\"2.0.2199.56\",\"lastHeartBeatUtc\":\"2023-09-16T23:20:33.5941976Z\",\"keyVaultUri\":\"https://samlee3proj46422kv.vault.azure.net\",\"keyVaultId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.KeyVault/vaults/samlee3proj46422kv\"},\"applianceName\":\"samlee3src4\",\"discoverySolutionId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.Migrate/MigrateProjects/samlee3proj4/Solutions/Servers-Discovery-ServerDiscovery\",\"serviceEndpoint\":\"https://discoverysrv.sea.test.migration.windowsazure.com/\",\"provisioningState\":\"Succeeded\"}}", + "isContentBase64": false + } + }, + "New-AzMigrateHCIServerReplication+[NoContext]+ByIdPowerUser+$GET+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.Migrate/migrateProjects/samlee3proj4/solutions/Servers-Migration-ServerMigration_DataReplication?api-version=2018-09-01-preview+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.Migrate/migrateProjects/samlee3proj4/solutions/Servers-Migration-ServerMigration_DataReplication?api-version=2018-09-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "14" ], + "x-ms-client-request-id": [ "b771653b-0f28-47d6-89b0-8dbfd6a9f37e" ], + "CommandName": [ "Az.Migrate\\Get-AzMigrateSolution" ], + "FullCommandName": [ "Get-AzMigrateSolution_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v9.6.0", "PSVersion/v7.3.6", "Az.Migrate/1.0.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "d77a44bd-54ad-42d8-8f6d-9dbeb28e33d5" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-correlation-request-id": [ "5020f5ec-9c74-47de-97f6-068efab6f2e1" ], + "x-ms-routing-request-id": [ "WESTCENTRALUS:20230916T232851Z:5020f5ec-9c74-47de-97f6-068efab6f2e1" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 6C96CF3723ED46E084E64670692514D5 Ref B: CO6AA3150219045 Ref C: 2023-09-16T23:28:50Z" ], + "Date": [ "Sat, 16 Sep 2023 23:28:51 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1120" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.Migrate/MigrateProjects/samlee3proj4/Solutions/Servers-Migration-ServerMigration_DataReplication\",\"name\":\"Servers-Migration-ServerMigration_DataReplication\",\"type\":\"Microsoft.Migrate/MigrateProjects/Solutions\",\"etag\":\"\\\"3f005dae-0000-1800-0000-650638f80000\\\"\",\"properties\":{\"tool\":\"ServerMigration_DataReplication\",\"purpose\":\"Migration\",\"goal\":\"Servers\",\"status\":\"Inactive\",\"cleanupState\":\"None\",\"summary\":{\"instanceType\":\"Servers\",\"discoveredCount\":0,\"assessedCount\":0,\"replicatingCount\":0,\"testMigratedCount\":0,\"migratedCount\":0},\"details\":{\"groupCount\":0,\"assessmentCount\":0,\"extendedDetails\":{\"serversOnWindows\":\"0\",\"serversOnLinux\":\"0\",\"serversOnOther\":\"0\",\"dependencyEnabledMachines\":\"0\",\"machinesHavingSqlServers\":\"0\",\"machinesHavingWebServers\":\"0\",\"vaultId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault\",\"aszreplicatingCount\":\"20\",\"asztestMigratedCount\":\"0\",\"aszmigratedCount\":\"5\"}}}}", + "isContentBase64": false + } + }, + "New-AzMigrateHCIServerReplication+[NoContext]+ByIdPowerUser+$PUT+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b?api-version=2021-02-16-preview+4": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b?api-version=2021-02-16-preview", + "Content": "{\r\n \"properties\": {\r\n \"policyName\": \"samlee3proj46422replicationvaultHyperVToAzStackHCIpolicy\",\r\n \"replicationExtensionName\": \"samlee3src48adfreplicationfabric-samlee3te2acreplicationfabric-MigReplicationExtn\",\r\n \"customProperties\": {\r\n \"instanceType\": \"HyperVToAzStackHCI\",\r\n \"targetHciClusterId\": \"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/clusters/mayadahciclus3\",\r\n \"targetArcClusterCustomLocationId\": \"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.ExtendedLocation/customLocations/mayadahciclus3-CL\",\r\n \"fabricDiscoveryMachineId\": \"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/machines/a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b\",\r\n \"disksToInclude\": [\r\n {\r\n \"diskId\": \"Microsoft:A0247DB0-CECA-4CB1-AE6C-1D4AC98CA82B\\\\83F8638B-8DCA-4152-9EDA-2CA8B33039B4\\\\0\\\\0\\\\L\",\r\n \"isDynamic\": true,\r\n \"diskSizeGB\": 1,\r\n \"diskFileFormat\": \"VHDX\",\r\n \"isOsDisk\": true\r\n }\r\n ],\r\n \"nicsToInclude\": [\r\n {\r\n \"nicId\": \"Microsoft:A0247DB0-CECA-4CB1-AE6C-1D4AC98CA82B\\\\8A3C8701-4ACE-4F99-832E-294ACC0F51C3\",\r\n \"targetNetworkId\": \"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/virtualnetworks/external\",\r\n \"testNetworkId\": \"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/virtualnetworks/external\",\r\n \"selectionTypeForFailover\": \"SelectedByUser\"\r\n }\r\n ],\r\n \"targetVmName\": \"hciVm2\",\r\n \"targetResourceGroupId\": \"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg-tgt\",\r\n \"storageContainerId\": \"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/storageContainers/bbcontainer4\",\r\n \"hyperVGeneration\": \"1\",\r\n \"targetCpuCores\": 1,\r\n \"isDynamicRam\": false,\r\n \"dynamicMemoryConfig\": {\r\n \"maximumMemoryInMegaBytes\": 1048576,\r\n \"minimumMemoryInMegaBytes\": 1024,\r\n \"targetMemoryBufferPercentage\": 20\r\n },\r\n \"targetMemoryInMegaBytes\": 16384,\r\n \"runAsAccountId\": \"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/runasaccounts/851ad7af-b65d-53e6-8c3a-3a5058cbad77\",\r\n \"sourceDraName\": \"samlee3src48adfdra\",\r\n \"targetDraName\": \"samlee3te2acdra\",\r\n \"customLocationRegion\": \"eastus\"\r\n }\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "2765" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b/operations/635975d1-5444-43c8-838a-2a7d9b441b6c?api-version=2021-02-16-preview" ], + "Retry-After": [ "15" ], + "Azure-AsyncOperation": [ "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b/operations/635975d1-5444-43c8-838a-2a7d9b441b6c?api-version=2021-02-16-preview" ], + "x-ms-client-request-id": [ "8d58905e-2d08-4c31-a72c-62f9dcba5878" ], + "api-supported-versions": [ "2021-02-16-preview" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], + "x-ms-request-id": [ "169895b6-acb3-4760-a2ba-77813604a800" ], + "x-ms-correlation-request-id": [ "169895b6-acb3-4760-a2ba-77813604a800" ], + "x-ms-routing-request-id": [ "WESTCENTRALUS:20230916T232903Z:169895b6-acb3-4760-a2ba-77813604a800" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: F93A5687B8484F9C8966A83A1DE161CE Ref B: CO6AA3150219045 Ref C: 2023-09-16T23:29:00Z" ], + "Date": [ "Sat, 16 Sep 2023 23:29:02 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "3789" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"policyName\":\"samlee3proj46422replicationvaultHyperVToAzStackHCIpolicy\",\"replicationExtensionName\":\"samlee3src48adfreplicationfabric-samlee3te2acreplicationfabric-MigReplicationExtn\",\"correlationId\":null,\"provisioningState\":\"Creating\",\"protectionState\":\"UnprotectedStatesBegin\",\"protectionStateDescription\":null,\"testFailoverState\":\"None\",\"testFailoverStateDescription\":null,\"resynchronizationState\":\"None\",\"fabricObjectId\":null,\"fabricObjectName\":null,\"sourceFabricProviderId\":null,\"targetFabricProviderId\":null,\"fabricId\":null,\"targetFabricId\":null,\"draId\":null,\"targetDraId\":null,\"resyncRequired\":\"false\",\"allowedJobs\":null,\"replicationHealth\":\"Normal\",\"healthErrors\":null,\"customProperties\":{\"activeLocation\":\"Primary\",\"targetHciClusterId\":\"/Subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/clusters/mayadahciclus3\",\"targetArcClusterCustomLocationId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.ExtendedLocation/customLocations/mayadahciclus3-CL\",\"targetAzStackHciClusterName\":null,\"fabricDiscoveryMachineId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/machines/a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b\",\"disksToInclude\":[{\"diskId\":\"Microsoft:A0247DB0-CECA-4CB1-AE6C-1D4AC98CA82B\\\\83F8638B-8DCA-4152-9EDA-2CA8B33039B4\\\\0\\\\0\\\\L\",\"storageContainerId\":null,\"isDynamic\":true,\"diskSizeGB\":1,\"diskFileFormat\":\"VHDX\",\"isOsDisk\":true}],\"nicsToInclude\":[{\"nicId\":\"Microsoft:A0247DB0-CECA-4CB1-AE6C-1D4AC98CA82B\\\\8A3C8701-4ACE-4F99-832E-294ACC0F51C3\",\"networkName\":null,\"targetNetworkId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/virtualnetworks/external\",\"testNetworkId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/virtualnetworks/external\",\"selectionTypeForFailover\":\"SelectedByUser\"}],\"sourceVmName\":null,\"sourceCpuCores\":null,\"sourceMemoryInMegaBytes\":null,\"targetVmName\":\"hciVm2\",\"targetResourceGroupId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg-tgt\",\"storageContainerId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/storageContainers/bbcontainer4\",\"hyperVGeneration\":\"1\",\"targetNetworkId\":null,\"testNetworkId\":null,\"targetCpuCores\":1,\"isDynamicRam\":false,\"dynamicMemoryConfig\":{\"maximumMemoryInMegaBytes\":1048576,\"minimumMemoryInMegaBytes\":1024,\"targetMemoryBufferPercentage\":20},\"targetMemoryInMegaBytes\":16384,\"runAsAccountId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/runasaccounts/851ad7af-b65d-53e6-8c3a-3a5058cbad77\",\"sourceDraName\":\"samlee3src48adfdra\",\"targetDraName\":\"samlee3te2acdra\",\"sourceApplianceName\":null,\"targetApplianceName\":null,\"osType\":null,\"osName\":null,\"firmwareType\":null,\"targetLocation\":null,\"customLocationRegion\":\"eastus\",\"failoverRecoveryPointId\":null,\"lastRecoveryPointId\":null,\"initialReplicationProgressPercentage\":null,\"resyncProgressPercentage\":null,\"protectedDisks\":[],\"protectedNics\":[],\"targetVmBiosId\":null,\"lastReplicationUpdateTime\":null,\"instanceType\":\"HyperVToAzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b\",\"name\":\"a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b\",\"type\":\"Microsoft.DataReplication/replicationVaults/protectedItems\",\"systemData\":null,\"tags\":null}", + "isContentBase64": false + } + }, + "New-AzMigrateHCIServerReplication+[NoContext]+ByIdPowerUser+$GET+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/635975d1-5444-43c8-838a-2a7d9b441b6c?api-version=2021-02-16-preview+5": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/635975d1-5444-43c8-838a-2a7d9b441b6c?api-version=2021-02-16-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "22" ], + "x-ms-client-request-id": [ "6c077084-80a2-4f17-94d9-dab806e85482" ], + "CommandName": [ "Az.Migrate.Internal\\Get-AzMigrateWorkflow" ], + "FullCommandName": [ "Get-AzMigrateWorkflow_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v9.6.0", "PSVersion/v7.3.6", "Az.Migrate/1.0.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "api-supported-versions": [ "2021-02-16-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11998" ], + "x-ms-request-id": [ "08308a57-2625-4497-838e-d3b84198d4ec" ], + "x-ms-correlation-request-id": [ "08308a57-2625-4497-838e-d3b84198d4ec" ], + "x-ms-routing-request-id": [ "WESTCENTRALUS:20230916T232904Z:08308a57-2625-4497-838e-d3b84198d4ec" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: D55FB61F145F40BFA1F86F3E799C272C Ref B: CO6AA3150219045 Ref C: 2023-09-16T23:29:03Z" ], + "Date": [ "Sat, 16 Sep 2023 23:29:03 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "2068" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Started\",\"startTime\":\"2023-09-16T23:29:03.2222229Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b\",\"objectName\":\"a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b\",\"objectInternalId\":\"c01ab1ac-441f-5ac9-b48c-58bca6993ca4\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Cancel\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":[{\"taskName\":\"Creating or updating the protected item\",\"state\":\"Started\",\"startTime\":\"2023-09-16T23:29:03.756688Z\",\"customProperties\":{\"instanceType\":\"TaskDetails\"},\"childrenWorkflows\":[]},{\"taskName\":\"Initializing Protection\",\"state\":\"Pending\",\"customProperties\":{\"instanceType\":\"TaskDetails\"},\"childrenWorkflows\":[]},{\"taskName\":\"Enabling Protection\",\"state\":\"Pending\",\"customProperties\":{\"instanceType\":\"TaskDetails\"},\"childrenWorkflows\":[]},{\"taskName\":\"Starting Replication\",\"state\":\"Pending\",\"customProperties\":{\"instanceType\":\"TaskDetails\"},\"childrenWorkflows\":[]}],\"errors\":[],\"customProperties\":{\"instanceType\":\"WorkflowDetails\",\"affectedObjectDetails\":{\"PolicyName\":\"samlee3proj46422replicationvaultHyperVToAzStackHCIpolicy\",\"ReplicationExtensionName\":\"samlee3src48adfreplicationfabric-samlee3te2acreplicationfabric-MigReplicationExtn\",\"VaultId\":\"62ef9ab2-1017-434a-ac4e-2f2ec988323d\"}}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/635975d1-5444-43c8-838a-2a7d9b441b6c\",\"name\":\"635975d1-5444-43c8-838a-2a7d9b441b6c\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/test/New-AzMigrateHCIServerReplication.Tests.ps1 b/src/Migrate/Migrate.Autorest/test/New-AzMigrateHCIServerReplication.Tests.ps1 new file mode 100644 index 000000000000..3aee3076e94c --- /dev/null +++ b/src/Migrate/Migrate.Autorest/test/New-AzMigrateHCIServerReplication.Tests.ps1 @@ -0,0 +1,44 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzMigrateHCIServerReplication')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzMigrateHCIServerReplication.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-AzMigrateHCIServerReplication' -Tag 'LiveOnly' { + It 'ByIdDefaultUser' { + $output = New-AzMigrateHCIServerReplication ` + -MachineId $env.hciSDSMachineId1 ` + -TargetResourceGroupId $env.hciTargetRGId ` + -TargetVMName $env.hciTgtVMName1 ` + -TargetStoragePathId $env.hciTgtStoragePathId ` + -TargetVirtualSwitchId $env.hciTgtVirtualSwitchId ` + -OSDiskID $env.hciDiskId1 ` + -SubscriptionId $env.hciSubscriptionId ` + -IsDynamicMemoryEnabled "true" + $output.Count | Should -BeGreaterOrEqual 1 + } + + It 'ByIdPowerUser' { + $diskToInclude = New-AzMigrateHCIDiskMappingObject -DiskID $env.hciDiskId2 -IsOSDisk "true" -IsDynamic "true" -Size 1 -Format "VHDX" + $nicToInclude = New-AzMigrateHCINicMappingObject -NicID $env.hciNicId2 -TargetVirtualSwitchId $env.hciTgtVirtualSwitchId + $output = New-AzMigrateHCIServerReplication ` + -MachineId $env.hciSDSMachineId2 ` + -TargetResourceGroupId $env.hciTargetRGId ` + -TargetVMName $env.hciTgtVMName2 ` + -TargetStoragePathId $env.hciTgtStoragePathId ` + -DiskToInclude $diskToInclude ` + -NicToInclude $nicToInclude ` + -SubscriptionId $env.hciSubscriptionId + $output.Count | Should -BeGreaterOrEqual 1 + } +} diff --git a/src/Migrate/Migrate.Autorest/test/Remove-AzMigrateHCIServerReplication.Recording.json b/src/Migrate/Migrate.Autorest/test/Remove-AzMigrateHCIServerReplication.Recording.json new file mode 100644 index 000000000000..4979b55ea1ed --- /dev/null +++ b/src/Migrate/Migrate.Autorest/test/Remove-AzMigrateHCIServerReplication.Recording.json @@ -0,0 +1,223 @@ +{ + "Remove-AzMigrateHCIServerReplication+[NoContext]+ByID+$DELETE+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0560e6aa-9b2d-45e5-92cd-4ff618d09bec?forceDelete=True\u0026api-version=2021-02-16-preview+1": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0560e6aa-9b2d-45e5-92cd-4ff618d09bec?forceDelete=True\u0026api-version=2021-02-16-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "1" ], + "x-ms-client-request-id": [ "8150a5c7-bdde-471c-a95d-1d839c4a3fa7" ], + "CommandName": [ "Az.Migrate.Internal\\Remove-AzMigrateProtectedItem" ], + "FullCommandName": [ "Remove-AzMigrateProtectedItem_Delete" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.6", "Az.Migrate/1.0.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0560e6aa-9b2d-45e5-92cd-4ff618d09bec/operations/a94fe742-179f-4114-8d76-9f754c02dff1?forceDelete=True\u0026api-version=2021-02-16-preview" ], + "Retry-After": [ "15" ], + "Azure-AsyncOperation": [ "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0560e6aa-9b2d-45e5-92cd-4ff618d09bec/operations/a94fe742-179f-4114-8d76-9f754c02dff1?forceDelete=True\u0026api-version=2021-02-16-preview" ], + "x-ms-client-request-id": [ "8150a5c7-bdde-471c-a95d-1d839c4a3fa7" ], + "api-supported-versions": [ "2021-02-16-preview" ], + "x-ms-ratelimit-remaining-subscription-deletes": [ "14999" ], + "x-ms-request-id": [ "0fabd535-7ced-4e2a-aef3-b769942fa5f7" ], + "x-ms-correlation-request-id": [ "0fabd535-7ced-4e2a-aef3-b769942fa5f7" ], + "x-ms-routing-request-id": [ "WESTUS:20230917T022444Z:0fabd535-7ced-4e2a-aef3-b769942fa5f7" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 9CFC8FBBFE064E72865B3652C6C02BC6 Ref B: CO6AA3150217031 Ref C: 2023-09-17T02:24:43Z" ], + "Date": [ "Sun, 17 Sep 2023 02:24:43 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null, + "isContentBase64": false + } + }, + "Remove-AzMigrateHCIServerReplication+[NoContext]+ByID+$GET+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/a94fe742-179f-4114-8d76-9f754c02dff1?api-version=2021-02-16-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/a94fe742-179f-4114-8d76-9f754c02dff1?api-version=2021-02-16-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "2" ], + "x-ms-client-request-id": [ "3142ee30-c550-449d-b024-a6251cb8675f" ], + "CommandName": [ "Az.Migrate.Internal\\Get-AzMigrateWorkflow" ], + "FullCommandName": [ "Get-AzMigrateWorkflow_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.6", "Az.Migrate/1.0.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "api-supported-versions": [ "2021-02-16-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-request-id": [ "cfb844e9-f44a-482a-8eea-ef2619040133" ], + "x-ms-correlation-request-id": [ "cfb844e9-f44a-482a-8eea-ef2619040133" ], + "x-ms-routing-request-id": [ "WESTUS:20230917T022445Z:cfb844e9-f44a-482a-8eea-ef2619040133" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: B982CFECDE524BC9A84935F436CF430F Ref B: CO6AA3150217031 Ref C: 2023-09-17T02:24:44Z" ], + "Date": [ "Sun, 17 Sep 2023 02:24:45 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1742" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"displayName\":\"Delete protected item\",\"state\":\"Started\",\"startTime\":\"2023-09-17T02:24:44.1537086Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0560e6aa-9b2d-45e5-92cd-4ff618d09bec\",\"objectName\":\"0560e6aa-9b2d-45e5-92cd-4ff618d09bec\",\"objectInternalId\":\"6e6e15ee-3d3b-5f95-9460-157e67b6aa32\",\"objectInternalName\":\"testsamlee1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Cancel\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":[{\"taskName\":\"Prerequisite check\",\"state\":\"Pending\",\"customProperties\":{\"instanceType\":\"TaskDetails\"},\"childrenWorkflows\":[]},{\"taskName\":\"Deleting protected item\",\"state\":\"Pending\",\"customProperties\":{\"instanceType\":\"TaskDetails\"},\"childrenWorkflows\":[]}],\"errors\":[],\"customProperties\":{\"instanceType\":\"WorkflowDetails\",\"affectedObjectDetails\":{\"PolicyName\":\"samlee3proj46422replicationvaultHyperVToAzStackHCIpolicy\",\"ReplicationExtensionName\":\"samlee3src48adfreplicationfabric-samlee3te2acreplicationfabric-MigReplicationExtn\",\"VaultId\":\"62ef9ab2-1017-434a-ac4e-2f2ec988323d\"}}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/a94fe742-179f-4114-8d76-9f754c02dff1\",\"name\":\"a94fe742-179f-4114-8d76-9f754c02dff1\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null}", + "isContentBase64": false + } + }, + "Remove-AzMigrateHCIServerReplication+[NoContext]+ByInputObject+$GET+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b?api-version=2021-02-16-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b?api-version=2021-02-16-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "3" ], + "x-ms-client-request-id": [ "148c8704-e1d4-4f7d-af34-e75b962a05ba" ], + "CommandName": [ "Az.Migrate.Internal\\Get-AzMigrateProtectedItem" ], + "FullCommandName": [ "Get-AzMigrateProtectedItem_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.6", "Az.Migrate/1.0.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "api-supported-versions": [ "2021-02-16-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-request-id": [ "c5d82437-40de-444d-a9c3-b90252ba2dad" ], + "x-ms-correlation-request-id": [ "c5d82437-40de-444d-a9c3-b90252ba2dad" ], + "x-ms-routing-request-id": [ "WESTUS:20230917T022447Z:c5d82437-40de-444d-a9c3-b90252ba2dad" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: CCA182C23DA84D86ACDDAA3FC9812CB8 Ref B: CO6AA3150217031 Ref C: 2023-09-17T02:24:45Z" ], + "Date": [ "Sun, 17 Sep 2023 02:24:46 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "5478" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"policyName\":\"samlee3proj46422replicationvaultHyperVToAzStackHCIpolicy\",\"replicationExtensionName\":\"samlee3src48adfreplicationfabric-samlee3te2acreplicationfabric-MigReplicationExtn\",\"correlationId\":\"426627dd-11ef-4798-a21d-dedff19c0e9d\",\"provisioningState\":\"Succeeded\",\"protectionState\":\"PlannedFailoverInitiated\",\"protectionStateDescription\":\"Planned failover was initiated\",\"testFailoverState\":\"None\",\"testFailoverStateDescription\":\"None\",\"resynchronizationState\":\"None\",\"fabricObjectId\":\"c01ab1ac-441f-5ac9-b48c-58bca6993ca4\",\"fabricObjectName\":\"testsamlee2\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"fabricId\":\"c1cd158e-1855-4b4d-be3b-8dc601132914\",\"targetFabricId\":\"0566da75-1cd8-44c3-a515-882ff8da67cf\",\"draId\":\"d961e8a1-901b-4715-9266-8eef2dbe9673\",\"targetDraId\":\"4f127877-8fc2-4d92-b473-ff87c88d7ad9\",\"resyncRequired\":\"false\",\"currentJob\":{\"scenarioName\":\"PlannedFailover\",\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/e093335d-318c-40a6-9036-b0f4f1c8f435\",\"name\":\"e093335d-318c-40a6-9036-b0f4f1c8f435\",\"displayName\":\"Planned failover\",\"state\":\"Started\",\"startTime\":\"2023-09-17T02:23:22.2009446Z\"},\"allowedJobs\":[],\"replicationHealth\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"activeLocation\":\"Primary\",\"targetHciClusterId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/clusters/mayadahciclus3\",\"targetArcClusterCustomLocationId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.ExtendedLocation/customLocations/mayadahciclus3-CL\",\"targetAzStackHciClusterName\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.ExtendedLocation/customLocations/mayadahciclus3-CL\",\"fabricDiscoveryMachineId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/machines/a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b\",\"disksToInclude\":null,\"nicsToInclude\":null,\"sourceVmName\":\"testsamlee2\",\"sourceCpuCores\":1,\"sourceMemoryInMegaBytes\":16384.0,\"targetVmName\":\"testsamlee2\",\"targetResourceGroupId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg-tgt\",\"storageContainerId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourcegroups/mayadahciclus3-rg/providers/microsoft.azurestackhci/storagecontainers/bbcontainer4\",\"hyperVGeneration\":\"1\",\"targetNetworkId\":null,\"testNetworkId\":null,\"targetCpuCores\":1,\"isDynamicRam\":true,\"dynamicMemoryConfig\":{\"maximumMemoryInMegaBytes\":1048576,\"minimumMemoryInMegaBytes\":1024,\"targetMemoryBufferPercentage\":20},\"targetMemoryInMegaBytes\":16384,\"runAsAccountId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/runasaccounts/851ad7af-b65d-53e6-8c3a-3a5058cbad77\",\"sourceDraName\":\"samlee3src48adfdra\",\"targetDraName\":\"samlee3te2acdra\",\"sourceApplianceName\":\"samlee3src4\",\"targetApplianceName\":\"samlee3t\",\"osType\":\"otherguestfamily\",\"osName\":null,\"firmwareType\":\"BIOS\",\"targetLocation\":\"Southeast Asia\",\"customLocationRegion\":\"eastus\",\"failoverRecoveryPointId\":null,\"lastRecoveryPointId\":null,\"initialReplicationProgressPercentage\":null,\"resyncProgressPercentage\":null,\"protectedDisks\":[{\"storageContainerId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourcegroups/mayadahciclus3-rg/providers/microsoft.azurestackhci/storagecontainers/bbcontainer4\",\"storageContainerLocalPath\":\"c:\\\\clusterstorage\\\\volume03\\\\migratedvms\\\\d206abfad9d93a1\",\"sourceDiskId\":\"Microsoft:A0247DB0-CECA-4CB1-AE6C-1D4AC98CA82B\\\\83F8638B-8DCA-4152-9EDA-2CA8B33039B4\\\\0\\\\0\\\\L\",\"sourceDiskName\":\"14393.0.amd64fre.rs1_release.160715-1616_server_serverdatacentereval_en-us_6FD2D815-C59D-487E-8EEC-8FC2A1CBED52\",\"seedDiskName\":\"testsamlee2-OSdisk-14393-0-amd6-d9a3-seed\",\"testMigrateDiskName\":\"testsamlee2-OSdisk-14393-0-amd6-d9a3-test\",\"migrateDiskName\":\"testsamlee2-OSdisk-14393-0-amd6-d9a3\",\"isOsDisk\":true,\"capacityInBytes\":42949672960,\"isDynamic\":true,\"diskType\":\"VHDX\"}],\"protectedNics\":[{\"nicId\":\"Microsoft:A0247DB0-CECA-4CB1-AE6C-1D4AC98CA82B\\\\8A3C8701-4ACE-4F99-832E-294ACC0F51C3\",\"macAddress\":\"00:15:5d:e6:4f:f2\",\"networkName\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourcegroups/mayadahciclus3-rg/providers/microsoft.azurestackhci/virtualnetworks/external\",\"targetNetworkId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourcegroups/mayadahciclus3-rg/providers/microsoft.azurestackhci/virtualnetworks/external\",\"testNetworkId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourcegroups/mayadahciclus3-rg/providers/microsoft.azurestackhci/virtualnetworks/external\",\"selectionTypeForFailover\":\"SelectedByUser\"}],\"targetVmBiosId\":null,\"lastReplicationUpdateTime\":\"2023-09-17T02:23:44.188808Z\",\"instanceType\":\"HyperVToAzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b\",\"name\":\"a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b\",\"type\":\"Microsoft.DataReplication/replicationVaults/protectedItems\",\"systemData\":null,\"tags\":null}", + "isContentBase64": false + } + }, + "Remove-AzMigrateHCIServerReplication+[NoContext]+ByInputObject+$DELETE+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b?forceDelete=True\u0026api-version=2021-02-16-preview+2": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b?forceDelete=True\u0026api-version=2021-02-16-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "4" ], + "x-ms-client-request-id": [ "f33b2076-85b7-471a-831b-c14ed66117bf" ], + "CommandName": [ "Az.Migrate.Internal\\Remove-AzMigrateProtectedItem" ], + "FullCommandName": [ "Remove-AzMigrateProtectedItem_Delete" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.6", "Az.Migrate/1.0.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b/operations/829cfc71-e2c5-43aa-825b-6c7629cd243c?forceDelete=True\u0026api-version=2021-02-16-preview" ], + "Retry-After": [ "15" ], + "Azure-AsyncOperation": [ "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b/operations/829cfc71-e2c5-43aa-825b-6c7629cd243c?forceDelete=True\u0026api-version=2021-02-16-preview" ], + "x-ms-client-request-id": [ "f33b2076-85b7-471a-831b-c14ed66117bf" ], + "api-supported-versions": [ "2021-02-16-preview" ], + "x-ms-ratelimit-remaining-subscription-deletes": [ "14999" ], + "x-ms-request-id": [ "44f6e7d7-8292-4a4d-8c4a-0de880ced3d0" ], + "x-ms-correlation-request-id": [ "44f6e7d7-8292-4a4d-8c4a-0de880ced3d0" ], + "x-ms-routing-request-id": [ "WESTUS:20230917T022448Z:44f6e7d7-8292-4a4d-8c4a-0de880ced3d0" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 4BEC5C44663C42848B1E5BBAB7F805A4 Ref B: CO6AA3150217031 Ref C: 2023-09-17T02:24:47Z" ], + "Date": [ "Sun, 17 Sep 2023 02:24:48 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null, + "isContentBase64": false + } + }, + "Remove-AzMigrateHCIServerReplication+[NoContext]+ByInputObject+$GET+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/829cfc71-e2c5-43aa-825b-6c7629cd243c?api-version=2021-02-16-preview+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/829cfc71-e2c5-43aa-825b-6c7629cd243c?api-version=2021-02-16-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "5" ], + "x-ms-client-request-id": [ "176c109e-8b7c-41a7-96fb-68fbea6cb479" ], + "CommandName": [ "Az.Migrate.Internal\\Get-AzMigrateWorkflow" ], + "FullCommandName": [ "Get-AzMigrateWorkflow_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.6", "Az.Migrate/1.0.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "api-supported-versions": [ "2021-02-16-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-request-id": [ "f0160539-a598-430e-957e-51a2274db16e" ], + "x-ms-correlation-request-id": [ "f0160539-a598-430e-957e-51a2274db16e" ], + "x-ms-routing-request-id": [ "WESTUS:20230917T022449Z:f0160539-a598-430e-957e-51a2274db16e" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: DCA9D04F7E6B4FCDA5F14A897747D4F7 Ref B: CO6AA3150217031 Ref C: 2023-09-17T02:24:48Z" ], + "Date": [ "Sun, 17 Sep 2023 02:24:49 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1741" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"displayName\":\"Delete protected item\",\"state\":\"Started\",\"startTime\":\"2023-09-17T02:24:48.303861Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b\",\"objectName\":\"a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b\",\"objectInternalId\":\"c01ab1ac-441f-5ac9-b48c-58bca6993ca4\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Cancel\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":[{\"taskName\":\"Prerequisite check\",\"state\":\"Pending\",\"customProperties\":{\"instanceType\":\"TaskDetails\"},\"childrenWorkflows\":[]},{\"taskName\":\"Deleting protected item\",\"state\":\"Pending\",\"customProperties\":{\"instanceType\":\"TaskDetails\"},\"childrenWorkflows\":[]}],\"errors\":[],\"customProperties\":{\"instanceType\":\"WorkflowDetails\",\"affectedObjectDetails\":{\"PolicyName\":\"samlee3proj46422replicationvaultHyperVToAzStackHCIpolicy\",\"ReplicationExtensionName\":\"samlee3src48adfreplicationfabric-samlee3te2acreplicationfabric-MigReplicationExtn\",\"VaultId\":\"62ef9ab2-1017-434a-ac4e-2f2ec988323d\"}}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/829cfc71-e2c5-43aa-825b-6c7629cd243c\",\"name\":\"829cfc71-e2c5-43aa-825b-6c7629cd243c\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/test/Remove-AzMigrateHCIServerReplication.Tests.ps1 b/src/Migrate/Migrate.Autorest/test/Remove-AzMigrateHCIServerReplication.Tests.ps1 new file mode 100644 index 000000000000..72560edfb2da --- /dev/null +++ b/src/Migrate/Migrate.Autorest/test/Remove-AzMigrateHCIServerReplication.Tests.ps1 @@ -0,0 +1,27 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Remove-AzMigrateHCIServerReplication')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzMigrateHCIServerReplication.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-AzMigrateHCIServerReplication' -Tag 'LiveOnly' { + It 'ByID' { + { Remove-AzMigrateHCIServerReplication -TargetObjectID $env.hciProtectedItem1 -SubscriptionId $env.hciSubscriptionId -ForceRemove "true" } | Should -Not -Throw + } + + It 'ByInputObject' { + $obj = Get-AzMigrateHCIServerReplication -TargetObjectID $env.hciProtectedItem2 -SubscriptionId $env.hciSubscriptionId + $obj.Count | Should -BeGreaterOrEqual 1 + { Remove-AzMigrateHCIServerReplication -InputObject $obj -SubscriptionId $env.hciSubscriptionId -ForceRemove "true" } | Should -Not -Throw + } +} diff --git a/src/Migrate/Migrate.Autorest/test/Set-AzMigrateHCIServerReplication.Recording.json b/src/Migrate/Migrate.Autorest/test/Set-AzMigrateHCIServerReplication.Recording.json new file mode 100644 index 000000000000..ca3177eea206 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/test/Set-AzMigrateHCIServerReplication.Recording.json @@ -0,0 +1,172 @@ +{ + "Set-AzMigrateHCIServerReplication+[NoContext]+ByID+$GET+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0560e6aa-9b2d-45e5-92cd-4ff618d09bec?api-version=2021-02-16-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0560e6aa-9b2d-45e5-92cd-4ff618d09bec?api-version=2021-02-16-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "1" ], + "x-ms-client-request-id": [ "b656c233-227a-4d4d-bca4-011a373b45a2" ], + "CommandName": [ "Az.Migrate.Internal\\Get-AzMigrateProtectedItem" ], + "FullCommandName": [ "Get-AzMigrateProtectedItem_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.6", "Az.Migrate/1.0.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "api-supported-versions": [ "2021-02-16-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-request-id": [ "b38dbc49-f2cb-4074-88b5-8ec96872e20f" ], + "x-ms-correlation-request-id": [ "b38dbc49-f2cb-4074-88b5-8ec96872e20f" ], + "x-ms-routing-request-id": [ "WESTUS:20230917T022202Z:b38dbc49-f2cb-4074-88b5-8ec96872e20f" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 8113498EDD904567AE94F3A132AB9C6B Ref B: CO6AA3150217021 Ref C: 2023-09-17T02:22:00Z" ], + "Date": [ "Sun, 17 Sep 2023 02:22:01 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "5077" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"policyName\":\"samlee3proj46422replicationvaultHyperVToAzStackHCIpolicy\",\"replicationExtensionName\":\"samlee3src48adfreplicationfabric-samlee3te2acreplicationfabric-MigReplicationExtn\",\"correlationId\":\"43ca8c63-51a3-488f-a115-fe0ff0b948e9\",\"provisioningState\":\"Succeeded\",\"protectionState\":\"Protected\",\"protectionStateDescription\":\"Protected\",\"testFailoverState\":\"None\",\"testFailoverStateDescription\":\"None\",\"resynchronizationState\":\"None\",\"fabricObjectId\":\"6e6e15ee-3d3b-5f95-9460-157e67b6aa32\",\"fabricObjectName\":\"testsamlee1\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"fabricId\":\"c1cd158e-1855-4b4d-be3b-8dc601132914\",\"targetFabricId\":\"0566da75-1cd8-44c3-a515-882ff8da67cf\",\"draId\":\"d961e8a1-901b-4715-9266-8eef2dbe9673\",\"targetDraId\":\"4f127877-8fc2-4d92-b473-ff87c88d7ad9\",\"resyncRequired\":\"false\",\"allowedJobs\":[\"PlannedFailover\",\"DisableProtection\"],\"replicationHealth\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"activeLocation\":\"Primary\",\"targetHciClusterId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/clusters/mayadahciclus3\",\"targetArcClusterCustomLocationId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.ExtendedLocation/customLocations/mayadahciclus3-CL\",\"targetAzStackHciClusterName\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.ExtendedLocation/customLocations/mayadahciclus3-CL\",\"fabricDiscoveryMachineId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/machines/0560e6aa-9b2d-45e5-92cd-4ff618d09bec\",\"disksToInclude\":null,\"nicsToInclude\":null,\"sourceVmName\":\"testsamlee1\",\"sourceCpuCores\":1,\"sourceMemoryInMegaBytes\":16384.0,\"targetVmName\":\"testsamlee1\",\"targetResourceGroupId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg-tgt\",\"storageContainerId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourcegroups/mayadahciclus3-rg/providers/microsoft.azurestackhci/storagecontainers/bbcontainer4\",\"hyperVGeneration\":\"1\",\"targetNetworkId\":null,\"testNetworkId\":null,\"targetCpuCores\":1,\"isDynamicRam\":true,\"dynamicMemoryConfig\":{\"maximumMemoryInMegaBytes\":1048576,\"minimumMemoryInMegaBytes\":1024,\"targetMemoryBufferPercentage\":20},\"targetMemoryInMegaBytes\":16384,\"runAsAccountId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/runasaccounts/851ad7af-b65d-53e6-8c3a-3a5058cbad77\",\"sourceDraName\":\"samlee3src48adfdra\",\"targetDraName\":\"samlee3te2acdra\",\"sourceApplianceName\":\"samlee3src4\",\"targetApplianceName\":\"samlee3t\",\"osType\":\"otherguestfamily\",\"osName\":null,\"firmwareType\":\"BIOS\",\"targetLocation\":\"Southeast Asia\",\"customLocationRegion\":\"eastus\",\"failoverRecoveryPointId\":null,\"lastRecoveryPointId\":null,\"initialReplicationProgressPercentage\":null,\"resyncProgressPercentage\":null,\"protectedDisks\":[{\"storageContainerId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourcegroups/mayadahciclus3-rg/providers/microsoft.azurestackhci/storagecontainers/bbcontainer4\",\"storageContainerLocalPath\":\"c:\\\\clusterstorage\\\\volume03\\\\migratedvms\\\\d206abfad9d93a1\",\"sourceDiskId\":\"Microsoft:0560E6AA-9B2D-45E5-92CD-4FF618D09BEC\\\\83F8638B-8DCA-4152-9EDA-2CA8B33039B4\\\\0\\\\0\\\\L\",\"sourceDiskName\":\"14393.0.amd64fre.rs1_release.160715-1616_server_serverdatacentereval_en-us_D48185B5-671F-4EE3-B134-743F20BE89A0\",\"seedDiskName\":\"testsamlee1-OSdisk-14393-0-amd6-0d5c-seed\",\"testMigrateDiskName\":\"testsamlee1-OSdisk-14393-0-amd6-0d5c-test\",\"migrateDiskName\":\"testsamlee1-OSdisk-14393-0-amd6-0d5c\",\"isOsDisk\":true,\"capacityInBytes\":42949672960,\"isDynamic\":true,\"diskType\":\"VHDX\"}],\"protectedNics\":[{\"nicId\":\"Microsoft:0560E6AA-9B2D-45E5-92CD-4FF618D09BEC\\\\617EFC72-6B3C-47F4-9198-A58C24E787B6\",\"macAddress\":\"00:15:5d:e6:4f:f1\",\"networkName\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourcegroups/mayadahciclus3-rg/providers/microsoft.azurestackhci/virtualnetworks/external\",\"targetNetworkId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourcegroups/mayadahciclus3-rg/providers/microsoft.azurestackhci/virtualnetworks/external\",\"testNetworkId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourcegroups/mayadahciclus3-rg/providers/microsoft.azurestackhci/virtualnetworks/external\",\"selectionTypeForFailover\":\"SelectedByUser\"}],\"targetVmBiosId\":null,\"lastReplicationUpdateTime\":\"2023-09-17T02:20:09.2890417Z\",\"instanceType\":\"HyperVToAzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0560e6aa-9b2d-45e5-92cd-4ff618d09bec\",\"name\":\"0560e6aa-9b2d-45e5-92cd-4ff618d09bec\",\"type\":\"Microsoft.DataReplication/replicationVaults/protectedItems\",\"systemData\":null,\"tags\":null}", + "isContentBase64": false + } + }, + "Set-AzMigrateHCIServerReplication+[NoContext]+ByID+$GET+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/machines/0560e6aa-9b2d-45e5-92cd-4ff618d09bec?api-version=2020-01-01+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/machines/0560e6aa-9b2d-45e5-92cd-4ff618d09bec?api-version=2020-01-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "2" ], + "x-ms-client-request-id": [ "7ac012fa-1b26-4459-975d-2406ecd172db" ], + "CommandName": [ "Az.Migrate.Internal\\Get-AzMigrateHyperVMachine" ], + "FullCommandName": [ "Get-AzMigrateHyperVMachine_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.6", "Az.Migrate/1.0.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-request-id": [ "b54c005d-9865-4c06-93f1-b454c779d9cb" ], + "X-Content-Type-Options": [ "nosniff" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11998" ], + "x-ms-correlation-request-id": [ "6b21ef95-94f7-4653-b90c-43f8c2cf1923" ], + "x-ms-routing-request-id": [ "WESTUS:20230917T022204Z:6b21ef95-94f7-4653-b90c-43f8c2cf1923" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: F7D3D24442CA4264BD6326CB51BE49A5 Ref B: CO6AA3150217021 Ref C: 2023-09-17T02:22:02Z" ], + "Date": [ "Sun, 17 Sep 2023 02:22:03 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "4502" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"instanceUuid\":\"0560e6aa-9b2d-45e5-92cd-4ff618d09bec\",\"hostFqdn\":\"RRN44-13-33.CFDEV.NTTEST.MICROSOFT.COM\",\"hostId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/hosts/rrn44-13-33-cfdev-nttest-micros-8c18e4d9-da77-4eb3-aecd-61afae77325f\",\"generation\":1,\"version\":\"5.0\",\"highAvailability\":\"No\",\"clusterFqdn\":null,\"clusterId\":null,\"maxMemoryMB\":1048576,\"isDynamicMemoryEnabled\":false,\"disks\":[{\"instanceId\":\"Microsoft:0560E6AA-9B2D-45E5-92CD-4FF618D09BEC\\\\83F8638B-8DCA-4152-9EDA-2CA8B33039B4\\\\0\\\\0\\\\L\",\"vhdId\":\"c1565760-1011-4ee0-8deb-cffe6edb662b\",\"maxSizeInBytes\":42949672960,\"name\":\"14393.0.amd64fre.rs1_release.160715-1616_server_serverdatacentereval_en-us_3B45A1BD-C68A-42F2-916F-54C3B87DC0D5\",\"diskType\":\"Differencing\",\"lun\":0,\"path\":\"F:\\\\samlee3vms\\\\testsamlee1vm\\\\14393.0.amd64fre.rs1_release.160715-1616_server_serverdatacentereval_en-us_3B45A1BD-C68A-42F2-916F-54C3B87DC0D5.avhd\"}],\"networkAdapters\":[{\"networkId\":\"\",\"subnetName\":\"\",\"staticIpAdress\":null,\"nicType\":\"NicType\",\"nicId\":\"Microsoft:0560E6AA-9B2D-45E5-92CD-4FF618D09BEC\\\\617EFC72-6B3C-47F4-9198-A58C24E787B6\",\"macAddress\":\"00:15:5d:e6:4f:f1\",\"ipAddressList\":[],\"networkName\":null,\"ipAddressType\":\"Dynamic\"}],\"managementServerType\":\"Host\",\"secureBootTemplateId\":\"\",\"secureBootEnabled\":false,\"secureBootTemplate\":\"\",\"tpmEnabled\":false,\"ksdEnabled\":false,\"shieldingRequested\":false,\"dataProtectionRequested\":false,\"encryptStateAndVmMigrationTraffic\":false,\"virtualizationBasedSecurityOptOut\":false,\"powerStatus\":\"PowerOff\",\"vmFqdn\":\"\",\"vmConfigurationFileLocation\":\"F:\\\\samlee3vms\\\\testsamlee1vm\\\\testsamlee1\\\\Virtual Machines\\\\0560E6AA-9B2D-45E5-92CD-4FF618D09BEC.xml\",\"firmware\":\"BIOS\",\"guestOSDetails\":{\"osType\":null,\"osName\":null,\"osVersion\":null,\"osArchitecture\":null},\"numberOfApplications\":-1,\"guestDetailsDiscoveryTimestamp\":null,\"isFileServerSupported\":null,\"isGuestDetailsDiscoveryInProgress\":true,\"dependencyMapping\":\"Disabled\",\"dependencyMappingStartTime\":null,\"dependencyMappingEndTime\":null,\"runAsAccountId\":null,\"applianceNames\":[],\"errors\":[],\"applicationDiscovery\":{\"discoveryScopeStatus\":\"RunAsAccountNotAssociated\",\"errors\":[],\"hydratedRunAsAccountId\":null},\"dependencyMapDiscovery\":{\"discoveryScopeStatus\":\"RunAsAccountNotAssociated\",\"errors\":[],\"hydratedRunAsAccountId\":null},\"staticDiscovery\":{\"discoveryScopeStatus\":\"DiscoverySucceeded\",\"errors\":[],\"hydratedRunAsAccountId\":null},\"sqlDiscovery\":{\"successfullyDiscoveredServerCount\":-1,\"totalServerCount\":-1,\"sqlMetadataHydratedRunAsAccountId\":null,\"sqlMetadataDiscoveryPipe\":\"Unknown\",\"discoveryScopeStatus\":\"RunAsAccountNotAssociated\"},\"webAppDiscovery\":{\"totalWebServerCount\":0,\"totalWebApplicationCount\":0,\"discoveryScopeStatus\":\"RunAsAccountNotAssociated\"},\"oracleDiscovery\":{\"totalInstanceCount\":0,\"totalDatabaseCount\":0,\"shallowDiscoveryStatus\":\"Disabled\",\"discoveryScopeStatus\":\"DiscoverySucceeded\"},\"springBootDiscovery\":{\"totalInstanceCount\":0,\"totalApplicationCount\":0,\"shallowDiscoveryStatus\":\"Disabled\",\"discoveryScopeStatus\":\"DiscoverySucceeded\"},\"mySQLDiscovery\":{\"totalInstanceCount\":0,\"totalDatabaseCount\":0,\"shallowDiscoveryStatus\":\"Disabled\",\"discoveryScopeStatus\":\"DiscoverySucceeded\"},\"iisDiscovery\":{\"totalWebServerCount\":0,\"totalWebApplicationCount\":0,\"discoveryScopeStatus\":\"RunAsAccountNotAssociated\"},\"tomcatDiscovery\":{\"totalWebServerCount\":0,\"totalWebApplicationCount\":0,\"discoveryScopeStatus\":\"RunAsAccountNotAssociated\"},\"appsAndRoles\":null,\"productSupportStatus\":{\"currentVersion\":null,\"esuStatus\":\"Unknown\",\"supportStatus\":\"Unknown\",\"supportEndDate\":\"0001-01-01T00:00:00\",\"esuYear\":\"Unknown\"},\"eTag\":\"\\\"2304542c-0000-1800-0000-650661500000\\\"\",\"numberOfProcessorCore\":1,\"allocatedMemoryInMB\":16384.0,\"operatingSystemDetails\":{\"osType\":\"otherguestfamily\",\"osName\":null,\"osVersion\":null,\"osArchitecture\":null},\"biosSerialNumber\":\"6736-3103-4448-5783-4045-8105-00\",\"biosGuid\":\"52CE3FBC-60FD-400B-8D9F-D0839790B885\",\"displayName\":\"testsamlee1\",\"isDeleted\":false,\"createdTimestamp\":\"2023-08-31T22:45:58.1940880Z\",\"tags\":{\"asrprotectedmachine\":\"true\"},\"updatedTimestamp\":\"2023-09-17T02:15:44.7145747Z\"},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/machines/0560e6aa-9b2d-45e5-92cd-4ff618d09bec\",\"name\":\"0560e6aa-9b2d-45e5-92cd-4ff618d09bec\",\"type\":\"Microsoft.OffAzure/HyperVSites/machines\",\"tags\":{\"asrprotectedmachine\":\"true\"}}", + "isContentBase64": false + } + }, + "Set-AzMigrateHCIServerReplication+[NoContext]+ByID+$PUT+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0560e6aa-9b2d-45e5-92cd-4ff618d09bec?api-version=2021-02-16-preview+3": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0560e6aa-9b2d-45e5-92cd-4ff618d09bec?api-version=2021-02-16-preview", + "Content": "{\r\n \"properties\": {\r\n \"policyName\": \"samlee3proj46422replicationvaultHyperVToAzStackHCIpolicy\",\r\n \"replicationExtensionName\": \"samlee3src48adfreplicationfabric-samlee3te2acreplicationfabric-MigReplicationExtn\",\r\n \"customProperties\": {\r\n \"instanceType\": \"HyperVToAzStackHCI\",\r\n \"targetHciClusterId\": \"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/clusters/mayadahciclus3\",\r\n \"targetArcClusterCustomLocationId\": \"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.ExtendedLocation/customLocations/mayadahciclus3-CL\",\r\n \"fabricDiscoveryMachineId\": \"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/machines/0560e6aa-9b2d-45e5-92cd-4ff618d09bec\",\r\n \"disksToInclude\": [\r\n {\r\n \"diskId\": \"Microsoft:0560E6AA-9B2D-45E5-92CD-4FF618D09BEC\\\\83F8638B-8DCA-4152-9EDA-2CA8B33039B4\\\\0\\\\0\\\\L\",\r\n \"isDynamic\": true,\r\n \"diskSizeGB\": 40,\r\n \"diskFileFormat\": \"VHDX\",\r\n \"isOsDisk\": true\r\n }\r\n ],\r\n \"nicsToInclude\": [\r\n {\r\n \"nicId\": \"Microsoft:0560E6AA-9B2D-45E5-92CD-4FF618D09BEC\\\\617EFC72-6B3C-47F4-9198-A58C24E787B6\",\r\n \"targetNetworkId\": \"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourcegroups/mayadahciclus3-rg/providers/microsoft.azurestackhci/virtualnetworks/external\",\r\n \"testNetworkId\": \"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourcegroups/mayadahciclus3-rg/providers/microsoft.azurestackhci/virtualnetworks/external\",\r\n \"selectionTypeForFailover\": \"SelectedByUser\"\r\n }\r\n ],\r\n \"targetVmName\": \"testsamlee1\",\r\n \"targetResourceGroupId\": \"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg-tgt\",\r\n \"storageContainerId\": \"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourcegroups/mayadahciclus3-rg/providers/microsoft.azurestackhci/storagecontainers/bbcontainer4\",\r\n \"hyperVGeneration\": \"1\",\r\n \"targetCpuCores\": 1,\r\n \"isDynamicRam\": false,\r\n \"dynamicMemoryConfig\": {\r\n \"maximumMemoryInMegaBytes\": 1048576,\r\n \"minimumMemoryInMegaBytes\": 1024,\r\n \"targetMemoryBufferPercentage\": 20\r\n },\r\n \"targetMemoryInMegaBytes\": 16384,\r\n \"runAsAccountId\": \"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/runasaccounts/851ad7af-b65d-53e6-8c3a-3a5058cbad77\",\r\n \"sourceDraName\": \"samlee3src48adfdra\",\r\n \"targetDraName\": \"samlee3te2acdra\",\r\n \"customLocationRegion\": \"eastus\"\r\n }\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "2771" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0560e6aa-9b2d-45e5-92cd-4ff618d09bec/operations/0cae7e2b-1f15-4931-9246-f5538278ad56?api-version=2021-02-16-preview" ], + "Retry-After": [ "15" ], + "Azure-AsyncOperation": [ "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0560e6aa-9b2d-45e5-92cd-4ff618d09bec/operations/0cae7e2b-1f15-4931-9246-f5538278ad56?api-version=2021-02-16-preview" ], + "x-ms-client-request-id": [ "e6ef49ba-9074-40b8-a34d-592664589785" ], + "api-supported-versions": [ "2021-02-16-preview" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], + "x-ms-request-id": [ "3e2d7317-ef83-41ff-aeed-4067863135a1" ], + "x-ms-correlation-request-id": [ "3e2d7317-ef83-41ff-aeed-4067863135a1" ], + "x-ms-routing-request-id": [ "WESTUS:20230917T022206Z:3e2d7317-ef83-41ff-aeed-4067863135a1" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 33B67B9301C448FEB41D8D14C55DDE79 Ref B: CO6AA3150217021 Ref C: 2023-09-17T02:22:04Z" ], + "Date": [ "Sun, 17 Sep 2023 02:22:06 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "3795" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"policyName\":\"samlee3proj46422replicationvaultHyperVToAzStackHCIpolicy\",\"replicationExtensionName\":\"samlee3src48adfreplicationfabric-samlee3te2acreplicationfabric-MigReplicationExtn\",\"correlationId\":null,\"provisioningState\":\"Creating\",\"protectionState\":\"UnprotectedStatesBegin\",\"protectionStateDescription\":null,\"testFailoverState\":\"None\",\"testFailoverStateDescription\":null,\"resynchronizationState\":\"None\",\"fabricObjectId\":null,\"fabricObjectName\":null,\"sourceFabricProviderId\":null,\"targetFabricProviderId\":null,\"fabricId\":null,\"targetFabricId\":null,\"draId\":null,\"targetDraId\":null,\"resyncRequired\":\"false\",\"allowedJobs\":null,\"replicationHealth\":\"Normal\",\"healthErrors\":null,\"customProperties\":{\"activeLocation\":\"Primary\",\"targetHciClusterId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/clusters/mayadahciclus3\",\"targetArcClusterCustomLocationId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.ExtendedLocation/customLocations/mayadahciclus3-CL\",\"targetAzStackHciClusterName\":null,\"fabricDiscoveryMachineId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/machines/0560e6aa-9b2d-45e5-92cd-4ff618d09bec\",\"disksToInclude\":[{\"diskId\":\"Microsoft:0560E6AA-9B2D-45E5-92CD-4FF618D09BEC\\\\83F8638B-8DCA-4152-9EDA-2CA8B33039B4\\\\0\\\\0\\\\L\",\"storageContainerId\":null,\"isDynamic\":true,\"diskSizeGB\":40,\"diskFileFormat\":\"VHDX\",\"isOsDisk\":true}],\"nicsToInclude\":[{\"nicId\":\"Microsoft:0560E6AA-9B2D-45E5-92CD-4FF618D09BEC\\\\617EFC72-6B3C-47F4-9198-A58C24E787B6\",\"networkName\":null,\"targetNetworkId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourcegroups/mayadahciclus3-rg/providers/microsoft.azurestackhci/virtualnetworks/external\",\"testNetworkId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourcegroups/mayadahciclus3-rg/providers/microsoft.azurestackhci/virtualnetworks/external\",\"selectionTypeForFailover\":\"SelectedByUser\"}],\"sourceVmName\":null,\"sourceCpuCores\":null,\"sourceMemoryInMegaBytes\":null,\"targetVmName\":\"testsamlee1\",\"targetResourceGroupId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg-tgt\",\"storageContainerId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourcegroups/mayadahciclus3-rg/providers/microsoft.azurestackhci/storagecontainers/bbcontainer4\",\"hyperVGeneration\":\"1\",\"targetNetworkId\":null,\"testNetworkId\":null,\"targetCpuCores\":1,\"isDynamicRam\":false,\"dynamicMemoryConfig\":{\"maximumMemoryInMegaBytes\":1048576,\"minimumMemoryInMegaBytes\":1024,\"targetMemoryBufferPercentage\":20},\"targetMemoryInMegaBytes\":16384,\"runAsAccountId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/runasaccounts/851ad7af-b65d-53e6-8c3a-3a5058cbad77\",\"sourceDraName\":\"samlee3src48adfdra\",\"targetDraName\":\"samlee3te2acdra\",\"sourceApplianceName\":null,\"targetApplianceName\":null,\"osType\":null,\"osName\":null,\"firmwareType\":null,\"targetLocation\":null,\"customLocationRegion\":\"eastus\",\"failoverRecoveryPointId\":null,\"lastRecoveryPointId\":null,\"initialReplicationProgressPercentage\":null,\"resyncProgressPercentage\":null,\"protectedDisks\":[],\"protectedNics\":[],\"targetVmBiosId\":null,\"lastReplicationUpdateTime\":null,\"instanceType\":\"HyperVToAzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0560e6aa-9b2d-45e5-92cd-4ff618d09bec\",\"name\":\"0560e6aa-9b2d-45e5-92cd-4ff618d09bec\",\"type\":\"Microsoft.DataReplication/replicationVaults/protectedItems\",\"systemData\":null,\"tags\":null}", + "isContentBase64": false + } + }, + "Set-AzMigrateHCIServerReplication+[NoContext]+ByID+$GET+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/0cae7e2b-1f15-4931-9246-f5538278ad56?api-version=2021-02-16-preview+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/0cae7e2b-1f15-4931-9246-f5538278ad56?api-version=2021-02-16-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "4" ], + "x-ms-client-request-id": [ "d72adbe9-27e7-44cc-b028-fb2aef34abc3" ], + "CommandName": [ "Az.Migrate.Internal\\Get-AzMigrateWorkflow" ], + "FullCommandName": [ "Get-AzMigrateWorkflow_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.6", "Az.Migrate/1.0.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "api-supported-versions": [ "2021-02-16-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-request-id": [ "81a2699b-4930-4526-aa75-f25846b7570f" ], + "x-ms-correlation-request-id": [ "81a2699b-4930-4526-aa75-f25846b7570f" ], + "x-ms-routing-request-id": [ "WESTUS:20230917T022208Z:81a2699b-4930-4526-aa75-f25846b7570f" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 57F211E8B01B422384A1CB0FD3AA2296 Ref B: CO6AA3150217021 Ref C: 2023-09-17T02:22:06Z" ], + "Date": [ "Sun, 17 Sep 2023 02:22:07 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "2069" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"displayName\":\"Create or update protected item\",\"state\":\"Started\",\"startTime\":\"2023-09-17T02:22:06.4061156Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0560e6aa-9b2d-45e5-92cd-4ff618d09bec\",\"objectName\":\"0560e6aa-9b2d-45e5-92cd-4ff618d09bec\",\"objectInternalId\":\"6e6e15ee-3d3b-5f95-9460-157e67b6aa32\",\"objectInternalName\":\"testsamlee1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Cancel\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":[{\"taskName\":\"Creating or updating the protected item\",\"state\":\"Started\",\"startTime\":\"2023-09-17T02:22:07.4358529Z\",\"customProperties\":{\"instanceType\":\"TaskDetails\"},\"childrenWorkflows\":[]},{\"taskName\":\"Initializing Protection\",\"state\":\"Pending\",\"customProperties\":{\"instanceType\":\"TaskDetails\"},\"childrenWorkflows\":[]},{\"taskName\":\"Enabling Protection\",\"state\":\"Pending\",\"customProperties\":{\"instanceType\":\"TaskDetails\"},\"childrenWorkflows\":[]},{\"taskName\":\"Starting Replication\",\"state\":\"Pending\",\"customProperties\":{\"instanceType\":\"TaskDetails\"},\"childrenWorkflows\":[]}],\"errors\":[],\"customProperties\":{\"instanceType\":\"WorkflowDetails\",\"affectedObjectDetails\":{\"PolicyName\":\"samlee3proj46422replicationvaultHyperVToAzStackHCIpolicy\",\"ReplicationExtensionName\":\"samlee3src48adfreplicationfabric-samlee3te2acreplicationfabric-MigReplicationExtn\",\"VaultId\":\"62ef9ab2-1017-434a-ac4e-2f2ec988323d\"}}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/0cae7e2b-1f15-4931-9246-f5538278ad56\",\"name\":\"0cae7e2b-1f15-4931-9246-f5538278ad56\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null}", + "isContentBase64": false + } + } +} diff --git a/src/Migrate/Migrate.Autorest/test/Set-AzMigrateHCIServerReplication.Tests.ps1 b/src/Migrate/Migrate.Autorest/test/Set-AzMigrateHCIServerReplication.Tests.ps1 new file mode 100644 index 000000000000..374302e07b1f --- /dev/null +++ b/src/Migrate/Migrate.Autorest/test/Set-AzMigrateHCIServerReplication.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Set-AzMigrateHCIServerReplication')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Set-AzMigrateHCIServerReplication.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 'Set-AzMigrateHCIServerReplication' -Tag 'LiveOnly' { + It 'ByID' { + $output = Set-AzMigrateHCIServerReplication ` + -TargetObjectID $env.hciProtectedItem1 ` + -SubscriptionId $env.hciSubscriptionId ` + -IsDynamicMemoryEnabled "false" + $output.Count | Should -BeGreaterOrEqual 1 + } +} diff --git a/src/Migrate/Migrate.Autorest/test/Start-AzMigrateHCIServerMigration.Recording.json b/src/Migrate/Migrate.Autorest/test/Start-AzMigrateHCIServerMigration.Recording.json new file mode 100644 index 000000000000..1546eb958fa3 --- /dev/null +++ b/src/Migrate/Migrate.Autorest/test/Start-AzMigrateHCIServerMigration.Recording.json @@ -0,0 +1,299 @@ +{ + "Start-AzMigrateHCIServerMigration+[NoContext]+ByID+$GET+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0560e6aa-9b2d-45e5-92cd-4ff618d09bec?api-version=2021-02-16-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0560e6aa-9b2d-45e5-92cd-4ff618d09bec?api-version=2021-02-16-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "1" ], + "x-ms-client-request-id": [ "6e2bbead-23f0-428a-90e3-007caaf105ae" ], + "CommandName": [ "Az.Migrate.Internal\\Get-AzMigrateProtectedItem" ], + "FullCommandName": [ "Get-AzMigrateProtectedItem_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.6", "Az.Migrate/1.0.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "api-supported-versions": [ "2021-02-16-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-request-id": [ "70c230f2-a1b9-4804-b4a2-84396bb027a4" ], + "x-ms-correlation-request-id": [ "70c230f2-a1b9-4804-b4a2-84396bb027a4" ], + "x-ms-routing-request-id": [ "WESTUS:20230917T022314Z:70c230f2-a1b9-4804-b4a2-84396bb027a4" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 25D16C4AA2AC4976BE7DAA1DC22660CA Ref B: CO6AA3150218011 Ref C: 2023-09-17T02:23:13Z" ], + "Date": [ "Sun, 17 Sep 2023 02:23:14 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "5078" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"policyName\":\"samlee3proj46422replicationvaultHyperVToAzStackHCIpolicy\",\"replicationExtensionName\":\"samlee3src48adfreplicationfabric-samlee3te2acreplicationfabric-MigReplicationExtn\",\"correlationId\":\"43ca8c63-51a3-488f-a115-fe0ff0b948e9\",\"provisioningState\":\"Succeeded\",\"protectionState\":\"Protected\",\"protectionStateDescription\":\"Protected\",\"testFailoverState\":\"None\",\"testFailoverStateDescription\":\"None\",\"resynchronizationState\":\"None\",\"fabricObjectId\":\"6e6e15ee-3d3b-5f95-9460-157e67b6aa32\",\"fabricObjectName\":\"testsamlee1\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"fabricId\":\"c1cd158e-1855-4b4d-be3b-8dc601132914\",\"targetFabricId\":\"0566da75-1cd8-44c3-a515-882ff8da67cf\",\"draId\":\"d961e8a1-901b-4715-9266-8eef2dbe9673\",\"targetDraId\":\"4f127877-8fc2-4d92-b473-ff87c88d7ad9\",\"resyncRequired\":\"false\",\"allowedJobs\":[\"PlannedFailover\",\"DisableProtection\"],\"replicationHealth\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"activeLocation\":\"Primary\",\"targetHciClusterId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/clusters/mayadahciclus3\",\"targetArcClusterCustomLocationId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.ExtendedLocation/customLocations/mayadahciclus3-CL\",\"targetAzStackHciClusterName\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.ExtendedLocation/customLocations/mayadahciclus3-CL\",\"fabricDiscoveryMachineId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/machines/0560e6aa-9b2d-45e5-92cd-4ff618d09bec\",\"disksToInclude\":null,\"nicsToInclude\":null,\"sourceVmName\":\"testsamlee1\",\"sourceCpuCores\":1,\"sourceMemoryInMegaBytes\":16384.0,\"targetVmName\":\"testsamlee1\",\"targetResourceGroupId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg-tgt\",\"storageContainerId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourcegroups/mayadahciclus3-rg/providers/microsoft.azurestackhci/storagecontainers/bbcontainer4\",\"hyperVGeneration\":\"1\",\"targetNetworkId\":null,\"testNetworkId\":null,\"targetCpuCores\":1,\"isDynamicRam\":false,\"dynamicMemoryConfig\":{\"maximumMemoryInMegaBytes\":1048576,\"minimumMemoryInMegaBytes\":1024,\"targetMemoryBufferPercentage\":20},\"targetMemoryInMegaBytes\":16384,\"runAsAccountId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/runasaccounts/851ad7af-b65d-53e6-8c3a-3a5058cbad77\",\"sourceDraName\":\"samlee3src48adfdra\",\"targetDraName\":\"samlee3te2acdra\",\"sourceApplianceName\":\"samlee3src4\",\"targetApplianceName\":\"samlee3t\",\"osType\":\"otherguestfamily\",\"osName\":null,\"firmwareType\":\"BIOS\",\"targetLocation\":\"Southeast Asia\",\"customLocationRegion\":\"eastus\",\"failoverRecoveryPointId\":null,\"lastRecoveryPointId\":null,\"initialReplicationProgressPercentage\":null,\"resyncProgressPercentage\":null,\"protectedDisks\":[{\"storageContainerId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourcegroups/mayadahciclus3-rg/providers/microsoft.azurestackhci/storagecontainers/bbcontainer4\",\"storageContainerLocalPath\":\"c:\\\\clusterstorage\\\\volume03\\\\migratedvms\\\\d206abfad9d93a1\",\"sourceDiskId\":\"Microsoft:0560E6AA-9B2D-45E5-92CD-4FF618D09BEC\\\\83F8638B-8DCA-4152-9EDA-2CA8B33039B4\\\\0\\\\0\\\\L\",\"sourceDiskName\":\"14393.0.amd64fre.rs1_release.160715-1616_server_serverdatacentereval_en-us_D48185B5-671F-4EE3-B134-743F20BE89A0\",\"seedDiskName\":\"testsamlee1-OSdisk-14393-0-amd6-0d5c-seed\",\"testMigrateDiskName\":\"testsamlee1-OSdisk-14393-0-amd6-0d5c-test\",\"migrateDiskName\":\"testsamlee1-OSdisk-14393-0-amd6-0d5c\",\"isOsDisk\":true,\"capacityInBytes\":42949672960,\"isDynamic\":true,\"diskType\":\"VHDX\"}],\"protectedNics\":[{\"nicId\":\"Microsoft:0560E6AA-9B2D-45E5-92CD-4FF618D09BEC\\\\617EFC72-6B3C-47F4-9198-A58C24E787B6\",\"macAddress\":\"00:15:5d:e6:4f:f1\",\"networkName\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourcegroups/mayadahciclus3-rg/providers/microsoft.azurestackhci/virtualnetworks/external\",\"targetNetworkId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourcegroups/mayadahciclus3-rg/providers/microsoft.azurestackhci/virtualnetworks/external\",\"testNetworkId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourcegroups/mayadahciclus3-rg/providers/microsoft.azurestackhci/virtualnetworks/external\",\"selectionTypeForFailover\":\"SelectedByUser\"}],\"targetVmBiosId\":null,\"lastReplicationUpdateTime\":\"2023-09-17T02:20:09.2890417Z\",\"instanceType\":\"HyperVToAzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0560e6aa-9b2d-45e5-92cd-4ff618d09bec\",\"name\":\"0560e6aa-9b2d-45e5-92cd-4ff618d09bec\",\"type\":\"Microsoft.DataReplication/replicationVaults/protectedItems\",\"systemData\":null,\"tags\":null}", + "isContentBase64": false + } + }, + "Start-AzMigrateHCIServerMigration+[NoContext]+ByID+$POST+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0560e6aa-9b2d-45e5-92cd-4ff618d09bec/plannedFailover?api-version=2021-02-16-preview+2": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0560e6aa-9b2d-45e5-92cd-4ff618d09bec/plannedFailover?api-version=2021-02-16-preview", + "Content": "{\r\n \"properties\": {\r\n \"customProperties\": {\r\n \"instanceType\": \"HyperVToAzStackHCI\",\r\n \"shutdownSourceVM\": false\r\n }\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "140" ] + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0560e6aa-9b2d-45e5-92cd-4ff618d09bec/operations/d9b7a186-dda8-4f9c-ab6c-38d0cafbe23f?api-version=2021-02-16-preview" ], + "Retry-After": [ "15" ], + "Azure-AsyncOperation": [ "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0560e6aa-9b2d-45e5-92cd-4ff618d09bec/operations/d9b7a186-dda8-4f9c-ab6c-38d0cafbe23f?api-version=2021-02-16-preview" ], + "x-ms-client-request-id": [ "1e795d9a-17ce-45b9-a666-2c64775624b4" ], + "api-supported-versions": [ "2021-02-16-preview" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], + "x-ms-request-id": [ "b03b6126-51ef-4ff9-b2c4-357e3d436ec3" ], + "x-ms-correlation-request-id": [ "b03b6126-51ef-4ff9-b2c4-357e3d436ec3" ], + "x-ms-routing-request-id": [ "WESTUS:20230917T022316Z:b03b6126-51ef-4ff9-b2c4-357e3d436ec3" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: FFEE94ED169F4DAC91432604EA259782 Ref B: CO6AA3150218011 Ref C: 2023-09-17T02:23:15Z" ], + "Date": [ "Sun, 17 Sep 2023 02:23:16 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null, + "isContentBase64": false + } + }, + "Start-AzMigrateHCIServerMigration+[NoContext]+ByID+$GET+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/d9b7a186-dda8-4f9c-ab6c-38d0cafbe23f?api-version=2021-02-16-preview+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/d9b7a186-dda8-4f9c-ab6c-38d0cafbe23f?api-version=2021-02-16-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "3" ], + "x-ms-client-request-id": [ "bdd740ca-f140-46c6-b6cc-03abd46354b0" ], + "CommandName": [ "Az.Migrate.Internal\\Get-AzMigrateWorkflow" ], + "FullCommandName": [ "Get-AzMigrateWorkflow_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.6", "Az.Migrate/1.0.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "api-supported-versions": [ "2021-02-16-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11998" ], + "x-ms-request-id": [ "5a020daa-b9bd-488e-8bc4-eca742b5d101" ], + "x-ms-correlation-request-id": [ "5a020daa-b9bd-488e-8bc4-eca742b5d101" ], + "x-ms-routing-request-id": [ "WESTUS:20230917T022317Z:5a020daa-b9bd-488e-8bc4-eca742b5d101" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: FD2829AA7A134DB7A28AB80FC61377EA Ref B: CO6AA3150218011 Ref C: 2023-09-17T02:23:16Z" ], + "Date": [ "Sun, 17 Sep 2023 02:23:17 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "2234" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"displayName\":\"Planned failover\",\"state\":\"Started\",\"startTime\":\"2023-09-17T02:23:16.1904478Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0560e6aa-9b2d-45e5-92cd-4ff618d09bec/plannedFailover\",\"objectName\":\"0560e6aa-9b2d-45e5-92cd-4ff618d09bec\",\"objectInternalId\":\"6e6e15ee-3d3b-5f95-9460-157e67b6aa32\",\"objectInternalName\":\"testsamlee1\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Cancel\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":[{\"taskName\":\"Prerequisite check\",\"state\":\"Started\",\"startTime\":\"2023-09-17T02:23:17.075561Z\",\"customProperties\":{\"instanceType\":\"TaskDetails\"},\"childrenWorkflows\":[]},{\"taskName\":\"Turning off resource on primary\",\"state\":\"Pending\",\"customProperties\":{\"instanceType\":\"TaskDetails\"},\"childrenWorkflows\":[]},{\"taskName\":\"Starting failover\",\"state\":\"Pending\",\"customProperties\":{\"instanceType\":\"TaskDetails\"},\"childrenWorkflows\":[]},{\"taskName\":\"Preparing protected entities\",\"state\":\"Pending\",\"customProperties\":{\"instanceType\":\"TaskDetails\"},\"childrenWorkflows\":[]},{\"taskName\":\"Turning on resource on recovery\",\"state\":\"Pending\",\"customProperties\":{\"instanceType\":\"TaskDetails\"},\"childrenWorkflows\":[]}],\"errors\":[],\"customProperties\":{\"protectedItemDetails\":[],\"instanceType\":\"FailoverWorkflowDetails\",\"affectedObjectDetails\":{\"PolicyName\":\"samlee3proj46422replicationvaultHyperVToAzStackHCIpolicy\",\"ReplicationExtensionName\":\"samlee3src48adfreplicationfabric-samlee3te2acreplicationfabric-MigReplicationExtn\",\"VaultId\":\"62ef9ab2-1017-434a-ac4e-2f2ec988323d\"}}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/d9b7a186-dda8-4f9c-ab6c-38d0cafbe23f\",\"name\":\"d9b7a186-dda8-4f9c-ab6c-38d0cafbe23f\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null}", + "isContentBase64": false + } + }, + "Start-AzMigrateHCIServerMigration+[NoContext]+ByInputObject+$GET+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b?api-version=2021-02-16-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b?api-version=2021-02-16-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "4" ], + "x-ms-client-request-id": [ "be03be3a-0143-413f-a47a-b50986dfbc09" ], + "CommandName": [ "Az.Migrate.Internal\\Get-AzMigrateProtectedItem" ], + "FullCommandName": [ "Get-AzMigrateProtectedItem_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.6", "Az.Migrate/1.0.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "api-supported-versions": [ "2021-02-16-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-request-id": [ "af7ba2a1-e3fd-4537-b17b-933c7dcad2d6" ], + "x-ms-correlation-request-id": [ "af7ba2a1-e3fd-4537-b17b-933c7dcad2d6" ], + "x-ms-routing-request-id": [ "WESTUS:20230917T022319Z:af7ba2a1-e3fd-4537-b17b-933c7dcad2d6" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: DDA7EF2F9A1047469FA21778CC1E5F9A Ref B: CO6AA3150218011 Ref C: 2023-09-17T02:23:18Z" ], + "Date": [ "Sun, 17 Sep 2023 02:23:19 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "5077" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"policyName\":\"samlee3proj46422replicationvaultHyperVToAzStackHCIpolicy\",\"replicationExtensionName\":\"samlee3src48adfreplicationfabric-samlee3te2acreplicationfabric-MigReplicationExtn\",\"correlationId\":\"426627dd-11ef-4798-a21d-dedff19c0e9d\",\"provisioningState\":\"Succeeded\",\"protectionState\":\"Protected\",\"protectionStateDescription\":\"Protected\",\"testFailoverState\":\"None\",\"testFailoverStateDescription\":\"None\",\"resynchronizationState\":\"None\",\"fabricObjectId\":\"c01ab1ac-441f-5ac9-b48c-58bca6993ca4\",\"fabricObjectName\":\"testsamlee2\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"fabricId\":\"c1cd158e-1855-4b4d-be3b-8dc601132914\",\"targetFabricId\":\"0566da75-1cd8-44c3-a515-882ff8da67cf\",\"draId\":\"d961e8a1-901b-4715-9266-8eef2dbe9673\",\"targetDraId\":\"4f127877-8fc2-4d92-b473-ff87c88d7ad9\",\"resyncRequired\":\"false\",\"allowedJobs\":[\"PlannedFailover\",\"DisableProtection\"],\"replicationHealth\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"activeLocation\":\"Primary\",\"targetHciClusterId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/clusters/mayadahciclus3\",\"targetArcClusterCustomLocationId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.ExtendedLocation/customLocations/mayadahciclus3-CL\",\"targetAzStackHciClusterName\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.ExtendedLocation/customLocations/mayadahciclus3-CL\",\"fabricDiscoveryMachineId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/machines/a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b\",\"disksToInclude\":null,\"nicsToInclude\":null,\"sourceVmName\":\"testsamlee2\",\"sourceCpuCores\":1,\"sourceMemoryInMegaBytes\":16384.0,\"targetVmName\":\"testsamlee2\",\"targetResourceGroupId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg-tgt\",\"storageContainerId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourcegroups/mayadahciclus3-rg/providers/microsoft.azurestackhci/storagecontainers/bbcontainer4\",\"hyperVGeneration\":\"1\",\"targetNetworkId\":null,\"testNetworkId\":null,\"targetCpuCores\":1,\"isDynamicRam\":true,\"dynamicMemoryConfig\":{\"maximumMemoryInMegaBytes\":1048576,\"minimumMemoryInMegaBytes\":1024,\"targetMemoryBufferPercentage\":20},\"targetMemoryInMegaBytes\":16384,\"runAsAccountId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/runasaccounts/851ad7af-b65d-53e6-8c3a-3a5058cbad77\",\"sourceDraName\":\"samlee3src48adfdra\",\"targetDraName\":\"samlee3te2acdra\",\"sourceApplianceName\":\"samlee3src4\",\"targetApplianceName\":\"samlee3t\",\"osType\":\"otherguestfamily\",\"osName\":null,\"firmwareType\":\"BIOS\",\"targetLocation\":\"Southeast Asia\",\"customLocationRegion\":\"eastus\",\"failoverRecoveryPointId\":null,\"lastRecoveryPointId\":null,\"initialReplicationProgressPercentage\":null,\"resyncProgressPercentage\":null,\"protectedDisks\":[{\"storageContainerId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourcegroups/mayadahciclus3-rg/providers/microsoft.azurestackhci/storagecontainers/bbcontainer4\",\"storageContainerLocalPath\":\"c:\\\\clusterstorage\\\\volume03\\\\migratedvms\\\\d206abfad9d93a1\",\"sourceDiskId\":\"Microsoft:A0247DB0-CECA-4CB1-AE6C-1D4AC98CA82B\\\\83F8638B-8DCA-4152-9EDA-2CA8B33039B4\\\\0\\\\0\\\\L\",\"sourceDiskName\":\"14393.0.amd64fre.rs1_release.160715-1616_server_serverdatacentereval_en-us_6FD2D815-C59D-487E-8EEC-8FC2A1CBED52\",\"seedDiskName\":\"testsamlee2-OSdisk-14393-0-amd6-d9a3-seed\",\"testMigrateDiskName\":\"testsamlee2-OSdisk-14393-0-amd6-d9a3-test\",\"migrateDiskName\":\"testsamlee2-OSdisk-14393-0-amd6-d9a3\",\"isOsDisk\":true,\"capacityInBytes\":42949672960,\"isDynamic\":true,\"diskType\":\"VHDX\"}],\"protectedNics\":[{\"nicId\":\"Microsoft:A0247DB0-CECA-4CB1-AE6C-1D4AC98CA82B\\\\8A3C8701-4ACE-4F99-832E-294ACC0F51C3\",\"macAddress\":\"00:15:5d:e6:4f:f2\",\"networkName\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourcegroups/mayadahciclus3-rg/providers/microsoft.azurestackhci/virtualnetworks/external\",\"targetNetworkId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourcegroups/mayadahciclus3-rg/providers/microsoft.azurestackhci/virtualnetworks/external\",\"testNetworkId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourcegroups/mayadahciclus3-rg/providers/microsoft.azurestackhci/virtualnetworks/external\",\"selectionTypeForFailover\":\"SelectedByUser\"}],\"targetVmBiosId\":null,\"lastReplicationUpdateTime\":\"2023-09-17T02:18:44.0418343Z\",\"instanceType\":\"HyperVToAzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b\",\"name\":\"a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b\",\"type\":\"Microsoft.DataReplication/replicationVaults/protectedItems\",\"systemData\":null,\"tags\":null}", + "isContentBase64": false + } + }, + "Start-AzMigrateHCIServerMigration+[NoContext]+ByInputObject+$GET+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b?api-version=2021-02-16-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b?api-version=2021-02-16-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "5" ], + "x-ms-client-request-id": [ "f5cac3ed-59b2-4ac9-946c-2d30bc8d4db2" ], + "CommandName": [ "Az.Migrate.Internal\\Get-AzMigrateProtectedItem" ], + "FullCommandName": [ "Get-AzMigrateProtectedItem_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.6", "Az.Migrate/1.0.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "api-supported-versions": [ "2021-02-16-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-request-id": [ "d83bb603-ba8c-4856-bd35-5dbbf3419e8e" ], + "x-ms-correlation-request-id": [ "d83bb603-ba8c-4856-bd35-5dbbf3419e8e" ], + "x-ms-routing-request-id": [ "WESTUS:20230917T022320Z:d83bb603-ba8c-4856-bd35-5dbbf3419e8e" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 7C4ED48698924BE0AA5B642126D2FFDB Ref B: CO6AA3150218011 Ref C: 2023-09-17T02:23:19Z" ], + "Date": [ "Sun, 17 Sep 2023 02:23:20 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "5077" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"policyName\":\"samlee3proj46422replicationvaultHyperVToAzStackHCIpolicy\",\"replicationExtensionName\":\"samlee3src48adfreplicationfabric-samlee3te2acreplicationfabric-MigReplicationExtn\",\"correlationId\":\"426627dd-11ef-4798-a21d-dedff19c0e9d\",\"provisioningState\":\"Succeeded\",\"protectionState\":\"Protected\",\"protectionStateDescription\":\"Protected\",\"testFailoverState\":\"None\",\"testFailoverStateDescription\":\"None\",\"resynchronizationState\":\"None\",\"fabricObjectId\":\"c01ab1ac-441f-5ac9-b48c-58bca6993ca4\",\"fabricObjectName\":\"testsamlee2\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"fabricId\":\"c1cd158e-1855-4b4d-be3b-8dc601132914\",\"targetFabricId\":\"0566da75-1cd8-44c3-a515-882ff8da67cf\",\"draId\":\"d961e8a1-901b-4715-9266-8eef2dbe9673\",\"targetDraId\":\"4f127877-8fc2-4d92-b473-ff87c88d7ad9\",\"resyncRequired\":\"false\",\"allowedJobs\":[\"PlannedFailover\",\"DisableProtection\"],\"replicationHealth\":\"Normal\",\"healthErrors\":[],\"customProperties\":{\"activeLocation\":\"Primary\",\"targetHciClusterId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/clusters/mayadahciclus3\",\"targetArcClusterCustomLocationId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.ExtendedLocation/customLocations/mayadahciclus3-CL\",\"targetAzStackHciClusterName\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.ExtendedLocation/customLocations/mayadahciclus3-CL\",\"fabricDiscoveryMachineId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/machines/a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b\",\"disksToInclude\":null,\"nicsToInclude\":null,\"sourceVmName\":\"testsamlee2\",\"sourceCpuCores\":1,\"sourceMemoryInMegaBytes\":16384.0,\"targetVmName\":\"testsamlee2\",\"targetResourceGroupId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg-tgt\",\"storageContainerId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourcegroups/mayadahciclus3-rg/providers/microsoft.azurestackhci/storagecontainers/bbcontainer4\",\"hyperVGeneration\":\"1\",\"targetNetworkId\":null,\"testNetworkId\":null,\"targetCpuCores\":1,\"isDynamicRam\":true,\"dynamicMemoryConfig\":{\"maximumMemoryInMegaBytes\":1048576,\"minimumMemoryInMegaBytes\":1024,\"targetMemoryBufferPercentage\":20},\"targetMemoryInMegaBytes\":16384,\"runAsAccountId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/runasaccounts/851ad7af-b65d-53e6-8c3a-3a5058cbad77\",\"sourceDraName\":\"samlee3src48adfdra\",\"targetDraName\":\"samlee3te2acdra\",\"sourceApplianceName\":\"samlee3src4\",\"targetApplianceName\":\"samlee3t\",\"osType\":\"otherguestfamily\",\"osName\":null,\"firmwareType\":\"BIOS\",\"targetLocation\":\"Southeast Asia\",\"customLocationRegion\":\"eastus\",\"failoverRecoveryPointId\":null,\"lastRecoveryPointId\":null,\"initialReplicationProgressPercentage\":null,\"resyncProgressPercentage\":null,\"protectedDisks\":[{\"storageContainerId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourcegroups/mayadahciclus3-rg/providers/microsoft.azurestackhci/storagecontainers/bbcontainer4\",\"storageContainerLocalPath\":\"c:\\\\clusterstorage\\\\volume03\\\\migratedvms\\\\d206abfad9d93a1\",\"sourceDiskId\":\"Microsoft:A0247DB0-CECA-4CB1-AE6C-1D4AC98CA82B\\\\83F8638B-8DCA-4152-9EDA-2CA8B33039B4\\\\0\\\\0\\\\L\",\"sourceDiskName\":\"14393.0.amd64fre.rs1_release.160715-1616_server_serverdatacentereval_en-us_6FD2D815-C59D-487E-8EEC-8FC2A1CBED52\",\"seedDiskName\":\"testsamlee2-OSdisk-14393-0-amd6-d9a3-seed\",\"testMigrateDiskName\":\"testsamlee2-OSdisk-14393-0-amd6-d9a3-test\",\"migrateDiskName\":\"testsamlee2-OSdisk-14393-0-amd6-d9a3\",\"isOsDisk\":true,\"capacityInBytes\":42949672960,\"isDynamic\":true,\"diskType\":\"VHDX\"}],\"protectedNics\":[{\"nicId\":\"Microsoft:A0247DB0-CECA-4CB1-AE6C-1D4AC98CA82B\\\\8A3C8701-4ACE-4F99-832E-294ACC0F51C3\",\"macAddress\":\"00:15:5d:e6:4f:f2\",\"networkName\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourcegroups/mayadahciclus3-rg/providers/microsoft.azurestackhci/virtualnetworks/external\",\"targetNetworkId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourcegroups/mayadahciclus3-rg/providers/microsoft.azurestackhci/virtualnetworks/external\",\"testNetworkId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourcegroups/mayadahciclus3-rg/providers/microsoft.azurestackhci/virtualnetworks/external\",\"selectionTypeForFailover\":\"SelectedByUser\"}],\"targetVmBiosId\":null,\"lastReplicationUpdateTime\":\"2023-09-17T02:18:44.0418343Z\",\"instanceType\":\"HyperVToAzStackHCI\"}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b\",\"name\":\"a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b\",\"type\":\"Microsoft.DataReplication/replicationVaults/protectedItems\",\"systemData\":null,\"tags\":null}", + "isContentBase64": false + } + }, + "Start-AzMigrateHCIServerMigration+[NoContext]+ByInputObject+$POST+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b/plannedFailover?api-version=2021-02-16-preview+3": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b/plannedFailover?api-version=2021-02-16-preview", + "Content": "{\r\n \"properties\": {\r\n \"customProperties\": {\r\n \"instanceType\": \"HyperVToAzStackHCI\",\r\n \"shutdownSourceVM\": false\r\n }\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "140" ] + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b/operations/e093335d-318c-40a6-9036-b0f4f1c8f435?api-version=2021-02-16-preview" ], + "Retry-After": [ "15" ], + "Azure-AsyncOperation": [ "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b/operations/e093335d-318c-40a6-9036-b0f4f1c8f435?api-version=2021-02-16-preview" ], + "x-ms-client-request-id": [ "80b0c4bd-2dad-4606-980a-28aa54b5caa1" ], + "api-supported-versions": [ "2021-02-16-preview" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], + "x-ms-request-id": [ "587be9cc-3dcd-4fbf-a20d-56495dd8887d" ], + "x-ms-correlation-request-id": [ "587be9cc-3dcd-4fbf-a20d-56495dd8887d" ], + "x-ms-routing-request-id": [ "WESTUS:20230917T022322Z:587be9cc-3dcd-4fbf-a20d-56495dd8887d" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: A056D61AEFAC48DFB873A9509B3721B1 Ref B: CO6AA3150218011 Ref C: 2023-09-17T02:23:20Z" ], + "Date": [ "Sun, 17 Sep 2023 02:23:22 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null, + "isContentBase64": false + } + }, + "Start-AzMigrateHCIServerMigration+[NoContext]+ByInputObject+$GET+https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/e093335d-318c-40a6-9036-b0f4f1c8f435?api-version=2021-02-16-preview+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/e093335d-318c-40a6-9036-b0f4f1c8f435?api-version=2021-02-16-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "7" ], + "x-ms-client-request-id": [ "9b2ab393-1d36-4d28-aefc-5507d92b0c5d" ], + "CommandName": [ "Az.Migrate.Internal\\Get-AzMigrateWorkflow" ], + "FullCommandName": [ "Get-AzMigrateWorkflow_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.3.6", "Az.Migrate/1.0.1" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "api-supported-versions": [ "2021-02-16-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-request-id": [ "628edaec-e70c-4a0e-9092-250ec9b2aaa9" ], + "x-ms-correlation-request-id": [ "628edaec-e70c-4a0e-9092-250ec9b2aaa9" ], + "x-ms-routing-request-id": [ "WESTUS:20230917T022323Z:628edaec-e70c-4a0e-9092-250ec9b2aaa9" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 97529E4AC61B48F786AE717FE37F78F6 Ref B: CO6AA3150218011 Ref C: 2023-09-17T02:23:22Z" ], + "Date": [ "Sun, 17 Sep 2023 02:23:23 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "2235" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"displayName\":\"Planned failover\",\"state\":\"Started\",\"startTime\":\"2023-09-17T02:23:22.2009446Z\",\"objectId\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b/plannedFailover\",\"objectName\":\"a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b\",\"objectInternalId\":\"c01ab1ac-441f-5ac9-b48c-58bca6993ca4\",\"objectInternalName\":\"testsamlee2\",\"objectType\":\"ProtectedItem\",\"replicationProviderId\":\"4de0fddc-bdfe-40d9-b60e-678bdce89630\",\"sourceFabricProviderId\":\"b35da11c-d69e-4220-9a90-d81ed93ad2fc\",\"targetFabricProviderId\":\"22f00372-a1b7-467f-87ce-d95e17a6e7c7\",\"allowedActions\":[\"Cancel\"],\"activityId\":\" ActivityId: 00000000-0000-0000-0000-000000000000\",\"tasks\":[{\"taskName\":\"Prerequisite check\",\"state\":\"Started\",\"startTime\":\"2023-09-17T02:23:23.0266339Z\",\"customProperties\":{\"instanceType\":\"TaskDetails\"},\"childrenWorkflows\":[]},{\"taskName\":\"Turning off resource on primary\",\"state\":\"Pending\",\"customProperties\":{\"instanceType\":\"TaskDetails\"},\"childrenWorkflows\":[]},{\"taskName\":\"Starting failover\",\"state\":\"Pending\",\"customProperties\":{\"instanceType\":\"TaskDetails\"},\"childrenWorkflows\":[]},{\"taskName\":\"Preparing protected entities\",\"state\":\"Pending\",\"customProperties\":{\"instanceType\":\"TaskDetails\"},\"childrenWorkflows\":[]},{\"taskName\":\"Turning on resource on recovery\",\"state\":\"Pending\",\"customProperties\":{\"instanceType\":\"TaskDetails\"},\"childrenWorkflows\":[]}],\"errors\":[],\"customProperties\":{\"protectedItemDetails\":[],\"instanceType\":\"FailoverWorkflowDetails\",\"affectedObjectDetails\":{\"PolicyName\":\"samlee3proj46422replicationvaultHyperVToAzStackHCIpolicy\",\"ReplicationExtensionName\":\"samlee3src48adfreplicationfabric-samlee3te2acreplicationfabric-MigReplicationExtn\",\"VaultId\":\"62ef9ab2-1017-434a-ac4e-2f2ec988323d\"}}},\"id\":\"/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/e093335d-318c-40a6-9036-b0f4f1c8f435\",\"name\":\"e093335d-318c-40a6-9036-b0f4f1c8f435\",\"type\":\"Microsoft.DataReplication/replicationVaults/jobs\",\"systemData\":null,\"tags\":null}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Migrate/Migrate.Autorest/test/Start-AzMigrateHCIServerMigration.Tests.ps1 b/src/Migrate/Migrate.Autorest/test/Start-AzMigrateHCIServerMigration.Tests.ps1 new file mode 100644 index 000000000000..b7773d95488a --- /dev/null +++ b/src/Migrate/Migrate.Autorest/test/Start-AzMigrateHCIServerMigration.Tests.ps1 @@ -0,0 +1,27 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Start-AzMigrateHCIServerMigration')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Start-AzMigrateHCIServerMigration.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 'Start-AzMigrateHCIServerMigration' { + It 'ByID' { + { Start-AzMigrateHCIServerMigration -TargetObjectID $env.hciProtectedItem1 -SubscriptionId $env.hciSubscriptionId } | Should -Not -Throw + } + + It 'ByInputObject' { + $obj = Get-AzMigrateHCIServerReplication -TargetObjectID $env.hciProtectedItem2 -SubscriptionId $env.hciSubscriptionId + $obj.Count | Should -BeGreaterOrEqual 1 + { Start-AzMigrateHCIServerMigration -InputObject $obj -SubscriptionId $env.hciSubscriptionId } | Should -Not -Throw + } +} diff --git a/src/Migrate/Migrate.Autorest/test/env.json b/src/Migrate/Migrate.Autorest/test/env.json index b2c99b0dbe98..11583d000289 100644 --- a/src/Migrate/Migrate.Autorest/test/env.json +++ b/src/Migrate/Migrate.Autorest/test/env.json @@ -68,5 +68,30 @@ "srsTargetPCId": "Microsoft Azure", "srsLicense": "NoLicenseType", "migResourceGroupId": "/Subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/cbtsignoff2201rg", - "srsMachinetmpy": "/Subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/cbtsignoff2201rg/providers/Microsoft.RecoveryServices/vaults/signoffccyapp3352vault/replicationFabrics/signoffccyappae52replicationfabric/replicationProtectionContainers/signoffccyappae52replicationcontainer/replicationMigrationItems/idclab-vcen67-fareast-corp-micr-0f144e99-ba36-4649-b92b-8b06854aa539_5015197c-99bd-50e3-d324-02470554c493" + "srsMachinetmpy": "/Subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/cbtsignoff2201rg/providers/Microsoft.RecoveryServices/vaults/signoffccyapp3352vault/replicationFabrics/signoffccyappae52replicationfabric/replicationProtectionContainers/signoffccyappae52replicationcontainer/replicationMigrationItems/idclab-vcen67-fareast-corp-micr-0f144e99-ba36-4649-b92b-8b06854aa539_5015197c-99bd-50e3-d324-02470554c493", + "hciSubscriptionId": "40b6d51e-c6c9-47c8-9203-52fdeaec6d1e", + "hciMigResourceGroup": "samlee3-rg4", + "hciMigResourceGroupId": "/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4", + "hciProjectName": "samlee3proj4", + "hciProjectId": "/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.Migrate/MigrateProjects/samlee3proj4", + "hciSourceApplianceName": "samlee3src4", + "hciTargetApplianceName": "samlee3t", + "hciSourceReplicationFabricName": "samlee3src48adfreplicationfabric", + "hciReplicationVaultName": "samlee3proj46422replicationvault", + "hciReplicationPolicyName": "samlee3proj46422replicationvaultHyperVToAzStackHCIpolicy", + "hciReplicationStorageAccountId": "/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.Storage/storageAccounts/samlee3proj4migratesa", + "hciTargetRGId": "/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg-tgt", + "hciTgtVirtualSwitchId": "/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/virtualnetworks/external" , + "hciTgtStoragePathId": "/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/storagecontainers/bbcontainer4", + "hciSDSMachineId1": "/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/machines/0560e6aa-9b2d-45e5-92cd-4ff618d09bec", + "hciTgtVMName1": "hciVm1", + "hciDiskId1": "Microsoft:0560E6AA-9B2D-45E5-92CD-4FF618D09BEC\\83F8638B-8DCA-4152-9EDA-2CA8B33039B4\\0\\0\\L", + "hciProtectedItem1": "/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0560e6aa-9b2d-45e5-92cd-4ff618d09bec", + "hciSDSMachineId2": "/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/machines/a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b", + "hciTgtVMName2": "hciVm2", + "hciDiskId2": "Microsoft:A0247DB0-CECA-4CB1-AE6C-1D4AC98CA82B\\83F8638B-8DCA-4152-9EDA-2CA8B33039B4\\0\\0\\L", + "hciProtectedItem2": "/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b", + "hciNicId2": "Microsoft:A0247DB0-CECA-4CB1-AE6C-1D4AC98CA82B\\8A3C8701-4ACE-4F99-832E-294ACC0F51C3", + "hciJobName": "f8941ed0-5563-400b-b93c-24dcba833dbb", + "hciJobId": "/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/f8941ed0-5563-400b-b93c-24dcba833dbb" } diff --git a/src/Migrate/Migrate.Autorest/test/localEnv.json b/src/Migrate/Migrate.Autorest/test/localEnv.json index 19d1efa34c34..ef55eac216c9 100644 --- a/src/Migrate/Migrate.Autorest/test/localEnv.json +++ b/src/Migrate/Migrate.Autorest/test/localEnv.json @@ -1,65 +1,90 @@ { - "srsMachinetmpw": "/Subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/cbtsignoff2105srcrg/providers/Microsoft.RecoveryServices/vaults/signoff2105app1452vault/replicationFabrics/signoff2105app1c36replicationfabric/replicationProtectionContainers/signoff2105app1c36replicationcontainer/replicationMigrationItems/idclab-vcen67-fareast-corp-micr-6f5e3b29-29ad-4e62-abbd-6cd33c4183ef_5015036c-2cf6-771f-428d-6d686b0aa8ba", - "srsDiskId2": "6000C29b-b830-6417-60a5-de171631692d", - "srsinitinfraProjectName": "cbtsignoff2105project", - "srsSDSSite": "signoff2105app1452site", - "srsTestPolicy": "migratesignoff2105app1452sitepolicy", - "migRunAsAccountName": "f53e4f58-d091-536f-948e-51bc0745552e", - "srsDiskId": "6000C290-ce50-48c1-191b-0529758e8c10", - "migSiteName": "signoff2105app1452site", - "srsMappingName": "containermapping", - "srsFabricName": "signoff2105app1c36replicationfabric", - "srsSubscriptionId": "7c943c1b-5122-4097-90c8-861411bdd574", - "srsMachineNametempe": "idclab-vcen67-fareast-corp-micr-6f5e3b29-29ad-4e62-abbd-6cd33c4183ef_5015a79d-1383-b5f6-b434-029793d367ea", - "srsMachineId": "/Subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/cbtsignoff2105srcrg/providers/Microsoft.RecoveryServices/vaults/signoff2105app1452vault/replicationFabrics/signoff2105app1c36replicationfabric/replicationProtectionContainers/signoff2105app1c36replicationcontainer/replicationMigrationItems/idclab-vcen67-fareast-corp-micr-6f5e3b29-29ad-4e62-abbd-6cd33c4183ef_5015abd5-5788-6477-c69f-bb53618ac3b8", - "srsMachinetmpx": "/Subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/cbtsignoff2105srcrg/providers/Microsoft.RecoveryServices/vaults/signoff2105app1452vault/replicationFabrics/signoff2105app1c36replicationfabric/replicationProtectionContainers/signoff2105app1c36replicationcontainer/replicationMigrationItems/idclab-vcen67-fareast-corp-micr-6f5e3b29-29ad-4e62-abbd-6cd33c4183ef_50153b6a-81fb-6ab4-d3c4-ef2202e03768", - "srsSDSMachineId": "/subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/cbtsignoff2105srcrg/providers/Microsoft.OffAzure/VMwareSites/signoff2105app1452site/machines/idclab-vcen67-fareast-corp-micr-6f5e3b29-29ad-4e62-abbd-6cd33c4183ef_50153b6a-81fb-6ab4-d3c4-ef2202e03768", - "srsTgtNId": "/subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/fancy(migrate)/providers/Microsoft.Network/virtualNetworks/Cbtsignoff2105targetnetwork", - "srsJobName": "54f4d887-e6b4-4424-8a15-42e452343552", - "srsMachineIdtempb": "/Subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/cbtsignoff2105srcrg/providers/Microsoft.RecoveryServices/vaults/signoff2105app1452vault/replicationFabrics/signoff2105app1c36replicationfabric/replicationProtectionContainers/signoff2105app1c36replicationcontainer/replicationMigrationItems/idclab-vcen67-fareast-corp-micr-6f5e3b29-29ad-4e62-abbd-6cd33c4183ef_5015e56d-c36e-c890-fc90-66df3c744ba6", - "srsTenant": "72f988bf-86f1-41af-91ab-2d7cd011db47", - "srsLicense": "NoLicenseType", + "hciProjectId": "/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.Migrate/MigrateProjects/samlee3proj4", + "srsDiskType": "Standard_LRS", "srsTgtVMName": "singhabh-TestVM", - "srsProjectName": "cbtsignoff2105project", - "srsProtectionContainerName": "signoff2105app1c36replicationcontainer", "srsVaultName": "signoff2105app1452vault", - "srsSDSMachineId2": "/subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/cbtsignoff2105srcrg/providers/Microsoft.OffAzure/VMwareSites/signoff2105app1452site/machines/idclab-vcen67-fareast-corp-micr-6f5e3b29-29ad-4e62-abbd-6cd33c4183ef_5015036c-2cf6-771f-428d-6d686b0aa8ba", - "srsTargetPCId": "Microsoft Azure", - "srsMachinetempz": "/Subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/cbtsignoff2105srcrg/providers/Microsoft.RecoveryServices/vaults/signoff2105app1452vault/replicationFabrics/signoff2105app1c36replicationfabric/replicationProtectionContainers/signoff2105app1c36replicationcontainer/replicationMigrationItems/idclab-vcen67-fareast-corp-micr-6f5e3b29-29ad-4e62-abbd-6cd33c4183ef_5015a79d-1383-b5f6-b434-029793d367ea", + "hciDiskId1": "Microsoft:0560E6AA-9B2D-45E5-92CD-4FF618D09BEC\\\\83F8638B-8DCA-4152-9EDA-2CA8B33039B4\\\\0\\\\0\\\\L", + "srsDiskId1": "6000C29a-7c98-c890-0575-d0b05e4a8a43", + "migResourceGroup": "cbtsignoff2105srcrg", + "srsMachineId": "/Subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/cbtsignoff2105srcrg/providers/Microsoft.RecoveryServices/vaults/signoff2105app1452vault/replicationFabrics/signoff2105app1c36replicationfabric/replicationProtectionContainers/signoff2105app1c36replicationcontainer/replicationMigrationItems/idclab-vcen67-fareast-corp-micr-6f5e3b29-29ad-4e62-abbd-6cd33c4183ef_5015abd5-5788-6477-c69f-bb53618ac3b8", + "srsMachinetempy": "/Subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/cbtsignoff2105srcrg/providers/Microsoft.RecoveryServices/vaults/signoff2105app1452vault/replicationFabrics/signoff2105app1c36replicationfabric/replicationProtectionContainers/signoff2105app1c36replicationcontainer/replicationMigrationItems/idclab-vcen67-fareast-corp-micr-6f5e3b29-29ad-4e62-abbd-6cd33c4183ef_5015a79d-1383-b5f6-b434-029793d367ea", + "srsPolicyName": "migratesignoff2105app1452sitepolicy", "srsMachineIdtempc": "/Subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/cbtsignoff2105srcrg/providers/Microsoft.RecoveryServices/vaults/signoff2105app1452vault/replicationFabrics/signoff2105app1c36replicationfabric/replicationProtectionContainers/signoff2105app1c36replicationcontainer/replicationMigrationItems/idclab-vcen67-fareast-corp-micr-6f5e3b29-29ad-4e62-abbd-6cd33c4183ef_500244e2-10af-9aa9-213c-784ec31288c8", - "srsTestNetworkId": "/subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/fancy(migrate)/providers/Microsoft.Network/virtualNetworks/Cbtsignoff2105targetnetwork", - "srsResourceGroupId": "/subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/fancy(migrate)", + "srsDiskId2": "6000C29b-b830-6417-60a5-de171631692d", + "srsSubscriptionId": "7c943c1b-5122-4097-90c8-861411bdd574", "srsMachineIdtempd": "/Subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/cbtsignoff2105srcrg/providers/Microsoft.RecoveryServices/vaults/signoff2105app1452vault/replicationFabrics/signoff2105app1c36replicationfabric/replicationProtectionContainers/signoff2105app1c36replicationcontainer/replicationMigrationItems/idclab-vcen67-fareast-corp-micr-6f5e3b29-29ad-4e62-abbd-6cd33c4183ef_5015a79d-1383-b5f6-b434-029793d367ea", - "srsResourceGroup": "cbtsignoff2105srcrg", - "srsDiskId3": "6000C29b-ffa5-8351-2d43-2602547dd2b7", - "srsPolicyId": "/Subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/cbtsignoff2105srcrg/providers/Microsoft.RecoveryServices/vaults/signoff2105app1452vault/replicationPolicies/migratesignoff2105app1452sitepolicy", - "srsDiskType": "Standard_LRS", - "srsinitinfraTargetRegion": "centraluseuap", + "hciReplicationStorageAccountId": "/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.Storage/storageAccounts/samlee3proj4migratesa", + "hciTargetRGId": "/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg-tgt", "srsMachineIdtempg": "/Subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/cbtsignoff2105srcrg/providers/Microsoft.RecoveryServices/vaults/signoff2105app1452vault/replicationFabrics/signoff2105app1c36replicationfabric/replicationProtectionContainers/signoff2105app1c36replicationcontainer/replicationMigrationItems/idclab-vcen67-fareast-corp-micr-6f5e3b29-29ad-4e62-abbd-6cd33c4183ef_5015a79d-1383-b5f6-b434-029793d367ea", - "srsMachineName": "idclab-vcen67-fareast-corp-micr-6f5e3b29-29ad-4e62-abbd-6cd33c4183ef_5015a79d-1383-b5f6-b434-029793d367ea", - "srsinitinfraScenario": "agentlessVMware", - "srsGetSDSMachineID": "/subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/cbtsignoff2105srcrg/providers/Microsoft.OffAzure/VMwareSites/signoff2105app1452site/machines/idclab-vcen67-fareast-corp-micr-6f5e3b29-29ad-4e62-abbd-6cd33c4183ef_5015a79d-1383-b5f6-b434-029793d367ea", + "hciSourceApplianceName": "samlee3src4", + "migSiteName": "signoff2105app1452site", "srsSDSMachineName": "idclab-vcen67-fareast-corp-micr-6f5e3b29-29ad-4e62-abbd-6cd33c4183ef_5015be48-8229-31df-154c-0df27fccb275", - "Tenant": "72f988bf-86f1-41af-91ab-2d7cd011db47", - "srsSDSMachineId3": "/subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/cbtsignoff2105srcrg/providers/Microsoft.OffAzure/VMwareSites/signoff2105app1452site/machines/idclab-vcen67-fareast-corp-micr-6f5e3b29-29ad-4e62-abbd-6cd33c4183ef_5015e56d-c36e-c890-fc90-66df3c744ba6", - "srsMachineIdtempf": "/Subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/cbtsignoff2105srcrg/providers/Microsoft.RecoveryServices/vaults/signoff2105app1452vault/replicationFabrics/signoff2105app1c36replicationfabric/replicationProtectionContainers/signoff2105app1c36replicationcontainer/replicationMigrationItems/idclab-vcen67-fareast-corp-micr-6f5e3b29-29ad-4e62-abbd-6cd33c4183ef_5015a79d-1383-b5f6-b434-029793d367ea", - "migProjectName": "cbtsignoff2105project", - "migSubscriptionId": "7c943c1b-5122-4097-90c8-861411bdd574", - "srsMachinetempy": "/Subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/cbtsignoff2105srcrg/providers/Microsoft.RecoveryServices/vaults/signoff2105app1452vault/replicationFabrics/signoff2105app1c36replicationfabric/replicationProtectionContainers/signoff2105app1c36replicationcontainer/replicationMigrationItems/idclab-vcen67-fareast-corp-micr-6f5e3b29-29ad-4e62-abbd-6cd33c4183ef_5015a79d-1383-b5f6-b434-029793d367ea", - "srsDiskId1": "6000C29a-7c98-c890-0575-d0b05e4a8a43", - "migResourceGroup": "cbtsignoff2105srcrg", - "SubscriptionId": "7c943c1b-5122-4097-90c8-861411bdd574", - "migVMwareMachineName": "idclab-vcen67-fareast-corp-micr-6f5e3b29-29ad-4e62-abbd-6cd33c4183ef_501501f9-0009-48ca-3030-a16262ba8e5d", - "srsTargetRGId": "/subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/fancy(migrate)", + "srsTenant": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "srsTestPolicy": "migratesignoff2105app1452sitepolicy", + "hciProtectedItem2": "/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b", + "Tenant": "c76bd4d1-bea3-45ea-be1b-4a745a675d07", + "hciSDSMachineId1": "/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/machines/0560e6aa-9b2d-45e5-92cd-4ff618d09bec", + "hciProjectName": "samlee3proj4", + "hciReplicationPolicyName": "samlee3proj46422replicationvaultHyperVToAzStackHCIpolicy", + "srsTargetPCId": "Microsoft Azure", + "migRunAsAccountName": "f53e4f58-d091-536f-948e-51bc0745552e", + "srsLicense": "NoLicenseType", "srsJobId": "/Subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/cbtsignoff2105srcrg/providers/Microsoft.RecoveryServices/vaults/signoff2105app1452vault/replicationJobs/92457265-7eb3-4391-837c-b71e6cce9334", - "srsMachinetmpa": "/Subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/cbtsignoff2105srcrg/providers/Microsoft.RecoveryServices/vaults/signoff2105app1452vault/replicationFabrics/signoff2105app1c36replicationfabric/replicationProtectionContainers/signoff2105app1c36replicationcontainer/replicationMigrationItems/idclab-vcen67-fareast-corp-micr-6f5e3b29-29ad-4e62-abbd-6cd33c4183ef_5015e56d-c36e-c890-fc90-66df3c744ba6", + "srsSDSSite": "signoff2105app1452site", + "srsDiskId3": "6000C29b-ffa5-8351-2d43-2602547dd2b7", + "migSolutionName": "Servers-Migration-ServerMigration", "srsProviderName": "signoff2105app1c36dra", + "srsMappingName": "containermapping", + "srsinitinfraScenario": "agentlessVMware", + "hciTgtStoragePathId": "/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/storagecontainers/bbcontainer4", + "SubscriptionId": "40b6d51e-c6c9-47c8-9203-52fdeaec6d1e", + "srsJobName": "54f4d887-e6b4-4424-8a15-42e452343552", + "srsMachinetmpx": "/Subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/cbtsignoff2105srcrg/providers/Microsoft.RecoveryServices/vaults/signoff2105app1452vault/replicationFabrics/signoff2105app1c36replicationfabric/replicationProtectionContainers/signoff2105app1c36replicationcontainer/replicationMigrationItems/idclab-vcen67-fareast-corp-micr-6f5e3b29-29ad-4e62-abbd-6cd33c4183ef_50153b6a-81fb-6ab4-d3c4-ef2202e03768", "srsProjectId": "/subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/cbtsignoff2105srcrg/providers/Microsoft.Migrate/migrateprojects/cbtsignoff2105project", - "srsPolicyName": "migratesignoff2105app1452sitepolicy", - "migApplianceName": "signoff2105app", - "srsSDSMachineId1": "/subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/cbtsignoff2105srcrg/providers/Microsoft.OffAzure/VMwareSites/signoff2105app1452site/machines/idclab-vcen67-fareast-corp-micr-6f5e3b29-29ad-4e62-abbd-6cd33c4183ef_5015abd5-5788-6477-c69f-bb53618ac3b8", - "srsinitinfraResourceGroupName": "cbtsignoff2105srcrg", + "migSubscriptionId": "7c943c1b-5122-4097-90c8-861411bdd574", + "hciSDSMachineId2": "/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/machines/a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b", "srsMachinetmpv": "/Subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/cbtsignoff2105srcrg/providers/Microsoft.RecoveryServices/vaults/signoff2105app1452vault/replicationFabrics/signoff2105app1c36replicationfabric/replicationProtectionContainers/signoff2105app1c36replicationcontainer/replicationMigrationItems/idclab-vcen67-fareast-corp-micr-6f5e3b29-29ad-4e62-abbd-6cd33c4183ef_501598ae-aa6f-aecb-3d4f-09a29c11df2f", + "hciProtectedItem1": "/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0560e6aa-9b2d-45e5-92cd-4ff618d09bec", + "hciSourceReplicationFabricName": "samlee3src48adfreplicationfabric", + "migProjectName": "cbtsignoff2105project", + "srsinitinfraProjectName": "cbtsignoff2105project", + "srsinitinfraResourceGroupName": "cbtsignoff2105srcrg", + "hciSubscriptionId": "40b6d51e-c6c9-47c8-9203-52fdeaec6d1e", + "srsDiskId": "6000C290-ce50-48c1-191b-0529758e8c10", + "srsMachinetempz": "/Subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/cbtsignoff2105srcrg/providers/Microsoft.RecoveryServices/vaults/signoff2105app1452vault/replicationFabrics/signoff2105app1c36replicationfabric/replicationProtectionContainers/signoff2105app1c36replicationcontainer/replicationMigrationItems/idclab-vcen67-fareast-corp-micr-6f5e3b29-29ad-4e62-abbd-6cd33c4183ef_5015a79d-1383-b5f6-b434-029793d367ea", "srsMachineNametempa": "idclab-vcen67-fareast-corp-micr-6f5e3b29-29ad-4e62-abbd-6cd33c4183ef_5015e56d-c36e-c890-fc90-66df3c744ba6", - "migSolutionName": "Servers-Migration-ServerMigration" + "hciJobName": "f8941ed0-5563-400b-b93c-24dcba833dbb", + "srsProjectName": "cbtsignoff2105project", + "srsResourceGroupId": "/subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/fancy(migrate)", + "srsMachineNametempe": "idclab-vcen67-fareast-corp-micr-6f5e3b29-29ad-4e62-abbd-6cd33c4183ef_5015a79d-1383-b5f6-b434-029793d367ea", + "srsMachinetmpa": "/Subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/cbtsignoff2105srcrg/providers/Microsoft.RecoveryServices/vaults/signoff2105app1452vault/replicationFabrics/signoff2105app1c36replicationfabric/replicationProtectionContainers/signoff2105app1c36replicationcontainer/replicationMigrationItems/idclab-vcen67-fareast-corp-micr-6f5e3b29-29ad-4e62-abbd-6cd33c4183ef_5015e56d-c36e-c890-fc90-66df3c744ba6", + "srsFabricName": "signoff2105app1c36replicationfabric", + "hciTgtVirtualSwitchId": "/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/virtualnetworks/external", + "srsTargetRGId": "/subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/fancy(migrate)", + "hciMigResourceGroupId": "/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4", + "srsSDSMachineId3": "/subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/cbtsignoff2105srcrg/providers/Microsoft.OffAzure/VMwareSites/signoff2105app1452site/machines/idclab-vcen67-fareast-corp-micr-6f5e3b29-29ad-4e62-abbd-6cd33c4183ef_5015e56d-c36e-c890-fc90-66df3c744ba6", + "srsMachineIdtempb": "/Subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/cbtsignoff2105srcrg/providers/Microsoft.RecoveryServices/vaults/signoff2105app1452vault/replicationFabrics/signoff2105app1c36replicationfabric/replicationProtectionContainers/signoff2105app1c36replicationcontainer/replicationMigrationItems/idclab-vcen67-fareast-corp-micr-6f5e3b29-29ad-4e62-abbd-6cd33c4183ef_5015e56d-c36e-c890-fc90-66df3c744ba6", + "hciTgtVMName2": "hciVm2", + "srsSDSMachineId2": "/subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/cbtsignoff2105srcrg/providers/Microsoft.OffAzure/VMwareSites/signoff2105app1452site/machines/idclab-vcen67-fareast-corp-micr-6f5e3b29-29ad-4e62-abbd-6cd33c4183ef_5015036c-2cf6-771f-428d-6d686b0aa8ba", + "hciJobId": "/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/f8941ed0-5563-400b-b93c-24dcba833dbb", + "srsMachineName": "idclab-vcen67-fareast-corp-micr-6f5e3b29-29ad-4e62-abbd-6cd33c4183ef_5015a79d-1383-b5f6-b434-029793d367ea", + "srsGetSDSMachineID": "/subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/cbtsignoff2105srcrg/providers/Microsoft.OffAzure/VMwareSites/signoff2105app1452site/machines/idclab-vcen67-fareast-corp-micr-6f5e3b29-29ad-4e62-abbd-6cd33c4183ef_5015a79d-1383-b5f6-b434-029793d367ea", + "hciTargetApplianceName": "samlee3t", + "srsResourceGroup": "cbtsignoff2105srcrg", + "srsSDSMachineId": "/subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/cbtsignoff2105srcrg/providers/Microsoft.OffAzure/VMwareSites/signoff2105app1452site/machines/idclab-vcen67-fareast-corp-micr-6f5e3b29-29ad-4e62-abbd-6cd33c4183ef_50153b6a-81fb-6ab4-d3c4-ef2202e03768", + "hciNicId2": "Microsoft:A0247DB0-CECA-4CB1-AE6C-1D4AC98CA82B\\\\8A3C8701-4ACE-4F99-832E-294ACC0F51C3", + "hciDiskId2": "Microsoft:A0247DB0-CECA-4CB1-AE6C-1D4AC98CA82B\\\\83F8638B-8DCA-4152-9EDA-2CA8B33039B4\\\\0\\\\0\\\\L", + "srsTgtNId": "/subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/fancy(migrate)/providers/Microsoft.Network/virtualNetworks/Cbtsignoff2105targetnetwork", + "srsPolicyId": "/Subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/cbtsignoff2105srcrg/providers/Microsoft.RecoveryServices/vaults/signoff2105app1452vault/replicationPolicies/migratesignoff2105app1452sitepolicy", + "hciMigResourceGroup": "samlee3-rg4", + "srsMachineIdtempf": "/Subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/cbtsignoff2105srcrg/providers/Microsoft.RecoveryServices/vaults/signoff2105app1452vault/replicationFabrics/signoff2105app1c36replicationfabric/replicationProtectionContainers/signoff2105app1c36replicationcontainer/replicationMigrationItems/idclab-vcen67-fareast-corp-micr-6f5e3b29-29ad-4e62-abbd-6cd33c4183ef_5015a79d-1383-b5f6-b434-029793d367ea", + "srsinitinfraTargetRegion": "centraluseuap", + "srsProtectionContainerName": "signoff2105app1c36replicationcontainer", + "srsSDSMachineId1": "/subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/cbtsignoff2105srcrg/providers/Microsoft.OffAzure/VMwareSites/signoff2105app1452site/machines/idclab-vcen67-fareast-corp-micr-6f5e3b29-29ad-4e62-abbd-6cd33c4183ef_5015abd5-5788-6477-c69f-bb53618ac3b8", + "migApplianceName": "signoff2105app", + "hciReplicationVaultName": "samlee3proj46422replicationvault", + "srsTestNetworkId": "/subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/fancy(migrate)/providers/Microsoft.Network/virtualNetworks/Cbtsignoff2105targetnetwork", + "srsMachinetmpw": "/Subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/cbtsignoff2105srcrg/providers/Microsoft.RecoveryServices/vaults/signoff2105app1452vault/replicationFabrics/signoff2105app1c36replicationfabric/replicationProtectionContainers/signoff2105app1c36replicationcontainer/replicationMigrationItems/idclab-vcen67-fareast-corp-micr-6f5e3b29-29ad-4e62-abbd-6cd33c4183ef_5015036c-2cf6-771f-428d-6d686b0aa8ba", + "migVMwareMachineName": "idclab-vcen67-fareast-corp-micr-6f5e3b29-29ad-4e62-abbd-6cd33c4183ef_501501f9-0009-48ca-3030-a16262ba8e5d", + "hciTgtVMName1": "hciVm1" } diff --git a/src/Migrate/Migrate.Autorest/test/utils.ps1 b/src/Migrate/Migrate.Autorest/test/utils.ps1 index e977897961e8..a30b457487f8 100644 --- a/src/Migrate/Migrate.Autorest/test/utils.ps1 +++ b/src/Migrate/Migrate.Autorest/test/utils.ps1 @@ -100,6 +100,32 @@ function setupEnv() { $env.migRunAsAccountName = "f53e4f58-d091-536f-948e-51bc0745552e" $env.migApplianceName = "signoff2105app" + $env.hciSubscriptionId = "40b6d51e-c6c9-47c8-9203-52fdeaec6d1e" + $env.hciMigResourceGroup = "samlee3-rg4" + $env.hciMigResourceGroupId = "/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4" + $env.hciProjectName = "samlee3proj4" + $env.hciProjectId = "/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.Migrate/MigrateProjects/samlee3proj4" + $env.hciSourceApplianceName = "samlee3src4" + $env.hciTargetApplianceName = "samlee3t" + $env.hciSourceReplicationFabricName = "samlee3src48adfreplicationfabric" + $env.hciReplicationVaultName = "samlee3proj46422replicationvault" + $env.hciReplicationPolicyName = "samlee3proj46422replicationvaultHyperVToAzStackHCIpolicy" + $env.hciReplicationStorageAccountId = "/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.Storage/storageAccounts/samlee3proj4migratesa" + $env.hciTargetRGId = "/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg-tgt" + $env.hciTgtVirtualSwitchId = "/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/virtualnetworks/external" + $env.hciTgtStoragePathId = "/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/mayadahciclus3-rg/providers/Microsoft.AzureStackHCI/storagecontainers/bbcontainer4" + $env.hciSDSMachineId1 = "/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/machines/0560e6aa-9b2d-45e5-92cd-4ff618d09bec" + $env.hciTgtVMName1 = "hciVm1" + $env.hciDiskId1 = "Microsoft:0560E6AA-9B2D-45E5-92CD-4FF618D09BEC\\83F8638B-8DCA-4152-9EDA-2CA8B33039B4\\0\\0\\L" + $env.hciProtectedItem1 = "/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/0560e6aa-9b2d-45e5-92cd-4ff618d09bec" + $env.hciSDSMachineId2 = "/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.OffAzure/HyperVSites/samlee3src41244site/machines/a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b" + $env.hciTgtVMName2 = "hciVm2" + $env.hciDiskId2 = "Microsoft:A0247DB0-CECA-4CB1-AE6C-1D4AC98CA82B\\83F8638B-8DCA-4152-9EDA-2CA8B33039B4\\0\\0\\L" + $env.hciProtectedItem2 = "/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/protectedItems/a0247db0-ceca-4cb1-ae6c-1d4ac98ca82b" + $env.hciNicId2 = "Microsoft:A0247DB0-CECA-4CB1-AE6C-1D4AC98CA82B\\8A3C8701-4ACE-4F99-832E-294ACC0F51C3" + $env.hciJobName = "f8941ed0-5563-400b-b93c-24dcba833dbb" + $env.hciJobId = "/subscriptions/40b6d51e-c6c9-47c8-9203-52fdeaec6d1e/resourceGroups/samlee3-rg4/providers/Microsoft.DataReplication/replicationVaults/samlee3proj46422replicationvault/jobs/f8941ed0-5563-400b-b93c-24dcba833dbb" + $envFile = 'localEnv.json' if ($TestMode -eq 'live') { $envFile = 'localEnv.json' diff --git a/src/Migrate/Migrate/Az.Migrate.psd1 b/src/Migrate/Migrate/Az.Migrate.psd1 index 50566b095419..0263bf25a35b 100644 --- a/src/Migrate/Migrate/Az.Migrate.psd1 +++ b/src/Migrate/Migrate/Az.Migrate.psd1 @@ -3,7 +3,7 @@ # # Generated by: Microsoft Corporation # -# Generated on: 12/5/2023 +# Generated on: 1/26/2024 # @{ @@ -51,7 +51,7 @@ DotNetFrameworkVersion = '4.7.2' # ProcessorArchitecture = '' # Modules that must be imported into the global environment prior to importing this module -RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '2.12.4'; }) +RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '2.15.0'; }) # Assemblies that must be loaded prior to importing this module RequiredAssemblies = 'Migrate.Autorest/bin/Az.Migrate.private.dll' @@ -69,7 +69,9 @@ FormatsToProcess = 'Migrate.Autorest/Az.Migrate.format.ps1xml' NestedModules = @('Migrate.Autorest/Az.Migrate.psm1') # 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 = 'Get-AzMigrateDiscoveredServer', 'Get-AzMigrateJob', +FunctionsToExport = 'Get-AzMigrateDiscoveredServer', 'Get-AzMigrateHCIJob', + 'Get-AzMigrateHCIReplicationFabric', + 'Get-AzMigrateHCIServerReplication', 'Get-AzMigrateJob', 'Get-AzMigrateProject', 'Get-AzMigrateReplicationFabric', 'Get-AzMigrateReplicationPolicy', 'Get-AzMigrateReplicationProtectionContainer', @@ -77,17 +79,23 @@ FunctionsToExport = 'Get-AzMigrateDiscoveredServer', 'Get-AzMigrateJob', 'Get-AzMigrateReplicationRecoveryServicesProvider', 'Get-AzMigrateRunAsAccount', 'Get-AzMigrateServerReplication', 'Get-AzMigrateSite', 'Get-AzMigrateSolution', + 'Initialize-AzMigrateHCIReplicationInfrastructure', 'Initialize-AzMigrateReplicationInfrastructure', - 'New-AzMigrateDiskMapping', 'New-AzMigrateNicMapping', + 'New-AzMigrateDiskMapping', 'New-AzMigrateHCIDiskMappingObject', + 'New-AzMigrateHCINicMappingObject', + 'New-AzMigrateHCIServerReplication', 'New-AzMigrateNicMapping', 'New-AzMigrateProject', 'New-AzMigrateReplicationPolicy', 'New-AzMigrateReplicationProtectionContainerMapping', 'New-AzMigrateServerReplication', 'New-AzMigrateTestNicMapping', - 'Register-AzMigrateProjectTool', 'Remove-AzMigrateProject', + 'Register-AzMigrateProjectTool', + 'Remove-AzMigrateHCIServerReplication', 'Remove-AzMigrateProject', 'Remove-AzMigrateServerReplication', 'Restart-AzMigrateServerReplication', 'Resume-AzMigrateServerReplication', 'Set-AzMigrateDiskMapping', - 'Set-AzMigrateServerReplication', 'Start-AzMigrateServerMigration', - 'Start-AzMigrateTestMigration', + 'Set-AzMigrateHCIServerReplication', + 'Set-AzMigrateServerReplication', + 'Start-AzMigrateHCIServerMigration', + 'Start-AzMigrateServerMigration', 'Start-AzMigrateTestMigration', 'Start-AzMigrateTestMigrationCleanup', 'Suspend-AzMigrateServerReplication' diff --git a/src/Migrate/Migrate/ChangeLog.md b/src/Migrate/Migrate/ChangeLog.md index 19c2b5a740e3..06cc07e6719a 100644 --- a/src/Migrate/Migrate/ChangeLog.md +++ b/src/Migrate/Migrate/ChangeLog.md @@ -18,6 +18,7 @@ - Additional information about change #1 --> ## Upcoming Release +* Added support for `Data.Replication` ## Version 2.2.0 * Fixed key vault SPN Id coming as null for some users diff --git a/src/Migrate/Migrate/help/Get-AzMigrateDiscoveredServer.md b/src/Migrate/Migrate/help/Get-AzMigrateDiscoveredServer.md index 514d6e43ba0b..1160433cf5a7 100644 --- a/src/Migrate/Migrate/help/Get-AzMigrateDiscoveredServer.md +++ b/src/Migrate/Migrate/help/Get-AzMigrateDiscoveredServer.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Migrate-help.xml Module Name: Az.Migrate online version: https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratediscoveredserver schema: 2.0.0 @@ -15,25 +15,26 @@ Get All discovered servers in a migrate project. ### List (Default) ``` Get-AzMigrateDiscoveredServer -ProjectName -ResourceGroupName [-DisplayName ] - [-SubscriptionId ] [-Confirm] [-WhatIf] [] + [-SourceMachineType ] [-SubscriptionId ] [-WhatIf] [-Confirm] [] ``` -### Get +### ListInSite ``` -Get-AzMigrateDiscoveredServer -Name -ProjectName -ResourceGroupName - [-SubscriptionId ] [-Confirm] [-WhatIf] [] +Get-AzMigrateDiscoveredServer -ProjectName -ResourceGroupName [-DisplayName ] + [-SourceMachineType ] [-SubscriptionId ] -ApplianceName [-WhatIf] [-Confirm] + [] ``` -### GetInSite +### Get ``` -Get-AzMigrateDiscoveredServer -ApplianceName -Name -ProjectName - -ResourceGroupName [-SubscriptionId ] [-Confirm] [-WhatIf] [] +Get-AzMigrateDiscoveredServer -ProjectName -ResourceGroupName [-SourceMachineType ] + [-SubscriptionId ] -Name [-WhatIf] [-Confirm] [] ``` -### ListInSite +### GetInSite ``` -Get-AzMigrateDiscoveredServer -ApplianceName -ProjectName -ResourceGroupName - [-DisplayName ] [-SubscriptionId ] [-Confirm] [-WhatIf] [] +Get-AzMigrateDiscoveredServer -ProjectName -ResourceGroupName [-SourceMachineType ] + [-SubscriptionId ] -Name -ApplianceName [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -59,7 +60,6 @@ idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_5029c9aa-3c idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_5029dabc-cc94-780f-76fd-e39acb0e9dce Microsoft.OffAzure/VMwareSites/machines idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_50299579-fc18-4152-ade2-c4a57946f72b Microsoft.OffAzure/VMwareSites/machines idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_5029cc18-efdc-7315-3b09-9d12a0f337e2 Microsoft.OffAzure/VMwareSites/machines - ``` Get All servers in a migrate project. @@ -73,7 +73,6 @@ Get-AzMigrateDiscoveredServer -Name idclab-a360-fareast-corp-micros-86617dcf-eff Name Typeo… ---- ----o… idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_5029e62c-31d2-a6c3-5316-aa39f47c49fc Microsoft.OffAzure/VMwareSites/machines - ``` Get a server in a migrate project by name. @@ -97,7 +96,6 @@ idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_5029c9aa-3c idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_5029dabc-cc94-780f-76fd-e39acb0e9dce Microsoft.OffAzure/VMwareSites/machines idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_50299579-fc18-4152-ade2-c4a57946f72b Microsoft.OffAzure/VMwareSites/machines idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_5029cc18-efdc-7315-3b09-9d12a0f337e2 Microsoft.OffAzure/VMwareSites/machines - ``` List all servers for an appliance in a project. @@ -111,7 +109,6 @@ Get-AzMigrateDiscoveredServer -Name idclab-a360-fareast-corp-micros-86617dcf-eff Name Typeo… ---- ----o… idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_5029e62c-31d2-a6c3-5316-aa39f47c49fc Microsoft.OffAzure/VMwareSites/machines - ``` Get a server for an appliance in a project. @@ -132,7 +129,6 @@ ContosoAppSrv2 10-150-8-52-b090bef3-b733-5e34-bc8f-eb6f2701432a_5 ContosoCSASR 10-150-8-52-b090bef3-b733-5e34-bc8f-eb6f2701432a_50096b80-7061-672c-8db0-07ee41212869 Microsoft.OffAzure/VMwareSites/machines ContosoVMwareMigration2 10-150-8-52-b090bef3-b733-5e34-bc8f-eb6f2701432a_50099d31-71d5-2bd1-fada-8c4eba2f279a Microsoft.OffAzure/VMwareSites/machines ContosoAppSrv1 10-150-8-52-b090bef3-b733-5e34-bc8f-eb6f2701432a_50097d3f-c1f6-9217-825c-936db54043df Microsoft.OffAzure/VMwareSites/machines - ``` List servers in a migrate project and filter responses with display name. @@ -165,7 +161,7 @@ This internally maps to a site. ```yaml Type: System.String -Parameter Sets: GetInSite, ListInSite +Parameter Sets: ListInSite, GetInSite Aliases: Required: True @@ -237,6 +233,22 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -SourceMachineType +Specifies the source machine type. +Currently, only HyperV and VMware are supported. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -SubscriptionId Specifies the subscription id. @@ -297,4 +309,3 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ALIASES ## RELATED LINKS - diff --git a/src/Migrate/Migrate/help/Get-AzMigrateHCIJob.md b/src/Migrate/Migrate/help/Get-AzMigrateHCIJob.md new file mode 100644 index 000000000000..04e23d70ef8f --- /dev/null +++ b/src/Migrate/Migrate/help/Get-AzMigrateHCIJob.md @@ -0,0 +1,282 @@ +--- +external help file: Az.Migrate-help.xml +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratehcijob +schema: 2.0.0 +--- + +# Get-AzMigrateHCIJob + +## SYNOPSIS +Retrieves the status of an Azure Migrate job. + +## SYNTAX + +### ListByName (Default) +``` +Get-AzMigrateHCIJob -ResourceGroupName -ProjectName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### GetByName +``` +Get-AzMigrateHCIJob -ResourceGroupName -ProjectName [-SubscriptionId ] -Name + [-DefaultProfile ] [] +``` + +### GetById +``` +Get-AzMigrateHCIJob [-SubscriptionId ] -ID [-DefaultProfile ] [] +``` + +### GetByInputObject +``` +Get-AzMigrateHCIJob [-SubscriptionId ] -InputObject [-DefaultProfile ] + [] +``` + +### ListById +``` +Get-AzMigrateHCIJob [-SubscriptionId ] -ResourceGroupID -ProjectID + [-DefaultProfile ] [] +``` + +## DESCRIPTION +The Get-AzMigrateHCIJob cmdlet retrives the status of an Azure Migrate job. + +## EXAMPLES + +### EXAMPLE 1 +``` +Get-AzMigrateHCIJob -ID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/jobs/0203aa1b-1dff-4653-89a9-b90a76d1601a" +``` + +### EXAMPLE 2 +``` +Get-AzMigrateHCIJob -ResourceGroupName "test-rg" -ProjectName "testproj" -Name "0203aa1b-1dff-4653-89a9-b90a76d1601a" +``` + +### EXAMPLE 3 +``` +$InputObject = Get-AzMigrateHCIJob -ID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/jobs/0203aa1b-1dff-4653-89a9-b90a76d1601a" +``` + +Get-AzMigrateHCIJob -InputObject $InputObject + +$InputObject | Get-AzMigrateHCIJob + +### EXAMPLE 4 +``` +Get-AzMigrateHCIJob -ResourceGroupID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg" -ProjectID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.Migrate/MigrateProjects/testproj" +``` + +### EXAMPLE 5 +``` +Get-AzMigrateHCIJob -ResourceGroupName "test-rg" -ProjectName "testproj" +``` + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ID +Specifies the job id for which the details needs to be retrieved. + +```yaml +Type: String +Parameter Sets: GetById +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Specifies the job object of the replicating server. +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: IMigrateIdentity +Parameter Sets: GetByInputObject +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +Job identifier + +```yaml +Type: String +Parameter Sets: GetByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProjectID +Specifies the Azure Migrate Project in which servers are replicating. + +```yaml +Type: String +Parameter Sets: ListById +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProjectName +The name of the migrate project. + +```yaml +Type: String +Parameter Sets: ListByName, GetByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupID +Specifies the Resource Group of the Azure Migrate Project in the current subscription. + +```yaml +Type: String +Parameter Sets: ListById +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: String +Parameter Sets: ListByName, GetByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure Subscription ID. + +```yaml +Type: String +Parameter Sets: (All) +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.Migrate.Models.IMigrateIdentity +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel +## 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 \: Specifies the job object of the replicating server. + \[AccountName \\]: Run as account ARM name. + \[AlertSettingName \\]: The name of the email notification configuration. + \[ClusterName \\]: Cluster ARM name. + \[DatabaseInstanceName \\]: Unique name of a database instance in Azure migration hub. + \[DatabaseName \\]: Unique name of a database in Azure migration hub. + \[DeploymentId \\]: Deployment Id. + \[EmailConfigurationName \\]: The email configuration name. + \[EventName \\]: Unique name of an event within a migrate project. + \[FabricAgentName \\]: The fabric agent (Dra) name. + \[FabricName \\]: Fabric name. + \[HostName \\]: Host ARM name. + \[Id \\]: Resource identity path + \[IntentObjectName \\]: Replication protection intent name. + \[JobName \\]: Job ARM name. + \[Location \\]: The name of the Azure region. + \[LogicalNetworkName \\]: Logical network name. + \[MachineName \\]: Machine ARM name. + \[MappingName \\]: Protection Container mapping name. + \[MigrateProjectName \\]: Name of the Azure Migrate project. + \[MigrationItemName \\]: Migration item name. + \[MigrationRecoveryPointName \\]: The migration recovery point name. + \[NetworkMappingName \\]: Network mapping name. + \[NetworkName \\]: Primary network name. + \[OperationId \\]: The ID of an ongoing async operation. + \[OperationStatusName \\]: Operation status ARM name. + \[PolicyName \\]: Replication policy name. + \[ProtectableItemName \\]: Protectable item name. + \[ProtectedItemName \\]: The protected item name. + \[ProtectionContainerName \\]: Protection container name. + \[ProviderName \\]: Recovery services provider name. + \[RecoveryPlanName \\]: Name of the recovery plan. + \[RecoveryPointName \\]: The recovery point name. + \[ReplicatedProtectedItemName \\]: Replication protected item name. + \[ReplicationExtensionName \\]: The replication extension name. + \[ResourceGroupName \\]: The name of the resource group. +The name is case insensitive. + \[ResourceName \\]: The name of the recovery services vault. + \[SiteName \\]: Site name. + \[SolutionName \\]: Unique name of a migration solution within a migrate project. + \[StorageClassificationMappingName \\]: Storage classification mapping name. + \[StorageClassificationName \\]: Storage classification name. + \[SubscriptionId \\]: The ID of the target subscription. + \[VaultName \\]: The vault name. + \[VaultSettingName \\]: Vault setting name. + \[VcenterName \\]: VCenter ARM name. + \[VirtualMachineName \\]: Virtual Machine name. + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratehcijob](https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratehcijob) + diff --git a/src/Migrate/Migrate/help/Get-AzMigrateHCIReplicationFabric.md b/src/Migrate/Migrate/help/Get-AzMigrateHCIReplicationFabric.md new file mode 100644 index 000000000000..a8a1e8d60628 --- /dev/null +++ b/src/Migrate/Migrate/help/Get-AzMigrateHCIReplicationFabric.md @@ -0,0 +1,229 @@ +--- +external help file: Az.Migrate-help.xml +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratehcireplicationfabric +schema: 2.0.0 +--- + +# Get-AzMigrateHCIReplicationFabric + +## SYNOPSIS +Gets the details of the fabric. + +## SYNTAX + +### List (Default) +``` +Get-AzMigrateHCIReplicationFabric [-SubscriptionId ] [-ContinuationToken ] + [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzMigrateHCIReplicationFabric -Name -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### List1 +``` +Get-AzMigrateHCIReplicationFabric -ResourceGroupName [-SubscriptionId ] + [-ContinuationToken ] [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzMigrateHCIReplicationFabric -InputObject [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Gets the details of the fabric. + +## EXAMPLES + +### EXAMPLE 1 +``` +Get-AzMigrateHCIReplicationFabric -ResourceGroupName "test-rg" -Name "testsrcappreplicationfabric" +``` + +### EXAMPLE 2 +``` +$InputObject = Get-AzMigrateHCIReplicationFabric -ResourceGroupName "test-rg" -Name "testsrcappreplicationfabric" +``` + +Get-AzMigrateHCIReplicationFabric -InputObject $InputObject + +$InputObject | Get-AzMigrateHCIReplicationFabric + +### EXAMPLE 3 +``` +Get-AzMigrateHCIReplicationFabric -ResourceGroupName "test-rg" +``` + +### EXAMPLE 4 +``` +Get-AzMigrateHCIReplicationFabric +``` + +## PARAMETERS + +### -ContinuationToken +Continuation token from the previous call. + +```yaml +Type: String +Parameter Sets: List, List1 +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: 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: IMigrateIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +The fabric name. + +```yaml +Type: String +Parameter Sets: Get +Aliases: FabricName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: String +Parameter Sets: Get, List1 +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure Subscription Id in which migrate project was created. + +```yaml +Type: String[] +Parameter Sets: List, Get, 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.Migrate.Models.IMigrateIdentity +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IFabricModel +## 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 + \[AccountName \\]: Run as account ARM name. + \[AlertSettingName \\]: The name of the email notification configuration. + \[ClusterName \\]: Cluster ARM name. + \[DatabaseInstanceName \\]: Unique name of a database instance in Azure migration hub. + \[DatabaseName \\]: Unique name of a database in Azure migration hub. + \[DeploymentId \\]: Deployment Id. + \[EmailConfigurationName \\]: The email configuration name. + \[EventName \\]: Unique name of an event within a migrate project. + \[FabricAgentName \\]: The fabric agent (Dra) name. + \[FabricName \\]: Fabric name. + \[HostName \\]: Host ARM name. + \[Id \\]: Resource identity path + \[IntentObjectName \\]: Replication protection intent name. + \[JobName \\]: Job ARM name. + \[Location \\]: The name of the Azure region. + \[LogicalNetworkName \\]: Logical network name. + \[MachineName \\]: Machine ARM name. + \[MappingName \\]: Protection Container mapping name. + \[MigrateProjectName \\]: Name of the Azure Migrate project. + \[MigrationItemName \\]: Migration item name. + \[MigrationRecoveryPointName \\]: The migration recovery point name. + \[NetworkMappingName \\]: Network mapping name. + \[NetworkName \\]: Primary network name. + \[OperationId \\]: The ID of an ongoing async operation. + \[OperationStatusName \\]: Operation status ARM name. + \[PolicyName \\]: Replication policy name. + \[ProtectableItemName \\]: Protectable item name. + \[ProtectedItemName \\]: The protected item name. + \[ProtectionContainerName \\]: Protection container name. + \[ProviderName \\]: Recovery services provider name. + \[RecoveryPlanName \\]: Name of the recovery plan. + \[RecoveryPointName \\]: The recovery point name. + \[ReplicatedProtectedItemName \\]: Replication protected item name. + \[ReplicationExtensionName \\]: The replication extension name. + \[ResourceGroupName \\]: The name of the resource group. +The name is case insensitive. + \[ResourceName \\]: The name of the recovery services vault. + \[SiteName \\]: Site name. + \[SolutionName \\]: Unique name of a migration solution within a migrate project. + \[StorageClassificationMappingName \\]: Storage classification mapping name. + \[StorageClassificationName \\]: Storage classification name. + \[SubscriptionId \\]: The ID of the target subscription. + \[VaultName \\]: The vault name. + \[VaultSettingName \\]: Vault setting name. + \[VcenterName \\]: VCenter ARM name. + \[VirtualMachineName \\]: Virtual Machine name. + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratehcireplicationfabric](https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratehcireplicationfabric) + diff --git a/src/Migrate/Migrate/help/Get-AzMigrateHCIServerReplication.md b/src/Migrate/Migrate/help/Get-AzMigrateHCIServerReplication.md new file mode 100644 index 000000000000..e06ef22f412b --- /dev/null +++ b/src/Migrate/Migrate/help/Get-AzMigrateHCIServerReplication.md @@ -0,0 +1,290 @@ +--- +external help file: Az.Migrate-help.xml +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratehciserverreplication +schema: 2.0.0 +--- + +# Get-AzMigrateHCIServerReplication + +## SYNOPSIS +Retrieves the details of the replicating server. + +## SYNTAX + +### ListByName (Default) +``` +Get-AzMigrateHCIServerReplication -ResourceGroupName -ProjectName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### GetByMachineName +``` +Get-AzMigrateHCIServerReplication -ResourceGroupName -ProjectName [-SubscriptionId ] + -MachineName [-DefaultProfile ] [] +``` + +### GetByItemID +``` +Get-AzMigrateHCIServerReplication [-SubscriptionId ] -TargetObjectID + [-DefaultProfile ] [] +``` + +### GetBySDSID +``` +Get-AzMigrateHCIServerReplication [-SubscriptionId ] -DiscoveredMachineId + [-DefaultProfile ] [] +``` + +### GetByInputObject +``` +Get-AzMigrateHCIServerReplication [-SubscriptionId ] -InputObject + [-DefaultProfile ] [] +``` + +### ListById +``` +Get-AzMigrateHCIServerReplication [-SubscriptionId ] -ResourceGroupID -ProjectID + [-DefaultProfile ] [] +``` + +## DESCRIPTION +The Get-AzMigrateHCIServerReplication cmdlet retrieves the object for the replicating server. + +## EXAMPLES + +### EXAMPLE 1 +``` +Get-AzMigrateHCIServerReplication -TargetObjectID '/subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/protectedItems/503a4f02-916c-d6b0-8d14-222bbd4767e5' +``` + +### EXAMPLE 2 +``` +Get-AzMigrateHCIServerReplication -DiscoveredMachineId "/subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.OffAzure/HyperVSites/siteName1/machines/503a4f02-916c-d6b0-8d14-222bbd4767e5" +``` + +### EXAMPLE 3 +``` +Get-AzMigrateServerReplication -ResourceGroupName testResourceGroup -ProjectName testProjectName +``` + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DiscoveredMachineId +Specifies the machine ID of the discovered server. + +```yaml +Type: String +Parameter Sets: GetBySDSID +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Specifies the machine object of the replicating server. +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: IMigrateIdentity +Parameter Sets: GetByInputObject +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -MachineName +Specifies the display name of the replicating machine. + +```yaml +Type: String +Parameter Sets: GetByMachineName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProjectID +Specifies the Azure Migrate Project in which servers are replicating. + +```yaml +Type: String +Parameter Sets: ListById +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProjectName +Specifies the Azure Migrate project in the current subscription. + +```yaml +Type: String +Parameter Sets: ListByName, GetByMachineName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupID +Specifies the Resource Group of the Azure Migrate Project in the current subscription. + +```yaml +Type: String +Parameter Sets: ListById +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +Specifies the Resource Group of the Azure Migrate Project in the current subscription. + +```yaml +Type: String +Parameter Sets: ListByName, GetByMachineName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure Subscription ID. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetObjectID +Specifies the replicating server ARM ID. + +```yaml +Type: String +Parameter Sets: GetByItemID +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.Migrate.Models.IMigrateIdentity +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IProtectedItemModel +## 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 \: Specifies the machine object of the replicating server. + \[AccountName \\]: Run as account ARM name. + \[AlertSettingName \\]: The name of the email notification configuration. + \[ClusterName \\]: Cluster ARM name. + \[DatabaseInstanceName \\]: Unique name of a database instance in Azure migration hub. + \[DatabaseName \\]: Unique name of a database in Azure migration hub. + \[DeploymentId \\]: Deployment Id. + \[EmailConfigurationName \\]: The email configuration name. + \[EventName \\]: Unique name of an event within a migrate project. + \[FabricAgentName \\]: The fabric agent (Dra) name. + \[FabricName \\]: Fabric name. + \[HostName \\]: Host ARM name. + \[Id \\]: Resource identity path + \[IntentObjectName \\]: Replication protection intent name. + \[JobName \\]: Job ARM name. + \[Location \\]: The name of the Azure region. + \[LogicalNetworkName \\]: Logical network name. + \[MachineName \\]: Machine ARM name. + \[MappingName \\]: Protection Container mapping name. + \[MigrateProjectName \\]: Name of the Azure Migrate project. + \[MigrationItemName \\]: Migration item name. + \[MigrationRecoveryPointName \\]: The migration recovery point name. + \[NetworkMappingName \\]: Network mapping name. + \[NetworkName \\]: Primary network name. + \[OperationId \\]: The ID of an ongoing async operation. + \[OperationStatusName \\]: Operation status ARM name. + \[PolicyName \\]: Replication policy name. + \[ProtectableItemName \\]: Protectable item name. + \[ProtectedItemName \\]: The protected item name. + \[ProtectionContainerName \\]: Protection container name. + \[ProviderName \\]: Recovery services provider name. + \[RecoveryPlanName \\]: Name of the recovery plan. + \[RecoveryPointName \\]: The recovery point name. + \[ReplicatedProtectedItemName \\]: Replication protected item name. + \[ReplicationExtensionName \\]: The replication extension name. + \[ResourceGroupName \\]: The name of the resource group. +The name is case insensitive. + \[ResourceName \\]: The name of the recovery services vault. + \[SiteName \\]: Site name. + \[SolutionName \\]: Unique name of a migration solution within a migrate project. + \[StorageClassificationMappingName \\]: Storage classification mapping name. + \[StorageClassificationName \\]: Storage classification name. + \[SubscriptionId \\]: The ID of the target subscription. + \[VaultName \\]: The vault name. + \[VaultSettingName \\]: Vault setting name. + \[VcenterName \\]: VCenter ARM name. + \[VirtualMachineName \\]: Virtual Machine name. + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratehciserverreplication](https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratehciserverreplication) + diff --git a/src/Migrate/Migrate/help/Get-AzMigrateJob.md b/src/Migrate/Migrate/help/Get-AzMigrateJob.md index 2fc62cb4d429..8a3cb2ab37ba 100644 --- a/src/Migrate/Migrate/help/Get-AzMigrateJob.md +++ b/src/Migrate/Migrate/help/Get-AzMigrateJob.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Migrate-help.xml Module Name: Az.Migrate online version: https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratejob schema: 2.0.0 @@ -14,30 +14,30 @@ Retrieves the status of an Azure Migrate job. ### ListByName (Default) ``` -Get-AzMigrateJob -ProjectName -ResourceGroupName [-SubscriptionId ] +Get-AzMigrateJob -ResourceGroupName -ProjectName [-SubscriptionId ] [-Filter ] [-DefaultProfile ] [] ``` -### GetById +### GetByName ``` -Get-AzMigrateJob -JobID [-SubscriptionId ] [-DefaultProfile ] [] +Get-AzMigrateJob -ResourceGroupName -ProjectName [-SubscriptionId ] -JobName + [-DefaultProfile ] [] ``` -### GetByInputObject +### GetById ``` -Get-AzMigrateJob -InputObject [-SubscriptionId ] [-DefaultProfile ] - [] +Get-AzMigrateJob [-SubscriptionId ] -JobID [-DefaultProfile ] [] ``` -### GetByName +### GetByInputObject ``` -Get-AzMigrateJob -JobName -ProjectName -ResourceGroupName - [-SubscriptionId ] [-DefaultProfile ] [] +Get-AzMigrateJob [-SubscriptionId ] -InputObject [-DefaultProfile ] + [] ``` ### ListById ``` -Get-AzMigrateJob -ProjectID -ResourceGroupID [-SubscriptionId ] [-Filter ] +Get-AzMigrateJob [-SubscriptionId ] -ResourceGroupID -ProjectID [-Filter ] [-DefaultProfile ] [] ``` @@ -48,7 +48,7 @@ The Get-AzMigrateJob cmdlet retrives the status of an Azure Migrate job. ### Example 1: Get By Job Id ```powershell -Get-AzMigrateJob -JobID "/Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.RecoveryServices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationJobs/997e2a92-5afe-49c7-a81a-89660aec9b7b" +Get-AzMigrateJob -JobID "/Subscriptions/xxx-xxx-xxx/resourceGroups/azmigratepwshtestasr13072020/providers/Microsoft.RecoveryServices/vaults/AzMigrateTestProjectPWSH02aarsvault/replicationJobs/997e2a92-5afe-49c7-a81a-89660aec9b7b" ``` ```output @@ -158,7 +158,7 @@ OData filter options. ```yaml Type: System.String -Parameter Sets: ListById, ListByName +Parameter Sets: ListByName, ListById Aliases: Required: False @@ -234,7 +234,7 @@ The name of the migrate project. ```yaml Type: System.String -Parameter Sets: GetByName, ListByName +Parameter Sets: ListByName, GetByName Aliases: Required: True @@ -264,7 +264,7 @@ The name of the resource group where the recovery services vault is present. ```yaml Type: System.String -Parameter Sets: GetByName, ListByName +Parameter Sets: ListByName, GetByName Aliases: Required: True @@ -353,4 +353,3 @@ To create the parameters described below, construct a hash table containing the - `[TaskType ]`: The type of task. Details in CustomDetails property depend on this type. ## RELATED LINKS - diff --git a/src/Migrate/Migrate/help/Get-AzMigrateProject.md b/src/Migrate/Migrate/help/Get-AzMigrateProject.md index 2ebe29c426c9..1d71a02c2d43 100644 --- a/src/Migrate/Migrate/help/Get-AzMigrateProject.md +++ b/src/Migrate/Migrate/help/Get-AzMigrateProject.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Migrate-help.xml Module Name: Az.Migrate online version: https://learn.microsoft.com/powershell/module/az.migrate/get-azmigrateproject schema: 2.0.0 @@ -112,4 +112,3 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ALIASES ## RELATED LINKS - diff --git a/src/Migrate/Migrate/help/Get-AzMigrateReplicationFabric.md b/src/Migrate/Migrate/help/Get-AzMigrateReplicationFabric.md index 70cc1712f6c0..71da94f4d4fd 100644 --- a/src/Migrate/Migrate/help/Get-AzMigrateReplicationFabric.md +++ b/src/Migrate/Migrate/help/Get-AzMigrateReplicationFabric.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Migrate-help.xml Module Name: Az.Migrate online version: https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratereplicationfabric schema: 2.0.0 @@ -20,7 +20,7 @@ Get-AzMigrateReplicationFabric -ResourceGroupName -ResourceName -ResourceGroupName -ResourceName +Get-AzMigrateReplicationFabric -ResourceGroupName -ResourceName -FabricName [-SubscriptionId ] [-Filter ] [-DefaultProfile ] [] ``` @@ -192,4 +192,3 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ALIASES ## RELATED LINKS - diff --git a/src/Migrate/Migrate/help/Get-AzMigrateReplicationPolicy.md b/src/Migrate/Migrate/help/Get-AzMigrateReplicationPolicy.md index 3f1cbeb300e0..c8a0ea653ed8 100644 --- a/src/Migrate/Migrate/help/Get-AzMigrateReplicationPolicy.md +++ b/src/Migrate/Migrate/help/Get-AzMigrateReplicationPolicy.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Migrate-help.xml Module Name: Az.Migrate online version: https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratereplicationpolicy schema: 2.0.0 @@ -20,7 +20,7 @@ Get-AzMigrateReplicationPolicy -ResourceGroupName -ResourceName -ResourceGroupName -ResourceName +Get-AzMigrateReplicationPolicy -ResourceGroupName -ResourceName -PolicyName [-SubscriptionId ] [-DefaultProfile ] [] ``` @@ -150,4 +150,3 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ALIASES ## RELATED LINKS - diff --git a/src/Migrate/Migrate/help/Get-AzMigrateReplicationProtectionContainer.md b/src/Migrate/Migrate/help/Get-AzMigrateReplicationProtectionContainer.md index 5de5893871cd..b860ed34df9d 100644 --- a/src/Migrate/Migrate/help/Get-AzMigrateReplicationProtectionContainer.md +++ b/src/Migrate/Migrate/help/Get-AzMigrateReplicationProtectionContainer.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Migrate-help.xml Module Name: Az.Migrate online version: https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratereplicationprotectioncontainer schema: 2.0.0 @@ -18,17 +18,17 @@ Get-AzMigrateReplicationProtectionContainer -ResourceGroupName -Resourc [-SubscriptionId ] [-DefaultProfile ] [] ``` -### Get +### List ``` -Get-AzMigrateReplicationProtectionContainer -FabricName -ProtectionContainerName - -ResourceGroupName -ResourceName [-SubscriptionId ] [-DefaultProfile ] - [] +Get-AzMigrateReplicationProtectionContainer -ResourceGroupName -ResourceName + -FabricName [-SubscriptionId ] [-DefaultProfile ] [] ``` -### List +### Get ``` -Get-AzMigrateReplicationProtectionContainer -FabricName -ResourceGroupName - -ResourceName [-SubscriptionId ] [-DefaultProfile ] [] +Get-AzMigrateReplicationProtectionContainer -ResourceGroupName -ResourceName + -FabricName -ProtectionContainerName [-SubscriptionId ] + [-DefaultProfile ] [] ``` ## DESCRIPTION @@ -85,7 +85,7 @@ Fabric name. ```yaml Type: System.String -Parameter Sets: Get, List +Parameter Sets: List, Get Aliases: Required: True @@ -169,4 +169,3 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ALIASES ## RELATED LINKS - diff --git a/src/Migrate/Migrate/help/Get-AzMigrateReplicationProtectionContainerMapping.md b/src/Migrate/Migrate/help/Get-AzMigrateReplicationProtectionContainerMapping.md index 014134790d83..e7e147ebf95c 100644 --- a/src/Migrate/Migrate/help/Get-AzMigrateReplicationProtectionContainerMapping.md +++ b/src/Migrate/Migrate/help/Get-AzMigrateReplicationProtectionContainerMapping.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Migrate-help.xml Module Name: Az.Migrate online version: https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratereplicationprotectioncontainermapping schema: 2.0.0 @@ -18,18 +18,18 @@ Get-AzMigrateReplicationProtectionContainerMapping -ResourceGroupName - [-SubscriptionId ] [-DefaultProfile ] [] ``` -### Get +### List ``` -Get-AzMigrateReplicationProtectionContainerMapping -FabricName -MappingName - -ProtectionContainerName -ResourceGroupName -ResourceName - [-SubscriptionId ] [-DefaultProfile ] [] +Get-AzMigrateReplicationProtectionContainerMapping -ResourceGroupName -ResourceName + -FabricName -ProtectionContainerName [-SubscriptionId ] + [-DefaultProfile ] [] ``` -### List +### Get ``` -Get-AzMigrateReplicationProtectionContainerMapping -FabricName -ProtectionContainerName - -ResourceGroupName -ResourceName [-SubscriptionId ] [-DefaultProfile ] - [] +Get-AzMigrateReplicationProtectionContainerMapping -ResourceGroupName -ResourceName + -FabricName -MappingName -ProtectionContainerName [-SubscriptionId ] + [-DefaultProfile ] [] ``` ## DESCRIPTION @@ -73,7 +73,7 @@ Fabric name. ```yaml Type: System.String -Parameter Sets: Get, List +Parameter Sets: List, Get Aliases: Required: True @@ -103,7 +103,7 @@ Protection container name. ```yaml Type: System.String -Parameter Sets: Get, List +Parameter Sets: List, Get Aliases: Required: True @@ -172,4 +172,3 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ALIASES ## RELATED LINKS - diff --git a/src/Migrate/Migrate/help/Get-AzMigrateReplicationRecoveryServicesProvider.md b/src/Migrate/Migrate/help/Get-AzMigrateReplicationRecoveryServicesProvider.md index d4d1181355a0..627491612ab9 100644 --- a/src/Migrate/Migrate/help/Get-AzMigrateReplicationRecoveryServicesProvider.md +++ b/src/Migrate/Migrate/help/Get-AzMigrateReplicationRecoveryServicesProvider.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Migrate-help.xml Module Name: Az.Migrate online version: https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratereplicationrecoveryservicesprovider schema: 2.0.0 @@ -20,8 +20,8 @@ Get-AzMigrateReplicationRecoveryServicesProvider -ResourceGroupName -Re ### Get ``` -Get-AzMigrateReplicationRecoveryServicesProvider -FabricName -ProviderName - -ResourceGroupName -ResourceName [-SubscriptionId ] [-DefaultProfile ] +Get-AzMigrateReplicationRecoveryServicesProvider -ResourceGroupName -ResourceName + -FabricName -ProviderName [-SubscriptionId ] [-DefaultProfile ] [] ``` @@ -150,4 +150,3 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ALIASES ## RELATED LINKS - diff --git a/src/Migrate/Migrate/help/Get-AzMigrateRunAsAccount.md b/src/Migrate/Migrate/help/Get-AzMigrateRunAsAccount.md index e4738cd5aaeb..78c1e051db1d 100644 --- a/src/Migrate/Migrate/help/Get-AzMigrateRunAsAccount.md +++ b/src/Migrate/Migrate/help/Get-AzMigrateRunAsAccount.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Migrate-help.xml Module Name: Az.Migrate online version: https://learn.microsoft.com/powershell/module/az.migrate/get-azmigraterunasaccount schema: 2.0.0 @@ -20,7 +20,7 @@ Get-AzMigrateRunAsAccount -ResourceGroupName -SiteName [-Subsc ### Get ``` -Get-AzMigrateRunAsAccount -AccountName -ResourceGroupName -SiteName +Get-AzMigrateRunAsAccount -ResourceGroupName -SiteName -AccountName [-SubscriptionId ] [-DefaultProfile ] [] ``` @@ -148,4 +148,3 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ALIASES ## RELATED LINKS - diff --git a/src/Migrate/Migrate/help/Get-AzMigrateServerReplication.md b/src/Migrate/Migrate/help/Get-AzMigrateServerReplication.md index 58c86d874ce4..b3d610919717 100644 --- a/src/Migrate/Migrate/help/Get-AzMigrateServerReplication.md +++ b/src/Migrate/Migrate/help/Get-AzMigrateServerReplication.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Migrate-help.xml Module Name: Az.Migrate online version: https://learn.microsoft.com/powershell/module/az.migrate/get-azmigrateserverreplication schema: 2.0.0 @@ -14,37 +14,37 @@ Retrieves the details of the replicating server. ### ListByName (Default) ``` -Get-AzMigrateServerReplication -ProjectName -ResourceGroupName [-SubscriptionId ] +Get-AzMigrateServerReplication -ResourceGroupName -ProjectName [-SubscriptionId ] [-Filter ] [-SkipToken ] [-DefaultProfile ] [] ``` -### GetByInputObject +### GetByMachineName ``` -Get-AzMigrateServerReplication -InputObject [-SubscriptionId ] - [-DefaultProfile ] [] +Get-AzMigrateServerReplication -ResourceGroupName -ProjectName [-SubscriptionId ] + -MachineName [-DefaultProfile ] [] ``` -### GetByMachineName +### GetBySRSID ``` -Get-AzMigrateServerReplication -MachineName -ProjectName -ResourceGroupName - [-SubscriptionId ] [-DefaultProfile ] [] +Get-AzMigrateServerReplication [-SubscriptionId ] -TargetObjectID [-DefaultProfile ] + [] ``` ### GetBySDSID ``` -Get-AzMigrateServerReplication -DiscoveredMachineId [-SubscriptionId ] +Get-AzMigrateServerReplication [-SubscriptionId ] -DiscoveredMachineId [-DefaultProfile ] [] ``` -### GetBySRSID +### GetByInputObject ``` -Get-AzMigrateServerReplication -TargetObjectID [-SubscriptionId ] +Get-AzMigrateServerReplication [-SubscriptionId ] -InputObject [-DefaultProfile ] [] ``` ### ListById ``` -Get-AzMigrateServerReplication -ProjectID -ResourceGroupID [-SubscriptionId ] +Get-AzMigrateServerReplication [-SubscriptionId ] -ResourceGroupID -ProjectID [-Filter ] [-SkipToken ] [-DefaultProfile ] [] ``` @@ -252,7 +252,7 @@ OData filter options. ```yaml Type: System.String -Parameter Sets: ListById, ListByName +Parameter Sets: ListByName, ListById Aliases: Required: False @@ -313,7 +313,7 @@ Specifies the Azure Migrate project in the current subscription. ```yaml Type: System.String -Parameter Sets: GetByMachineName, ListByName +Parameter Sets: ListByName, GetByMachineName Aliases: Required: True @@ -343,7 +343,7 @@ Specifies the Resource Group of the Azure Migrate Project in the current subscri ```yaml Type: System.String -Parameter Sets: GetByMachineName, ListByName +Parameter Sets: ListByName, GetByMachineName Aliases: Required: True @@ -358,7 +358,7 @@ The pagination token. ```yaml Type: System.String -Parameter Sets: ListById, ListByName +Parameter Sets: ListByName, ListById Aliases: Required: False @@ -422,4 +422,3 @@ To create the parameters described below, construct a hash table containing the - `InstanceType `: Gets the instance type. ## RELATED LINKS - diff --git a/src/Migrate/Migrate/help/Get-AzMigrateSite.md b/src/Migrate/Migrate/help/Get-AzMigrateSite.md index be4c7512d304..0040f9f90d58 100644 --- a/src/Migrate/Migrate/help/Get-AzMigrateSite.md +++ b/src/Migrate/Migrate/help/Get-AzMigrateSite.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Migrate-help.xml Module Name: Az.Migrate online version: https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratesite schema: 2.0.0 @@ -31,7 +31,6 @@ Get-AzMigrateSite -SubscriptionId xxx-xxx-xxx -ResourceGroupName BugBashAVSVMwar ETag Location Name Type ---- -------- ---- ---- southeastasia BBVMwareAVScbbcsite Microsoft.OffAzure/VMwareSites - ``` Get site by name @@ -114,4 +113,3 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ALIASES ## RELATED LINKS - diff --git a/src/Migrate/Migrate/help/Get-AzMigrateSolution.md b/src/Migrate/Migrate/help/Get-AzMigrateSolution.md index a81abfa8b9d6..fe2c742be846 100644 --- a/src/Migrate/Migrate/help/Get-AzMigrateSolution.md +++ b/src/Migrate/Migrate/help/Get-AzMigrateSolution.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Migrate-help.xml Module Name: Az.Migrate online version: https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratesolution schema: 2.0.0 @@ -127,4 +127,3 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ALIASES ## RELATED LINKS - diff --git a/src/Migrate/Migrate/help/Initialize-AzMigrateHCIReplicationInfrastructure.md b/src/Migrate/Migrate/help/Initialize-AzMigrateHCIReplicationInfrastructure.md new file mode 100644 index 000000000000..ec410e72d475 --- /dev/null +++ b/src/Migrate/Migrate/help/Initialize-AzMigrateHCIReplicationInfrastructure.md @@ -0,0 +1,204 @@ +--- +external help file: Az.Migrate-help.xml +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/initialize-azmigratehcireplicationinfrastructure +schema: 2.0.0 +--- + +# Initialize-AzMigrateHCIReplicationInfrastructure + +## SYNOPSIS +Initializes the infrastructure for the migrate project. + +## SYNTAX + +``` +Initialize-AzMigrateHCIReplicationInfrastructure -ResourceGroupName -ProjectName + -SourceApplianceName -TargetApplianceName [-CacheStorageAccountId ] + [-SubscriptionId ] [-DefaultProfile ] [-PassThru] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +The Initialize-AzMigrateHCIReplicationInfrastructure cmdlet initializes the infrastructure for the migrate project in AzStackHCI scenario. + +## EXAMPLES + +### EXAMPLE 1 +``` +Initialize-AzMigrateHCIReplicationInfrastructure -ProjectName "testproj" -ResourceGroupName "test-rg" -SourceApplianceName "testsrcapp" -TargetApplianceName "testtgtapp" -PassThru:$true +``` + +### EXAMPLE 2 +``` +$cacheStorageAccountId = "/subscriptions/xxx-xxx-xxxx/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/testSa" +``` + +Initialize-AzMigrateHCIReplicationInfrastructure -ProjectName "testproj" -ResourceGroupName "test-rg" -CacheStorageAccountId $cacheStorageAccountId -SourceApplianceName "testsrcapp" -TargetApplianceName "testtgtapp" -PassThru:$true + +## PARAMETERS + +### -CacheStorageAccountId +Specifies the Storage Account ARM Id to be used for private endpoint scenario. + +```yaml +Type: 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: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProjectName +Specifies the name of the Azure Migrate project to be used for server migration. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +Specifies the Resource Group of the Azure Migrate Project in the current subscription. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SourceApplianceName +Specifies the source appliance name for the AzStackHCI scenario. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure Subscription ID. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetApplianceName +Specifies the target appliance name for the AzStackHCI scenario. + +```yaml +Type: 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: 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: 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 + +### System.Boolean +## NOTES + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.migrate/initialize-azmigratehcireplicationinfrastructure](https://learn.microsoft.com/powershell/module/az.migrate/initialize-azmigratehcireplicationinfrastructure) + diff --git a/src/Migrate/Migrate/help/Initialize-AzMigrateReplicationInfrastructure.md b/src/Migrate/Migrate/help/Initialize-AzMigrateReplicationInfrastructure.md index 63ef1bad85e7..aee9505b9a89 100644 --- a/src/Migrate/Migrate/help/Initialize-AzMigrateReplicationInfrastructure.md +++ b/src/Migrate/Migrate/help/Initialize-AzMigrateReplicationInfrastructure.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Migrate-help.xml Module Name: Az.Migrate online version: https://learn.microsoft.com/powershell/module/az.migrate/initialize-azmigratereplicationinfrastructure schema: 2.0.0 @@ -13,9 +13,9 @@ Initialises the infrastructure for the migrate project. ## SYNTAX ``` -Initialize-AzMigrateReplicationInfrastructure -ProjectName -ResourceGroupName +Initialize-AzMigrateReplicationInfrastructure -ResourceGroupName -ProjectName -Scenario -TargetRegion [-CacheStorageAccountId ] [-SubscriptionId ] - [-DefaultProfile ] [-Confirm] [-WhatIf] [] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -197,4 +197,3 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ALIASES ## RELATED LINKS - diff --git a/src/Migrate/Migrate/help/New-AzMigrateDiskMapping.md b/src/Migrate/Migrate/help/New-AzMigrateDiskMapping.md index 17a1669f5cfd..32c7457d13e8 100644 --- a/src/Migrate/Migrate/help/New-AzMigrateDiskMapping.md +++ b/src/Migrate/Migrate/help/New-AzMigrateDiskMapping.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Migrate-help.xml Module Name: Az.Migrate online version: https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratediskmapping schema: 2.0.0 @@ -13,8 +13,8 @@ Creates a new disk mapping ## SYNTAX ``` -New-AzMigrateDiskMapping -DiskID -DiskType -IsOSDisk - [-DiskEncryptionSetID ] [] +New-AzMigrateDiskMapping -DiskID -IsOSDisk -DiskType [-DiskEncryptionSetID ] + [] ``` ## DESCRIPTION @@ -30,7 +30,7 @@ New-AzMigrateDiskMapping -DiskID a -DiskType Standard -IsOSDisk 'true' ```output DiskEncryptionSetId DiskId DiskType IsOSDisk LogStorageAccountId LogStorageAccountSasSecretName ------------------- ------ -------- -------- ------------------- ------------------------------ - a Standard true + a Standard true ``` Get disks object to provide input for New-AzMigrateServerReplication @@ -111,4 +111,3 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ALIASES ## RELATED LINKS - diff --git a/src/Migrate/Migrate/help/New-AzMigrateHCIDiskMappingObject.md b/src/Migrate/Migrate/help/New-AzMigrateHCIDiskMappingObject.md new file mode 100644 index 000000000000..6e204d8c8735 --- /dev/null +++ b/src/Migrate/Migrate/help/New-AzMigrateHCIDiskMappingObject.md @@ -0,0 +1,120 @@ +--- +external help file: Az.Migrate-help.xml +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratehcidiskmappingobject +schema: 2.0.0 +--- + +# New-AzMigrateHCIDiskMappingObject + +## SYNOPSIS +Creates a new disk mapping + +## SYNTAX + +``` +New-AzMigrateHCIDiskMappingObject -DiskID -IsOSDisk -IsDynamic -Size + -Format [] +``` + +## DESCRIPTION +The New-AzMigrateHCIDiskMappingObject cmdlet creates a mapping of the source disk attached to the server to be migrated + +## EXAMPLES + +### EXAMPLE 1 +``` +New-AzMigrateHCIDiskMappingObject -DiskID a -IsOSDisk true -IsDynamic true -Size 1 -Format VHDX +``` + +## PARAMETERS + +### -DiskID +Specifies the disk ID of the disk attached to the discovered server to be migrated. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Format +Specifies the disk format. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IsDynamic +Specifies whether the disk is dynamic. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IsOSDisk +Specifies whether the disk contains the Operating System for the source server to be migrated. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Size +Specifies the disk size in GB. + +```yaml +Type: Int64 +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: 0 +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.Migrate.Models.Api20210216Preview.AzStackHCIDiskInput +## NOTES + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratehcidiskmappingobject](https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratehcidiskmappingobject) + diff --git a/src/Migrate/Migrate/help/New-AzMigrateHCINicMappingObject.md b/src/Migrate/Migrate/help/New-AzMigrateHCINicMappingObject.md new file mode 100644 index 000000000000..fb1c9b9cab3c --- /dev/null +++ b/src/Migrate/Migrate/help/New-AzMigrateHCINicMappingObject.md @@ -0,0 +1,106 @@ +--- +external help file: Az.Migrate-help.xml +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratehcinicmappingobject +schema: 2.0.0 +--- + +# New-AzMigrateHCINicMappingObject + +## SYNOPSIS +Creates an object to update NIC properties of a replicating server. + +## SYNTAX + +``` +New-AzMigrateHCINicMappingObject -NicID -TargetVirtualSwitchId + [-TargetTestVirtualSwitchId ] [-CreateAtTarget ] [] +``` + +## DESCRIPTION +The New-AzMigrateHCINicMappingObject cmdlet creates a mapping of the source NIC attached to the server to be migrated. +This object is provided as an input to the Set-AzMigrateServerReplication cmdlet to update the NIC and its properties for a replicating server. + +## EXAMPLES + +### EXAMPLE 1 +``` +New-AzMigrateHCINicMappingObject -NicID a -TargetVirtualSwitchId "/subscriptions/xxx-xxx-xxx/resourceGroups/hciclus-rg/providers/Microsoft.AzureStackHCI/logicalnetworks/external" +``` + +## PARAMETERS + +### -CreateAtTarget +Specifies whether the this Nic should be created at target. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NicID +Specifies the ID of the NIC to be updated. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetTestVirtualSwitchId +Specifies the test logical network ARM ID that the VMs will use. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetVirtualSwitchId +Specifies the logical network ARM ID that the VMs will use. + +```yaml +Type: String +Parameter Sets: (All) +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 + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.AzStackHCINicInput +## NOTES + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratehcinicmappingobject](https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratehcinicmappingobject) + diff --git a/src/Migrate/Migrate/help/New-AzMigrateHCIServerReplication.md b/src/Migrate/Migrate/help/New-AzMigrateHCIServerReplication.md new file mode 100644 index 000000000000..e0eff312ffb0 --- /dev/null +++ b/src/Migrate/Migrate/help/New-AzMigrateHCIServerReplication.md @@ -0,0 +1,314 @@ +--- +external help file: Az.Migrate-help.xml +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratehciserverreplication +schema: 2.0.0 +--- + +# New-AzMigrateHCIServerReplication + +## SYNOPSIS +Starts replication for the specified server. + +## SYNTAX + +### ByIdDefaultUser (Default) +``` +New-AzMigrateHCIServerReplication -MachineId -TargetStoragePathId + -TargetResourceGroupId -TargetVMName -TargetVirtualSwitchId -OSDiskID + [-TargetVMCPUCore ] [-TargetTestVirtualSwitchId ] [-IsDynamicMemoryEnabled ] + [-TargetVMRam ] [-SubscriptionId ] [-DefaultProfile ] [-WhatIf] [-Confirm] + [] +``` + +### ByIdPowerUser +``` +New-AzMigrateHCIServerReplication -MachineId -TargetStoragePathId + -TargetResourceGroupId -TargetVMName [-TargetVMCPUCore ] + [-IsDynamicMemoryEnabled ] [-TargetVMRam ] [-SubscriptionId ] + -DiskToInclude -NicToInclude [-DefaultProfile ] + [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +The New-AzMigrateHCIServerReplication cmdlet starts the replication for a particular discovered server in the Azure Migrate project. + +## EXAMPLES + +### EXAMPLE 1 +``` +New-AzMigrateHCIServerReplication -MachineId "/subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.OffAzure/HyperVSites/testsrc7972site/machines/005-005-005" -OSDiskID "Microsoft:0EC082D5-6827-457A-BAE2-F986E1B94851\83F8638B-8DCA-4152-9EDA-2CA8B33039B4\0\0\L" -TargetStoragePathId "/subscriptions/xxx-xxx-xxx/resourceGroups/hciclus-rg/providers/Microsoft.AzureStackHCI/storagecontainers/testStorageContainer1" -TargetVirtualSwitchId "/subscriptions/xxx-xxx-xxx/resourceGroups/hciclus-rg/providers/Microsoft.AzureStackHCI/logicalnetworks/external" -TargetResourceGroupId "/subscriptions//xxx-xxx-xxx/resourceGroups/target-rg"-TargetVMName "targetVM" +``` + +### EXAMPLE 2 +``` +[AzStackHCIDiskInput[]]$DisksToInclude = @() +$OSDisk = New-AzMigrateHCIDiskMappingObject -DiskID "Microsoft:C1A34301-3BFF-4EC6-97F1-6C4BD5ADCDE0\83F8638B-8DCA-4152-9EDA-2CA8B33039B4\0\0\L" -IsOSDisk true -IsDynamic true -Size 42 -Format VHD +$DataDisk = New-AzMigrateHCIDiskMappingObject -DiskID "Microsoft:C1A34301-3BFF-4EC6-97F1-6C4BD5ADCDE0\C92FAB89-DA8B-47E9-92F3-364642ECDF39\0\0\L" -IsOSDisk false -IsDynamic true -Size 5 -Format VHD +$DisksToInclude += $OSDisk +$DisksToInclude += $DataDisk +``` + +\[AzStackHCINicInput\[\]\]$NicsToInclude = @() +$Nic = New-AzMigrateHCINicMappingObject -NicID "Microsoft:C1A34301-3BFF-4EC6-97F1-6C4BD5ADCDE0\99CDFD2E-D60C-4218-AC2E-E7C2D8253EB9" -TargetVirtualSwitchId "/subscriptions/xxx-xxx-xxx/resourceGroups/hciclus-rg/providers/Microsoft.AzureStackHCI/logicalnetworks/external" +$NicsToInclude += $Nic + +New-AzMigrateHCIServerReplication -MachineId "/subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.OffAzure/HyperVSites/testsrc7972site/machines/005-005-005" -TargetStoragePathId "/subscriptions/xxx-xxx-xxx/resourceGroups/hciclus-rg/providers/Microsoft.AzureStackHCI/storagecontainers/testStorageContainer1" -TargetResourceGroupId "/subscriptions//xxx-xxx-xxx/resourceGroups/target-rg"-TargetVMName "targetVM" -DiskToInclude $DisksToInclude -NicToInclude $NicsToInclude + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DiskToInclude +Specifies the disks on the source server to be included for replication. + +```yaml +Type: AzStackHCIDiskInput[] +Parameter Sets: ByIdPowerUser +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IsDynamicMemoryEnabled +Specifies if RAM is dynamic or not. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MachineId +Specifies the machine ARM ID of the discovered server to be migrated. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NicToInclude +Specifies the NICs on the source server to be included for replication. + +```yaml +Type: AzStackHCINicInput[] +Parameter Sets: ByIdPowerUser +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OSDiskID +Specifies the Operating System disk for the source server to be migrated. + +```yaml +Type: String +Parameter Sets: ByIdDefaultUser +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure Subscription ID. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetResourceGroupId +Specifies the target Resource Group Id where the migrated VM resources will reside. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetStoragePathId +Specifies the storage path ARM ID where the VMs will be stored. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetTestVirtualSwitchId +Specifies the test logical network ARM ID that the VMs will use. + +```yaml +Type: String +Parameter Sets: ByIdDefaultUser +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetVirtualSwitchId +Specifies the logical network ARM ID that the VMs will use. + +```yaml +Type: String +Parameter Sets: ByIdDefaultUser +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetVMCPUCore +Specifies the number of CPU cores. + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: 0 +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetVMName +Specifies the name of the VM to be created. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetVMRam +Specifies the target RAM size in MB. + +```yaml +Type: Int64 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: 0 +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: 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: 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.Migrate.Models.Api20210216Preview.IWorkflowModel +## NOTES + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratehciserverreplication](https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratehciserverreplication) + diff --git a/src/Migrate/Migrate/help/New-AzMigrateNicMapping.md b/src/Migrate/Migrate/help/New-AzMigrateNicMapping.md index e782159a3e95..4472fd51194f 100644 --- a/src/Migrate/Migrate/help/New-AzMigrateNicMapping.md +++ b/src/Migrate/Migrate/help/New-AzMigrateNicMapping.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Migrate-help.xml Module Name: Az.Migrate online version: https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratenicmapping schema: 2.0.0 @@ -13,9 +13,9 @@ Creates an object to update NIC properties of a replicating server. ## SYNTAX ``` -New-AzMigrateNicMapping -NicID [-TargetNicIP ] [-TargetNicName ] - [-TargetNicSelectionType ] [-TargetNicSubnet ] [-TestNicIP ] - [-TestNicSubnet ] [] +New-AzMigrateNicMapping -NicID [-TargetNicSelectionType ] [-TargetNicSubnet ] + [-TargetNicName ] [-TargetNicIP ] [-TestNicSubnet ] [-TestNicIP ] + [] ``` ## DESCRIPTION @@ -158,4 +158,3 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ALIASES ## RELATED LINKS - diff --git a/src/Migrate/Migrate/help/New-AzMigrateProject.md b/src/Migrate/Migrate/help/New-AzMigrateProject.md index 8ec37a1163d8..1acc357f46c7 100644 --- a/src/Migrate/Migrate/help/New-AzMigrateProject.md +++ b/src/Migrate/Migrate/help/New-AzMigrateProject.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Migrate-help.xml Module Name: Az.Migrate online version: https://learn.microsoft.com/powershell/module/az.migrate/new-azmigrateproject schema: 2.0.0 @@ -13,8 +13,8 @@ Creates a new Migrate project. ## SYNTAX ``` -New-AzMigrateProject -Location -Name -ResourceGroupName [-ETag ] - [-Property ] [-SubscriptionId ] [-Confirm] [-WhatIf] [] +New-AzMigrateProject -Name -ResourceGroupName -Location [-ETag ] + [-Property ] [-SubscriptionId ] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -31,7 +31,6 @@ New-AzMigrateProject -SubscriptionId xxx-xxx-xxx -ResourceGroupName kuchaturimpk ETag Location Name Type ---- -------- ---- ---- centralus kuchaturimpkocrg1pwshp14 Microsoft.Migrate/MigrateProjects - ``` Method to create a new migrate project. @@ -181,4 +180,3 @@ To create the parameters described below, construct a hash table containing the - `[RegisteredTool ]`: Gets or sets the list of tools registered with the migrate project. ## RELATED LINKS - diff --git a/src/Migrate/Migrate/help/New-AzMigrateReplicationPolicy.md b/src/Migrate/Migrate/help/New-AzMigrateReplicationPolicy.md index 6ce0136e748c..cf1c518ee975 100644 --- a/src/Migrate/Migrate/help/New-AzMigrateReplicationPolicy.md +++ b/src/Migrate/Migrate/help/New-AzMigrateReplicationPolicy.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Migrate-help.xml Module Name: Az.Migrate online version: https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratereplicationpolicy schema: 2.0.0 @@ -15,7 +15,7 @@ The operation to create a replication policy. ``` New-AzMigrateReplicationPolicy -PolicyName -ResourceGroupName -ResourceName [-SubscriptionId ] [-ProviderSpecificInput ] - [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] + [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -37,7 +37,6 @@ New-AzMigrateReplicationPolicy -PolicyName TestPolicy -ResourceGroupName Resourc Location Name Type -------- ---- ---- TestPolicy Microsoft.RecoveryServices/vaults/replicationPolicies - ``` Creates a policy for VmWare Cbt @@ -219,4 +218,3 @@ To create the parameters described below, construct a hash table containing the - `InstanceType `: The class type. ## RELATED LINKS - diff --git a/src/Migrate/Migrate/help/New-AzMigrateReplicationProtectionContainerMapping.md b/src/Migrate/Migrate/help/New-AzMigrateReplicationProtectionContainerMapping.md index b5d9223250ff..9996f1ff4871 100644 --- a/src/Migrate/Migrate/help/New-AzMigrateReplicationProtectionContainerMapping.md +++ b/src/Migrate/Migrate/help/New-AzMigrateReplicationProtectionContainerMapping.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Migrate-help.xml Module Name: Az.Migrate online version: https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratereplicationprotectioncontainermapping schema: 2.0.0 @@ -17,7 +17,7 @@ New-AzMigrateReplicationProtectionContainerMapping -FabricName -Mapping -ProtectionContainerName -ResourceGroupName -ResourceName [-SubscriptionId ] [-PolicyId ] [-ProviderSpecificInput ] - [-TargetProtectionContainerId ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] + [-TargetProtectionContainerId ] [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] [-Confirm] [] ``` @@ -285,4 +285,3 @@ To create the parameters described below, construct a hash table containing the - `InstanceType `: The class type. ## RELATED LINKS - diff --git a/src/Migrate/Migrate/help/New-AzMigrateServerReplication.md b/src/Migrate/Migrate/help/New-AzMigrateServerReplication.md index 8841ad621738..df98737549ab 100644 --- a/src/Migrate/Migrate/help/New-AzMigrateServerReplication.md +++ b/src/Migrate/Migrate/help/New-AzMigrateServerReplication.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Migrate-help.xml Module Name: Az.Migrate online version: https://learn.microsoft.com/powershell/module/az.migrate/new-azmigrateserverreplication schema: 2.0.0 @@ -14,55 +14,53 @@ Starts replication for the specified server. ### ByIdDefaultUser (Default) ``` -New-AzMigrateServerReplication -DiskType -LicenseType -MachineId -OSDiskID - -TargetNetworkId -TargetResourceGroupId -TargetSubnetName -TargetVMName - [-DiskEncryptionSetID ] [-DiskTag ] - [-NicTag ] [-PerformAutoResync ] - [-SqlServerLicenseType ] [-SubscriptionId ] [-Tag ] +New-AzMigrateServerReplication -LicenseType -TargetResourceGroupId -TargetNetworkId + -TargetSubnetName -TargetVMName -MachineId -DiskType -OSDiskID + [-SqlServerLicenseType ] [-TestNetworkId ] [-TestSubnetName ] + [-VMWarerunasaccountID ] [-TargetVMSize ] [-PerformAutoResync ] [-TargetAvailabilitySet ] [-TargetAvailabilityZone ] - [-TargetBootDiagnosticsStorageAccount ] [-TargetVMSize ] [-TestNetworkId ] - [-TestSubnetName ] [-VMTag ] - [-VMWarerunasaccountID ] [-DefaultProfile ] [] + [-VMTag ] [-NicTag ] + [-DiskTag ] [-Tag ] + [-TargetBootDiagnosticsStorageAccount ] [-DiskEncryptionSetID ] [-SubscriptionId ] + [-DefaultProfile ] [] ``` ### ByIdPowerUser ``` -New-AzMigrateServerReplication -DiskToInclude -LicenseType - -MachineId -TargetNetworkId -TargetResourceGroupId -TargetSubnetName - -TargetVMName [-DiskTag ] - [-NicTag ] [-PerformAutoResync ] - [-SqlServerLicenseType ] [-SubscriptionId ] [-Tag ] - [-TargetAvailabilitySet ] [-TargetAvailabilityZone ] - [-TargetBootDiagnosticsStorageAccount ] [-TargetVMSize ] [-TestNetworkId ] - [-TestSubnetName ] [-VMTag ] - [-VMWarerunasaccountID ] [-DefaultProfile ] [] +New-AzMigrateServerReplication -LicenseType -TargetResourceGroupId -TargetNetworkId + -TargetSubnetName -TargetVMName -MachineId [-SqlServerLicenseType ] + [-TestNetworkId ] [-TestSubnetName ] [-VMWarerunasaccountID ] [-TargetVMSize ] + [-PerformAutoResync ] [-TargetAvailabilitySet ] [-TargetAvailabilityZone ] + [-VMTag ] [-NicTag ] + [-DiskTag ] [-Tag ] + [-TargetBootDiagnosticsStorageAccount ] [-SubscriptionId ] + -DiskToInclude [-DefaultProfile ] [] ``` ### ByInputObjectDefaultUser ``` -New-AzMigrateServerReplication -DiskType -InputObject -LicenseType - -OSDiskID -TargetNetworkId -TargetResourceGroupId -TargetSubnetName - -TargetVMName [-DiskEncryptionSetID ] - [-DiskTag ] - [-NicTag ] [-PerformAutoResync ] - [-SqlServerLicenseType ] [-SubscriptionId ] [-Tag ] +New-AzMigrateServerReplication -LicenseType -TargetResourceGroupId -TargetNetworkId + -TargetSubnetName -TargetVMName -DiskType -OSDiskID + [-SqlServerLicenseType ] [-TestNetworkId ] [-TestSubnetName ] + [-VMWarerunasaccountID ] [-TargetVMSize ] [-PerformAutoResync ] [-TargetAvailabilitySet ] [-TargetAvailabilityZone ] - [-TargetBootDiagnosticsStorageAccount ] [-TargetVMSize ] [-TestNetworkId ] - [-TestSubnetName ] [-VMTag ] - [-VMWarerunasaccountID ] [-DefaultProfile ] [] + [-VMTag ] [-NicTag ] + [-DiskTag ] [-Tag ] + [-TargetBootDiagnosticsStorageAccount ] [-DiskEncryptionSetID ] [-SubscriptionId ] + -InputObject [-DefaultProfile ] [] ``` ### ByInputObjectPowerUser ``` -New-AzMigrateServerReplication -DiskToInclude -InputObject - -LicenseType -TargetNetworkId -TargetResourceGroupId -TargetSubnetName - -TargetVMName [-DiskTag ] - [-NicTag ] [-PerformAutoResync ] - [-SqlServerLicenseType ] [-SubscriptionId ] [-Tag ] - [-TargetAvailabilitySet ] [-TargetAvailabilityZone ] - [-TargetBootDiagnosticsStorageAccount ] [-TargetVMSize ] [-TestNetworkId ] - [-TestSubnetName ] [-VMTag ] - [-VMWarerunasaccountID ] [-DefaultProfile ] [] +New-AzMigrateServerReplication -LicenseType -TargetResourceGroupId -TargetNetworkId + -TargetSubnetName -TargetVMName [-SqlServerLicenseType ] [-TestNetworkId ] + [-TestSubnetName ] [-VMWarerunasaccountID ] [-TargetVMSize ] + [-PerformAutoResync ] [-TargetAvailabilitySet ] [-TargetAvailabilityZone ] + [-VMTag ] [-NicTag ] + [-DiskTag ] [-Tag ] + [-TargetBootDiagnosticsStorageAccount ] [-SubscriptionId ] + -DiskToInclude -InputObject [-DefaultProfile ] + [] ``` ## DESCRIPTION @@ -571,4 +569,3 @@ To create the parameters described below, construct a hash table containing the - `[(Any) ]`: This indicates any property can be added to this object. ## RELATED LINKS - diff --git a/src/Migrate/Migrate/help/New-AzMigrateTestNicMapping.md b/src/Migrate/Migrate/help/New-AzMigrateTestNicMapping.md index c4d1003d0904..c2f606a8b1c4 100644 --- a/src/Migrate/Migrate/help/New-AzMigrateTestNicMapping.md +++ b/src/Migrate/Migrate/help/New-AzMigrateTestNicMapping.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Migrate-help.xml Module Name: Az.Migrate online version: https://learn.microsoft.com/powershell/module/az.migrate/new-azmigratetestnicmapping schema: 2.0.0 @@ -13,7 +13,7 @@ Creates an object to update NIC properties of a test migrating server. ## SYNTAX ``` -New-AzMigrateTestNicMapping -NicID -TestNicSubnet [-Confirm] [-WhatIf] [] +New-AzMigrateTestNicMapping -NicID -TestNicSubnet [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -112,4 +112,3 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ALIASES ## RELATED LINKS - diff --git a/src/Migrate/Migrate/help/Register-AzMigrateProjectTool.md b/src/Migrate/Migrate/help/Register-AzMigrateProjectTool.md index 718e91b6a66e..5ab52451fc17 100644 --- a/src/Migrate/Migrate/help/Register-AzMigrateProjectTool.md +++ b/src/Migrate/Migrate/help/Register-AzMigrateProjectTool.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Migrate-help.xml Module Name: Az.Migrate online version: https://learn.microsoft.com/powershell/module/az.migrate/register-azmigrateprojecttool schema: 2.0.0 @@ -14,8 +14,8 @@ Registers a tool with the migrate project. ``` Register-AzMigrateProjectTool -MigrateProjectName -ResourceGroupName - [-SubscriptionId ] [-AcceptLanguage ] [-Tool ] [-DefaultProfile ] - [-Confirm] [-WhatIf] [] + [-SubscriptionId ] [-AcceptLanguage ] [-Tool ] [-DefaultProfile ] [-WhatIf] + [-Confirm] [] ``` ## DESCRIPTION @@ -173,4 +173,3 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ALIASES ## RELATED LINKS - diff --git a/src/Migrate/Migrate/help/Remove-AzMigrateHCIServerReplication.md b/src/Migrate/Migrate/help/Remove-AzMigrateHCIServerReplication.md new file mode 100644 index 000000000000..eeb3629a4264 --- /dev/null +++ b/src/Migrate/Migrate/help/Remove-AzMigrateHCIServerReplication.md @@ -0,0 +1,225 @@ +--- +external help file: Az.Migrate-help.xml +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/remove-azmigratehciserverreplication +schema: 2.0.0 +--- + +# Remove-AzMigrateHCIServerReplication + +## SYNOPSIS +Stops replication for the migrated server. + +## SYNTAX + +### ByID (Default) +``` +Remove-AzMigrateHCIServerReplication -TargetObjectID [-SubscriptionId ] + [-ForceRemove ] [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + +### ByInputObject +``` +Remove-AzMigrateHCIServerReplication [-SubscriptionId ] -InputObject + [-ForceRemove ] [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +The Remove-AzMigrateHCIServerReplication cmdlet stops the replication for a migrated server. + +## EXAMPLES + +### EXAMPLE 1 +``` +Remove-AzMigrateHCIServerReplication -TargetObjectID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851" +``` + +### EXAMPLE 2 +``` +$InputObject = Get-AzMigrateHCIServerReplication -TargetObjectID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851" +``` + +Remove-AzMigrateHCIServerReplication -InputObject $InputObject + +$InputObject | Remove-AzMigrateHCIServerReplication + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ForceRemove +Specifies whether the replication needs to be force removed. +Default to "false". + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Specifies the replcating server for which the replication needs to be disabled. +The server object can be retrieved using the Get-AzMigrateHCIServerReplication cmdlet. +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: IMigrateIdentity +Parameter Sets: ByInputObject +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure Subscription ID. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetObjectID +Specifies the replcating server for which the replication needs to be disabled. +The ID should be retrieved using the Get-AzMigrateHCIServerReplication cmdlet. + +```yaml +Type: String +Parameter Sets: ByID +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: 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: 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.Migrate.Models.IMigrateIdentity +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel +## 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 \: Specifies the replcating server for which the replication needs to be disabled. +The server object can be retrieved using the Get-AzMigrateHCIServerReplication cmdlet. + \[AccountName \\]: Run as account ARM name. + \[AlertSettingName \\]: The name of the email notification configuration. + \[ClusterName \\]: Cluster ARM name. + \[DatabaseInstanceName \\]: Unique name of a database instance in Azure migration hub. + \[DatabaseName \\]: Unique name of a database in Azure migration hub. + \[DeploymentId \\]: Deployment Id. + \[EmailConfigurationName \\]: The email configuration name. + \[EventName \\]: Unique name of an event within a migrate project. + \[FabricAgentName \\]: The fabric agent (Dra) name. + \[FabricName \\]: Fabric name. + \[HostName \\]: Host ARM name. + \[Id \\]: Resource identity path + \[IntentObjectName \\]: Replication protection intent name. + \[JobName \\]: Job ARM name. + \[Location \\]: The name of the Azure region. + \[LogicalNetworkName \\]: Logical network name. + \[MachineName \\]: Machine ARM name. + \[MappingName \\]: Protection Container mapping name. + \[MigrateProjectName \\]: Name of the Azure Migrate project. + \[MigrationItemName \\]: Migration item name. + \[MigrationRecoveryPointName \\]: The migration recovery point name. + \[NetworkMappingName \\]: Network mapping name. + \[NetworkName \\]: Primary network name. + \[OperationId \\]: The ID of an ongoing async operation. + \[OperationStatusName \\]: Operation status ARM name. + \[PolicyName \\]: Replication policy name. + \[ProtectableItemName \\]: Protectable item name. + \[ProtectedItemName \\]: The protected item name. + \[ProtectionContainerName \\]: Protection container name. + \[ProviderName \\]: Recovery services provider name. + \[RecoveryPlanName \\]: Name of the recovery plan. + \[RecoveryPointName \\]: The recovery point name. + \[ReplicatedProtectedItemName \\]: Replication protected item name. + \[ReplicationExtensionName \\]: The replication extension name. + \[ResourceGroupName \\]: The name of the resource group. +The name is case insensitive. + \[ResourceName \\]: The name of the recovery services vault. + \[SiteName \\]: Site name. + \[SolutionName \\]: Unique name of a migration solution within a migrate project. + \[StorageClassificationMappingName \\]: Storage classification mapping name. + \[StorageClassificationName \\]: Storage classification name. + \[SubscriptionId \\]: The ID of the target subscription. + \[VaultName \\]: The vault name. + \[VaultSettingName \\]: Vault setting name. + \[VcenterName \\]: VCenter ARM name. + \[VirtualMachineName \\]: Virtual Machine name. + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.migrate/remove-azmigratehciserverreplication](https://learn.microsoft.com/powershell/module/az.migrate/remove-azmigratehciserverreplication) + diff --git a/src/Migrate/Migrate/help/Remove-AzMigrateProject.md b/src/Migrate/Migrate/help/Remove-AzMigrateProject.md index 0360a8e9e339..e298f0747716 100644 --- a/src/Migrate/Migrate/help/Remove-AzMigrateProject.md +++ b/src/Migrate/Migrate/help/Remove-AzMigrateProject.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Migrate-help.xml Module Name: Az.Migrate online version: https://learn.microsoft.com/powershell/module/az.migrate/remove-azmigrateproject schema: 2.0.0 @@ -15,7 +15,7 @@ Deleting non-existent project is a no-operation. ``` Remove-AzMigrateProject -Name -ResourceGroupName [-SubscriptionId ] - [-AcceptLanguage ] [-DefaultProfile ] [-PassThru] [-Confirm] [-WhatIf] [] + [-AcceptLanguage ] [-DefaultProfile ] [-PassThru] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -171,4 +171,3 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ALIASES ## RELATED LINKS - diff --git a/src/Migrate/Migrate/help/Remove-AzMigrateServerReplication.md b/src/Migrate/Migrate/help/Remove-AzMigrateServerReplication.md index 73dcb1f100b6..2d845d341f60 100644 --- a/src/Migrate/Migrate/help/Remove-AzMigrateServerReplication.md +++ b/src/Migrate/Migrate/help/Remove-AzMigrateServerReplication.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Migrate-help.xml Module Name: Az.Migrate online version: https://learn.microsoft.com/powershell/module/az.migrate/remove-azmigrateserverreplication schema: 2.0.0 @@ -20,7 +20,7 @@ Remove-AzMigrateServerReplication -TargetObjectID [-SubscriptionId [-SubscriptionId ] +Remove-AzMigrateServerReplication [-SubscriptionId ] -InputObject [-ForceRemove ] [-DefaultProfile ] [] ``` @@ -55,7 +55,6 @@ TargetObjectId : 101883a0-23f7-538a-bbd5-6d8b4fa900e2 TargetObjectName : prsadhu-TestVM Task : {DisableProtectionOnPrimary, UpdateDraState} Type : Microsoft.RecoveryServices/vaults/replicationJobs - ``` Resync by id. @@ -194,4 +193,3 @@ To create the parameters described below, construct a hash table containing the - `InstanceType `: Gets the instance type. ## RELATED LINKS - diff --git a/src/Migrate/Migrate/help/Restart-AzMigrateServerReplication.md b/src/Migrate/Migrate/help/Restart-AzMigrateServerReplication.md index 8a9747ef9d82..13b41885a992 100644 --- a/src/Migrate/Migrate/help/Restart-AzMigrateServerReplication.md +++ b/src/Migrate/Migrate/help/Restart-AzMigrateServerReplication.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Migrate-help.xml Module Name: Az.Migrate online version: https://learn.microsoft.com/powershell/module/az.migrate/restart-azmigrateserverreplication schema: 2.0.0 @@ -20,7 +20,7 @@ Restart-AzMigrateServerReplication -TargetObjectID [-SubscriptionId [-SubscriptionId ] +Restart-AzMigrateServerReplication [-SubscriptionId ] -InputObject [-DefaultProfile ] [] ``` @@ -178,4 +178,3 @@ To create the parameters described below, construct a hash table containing the - `InstanceType `: Gets the instance type. ## RELATED LINKS - diff --git a/src/Migrate/Migrate/help/Resume-AzMigrateServerReplication.md b/src/Migrate/Migrate/help/Resume-AzMigrateServerReplication.md index ef857f4653ba..b8f72fa86514 100644 --- a/src/Migrate/Migrate/help/Resume-AzMigrateServerReplication.md +++ b/src/Migrate/Migrate/help/Resume-AzMigrateServerReplication.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Migrate-help.xml Module Name: Az.Migrate online version: https://learn.microsoft.com/powershell/module/az.migrate/resume-azmigrateserverreplication schema: 2.0.0 @@ -14,14 +14,14 @@ Starts the replication that has been suspended. ### ByIDVMwareCbt (Default) ``` -Resume-AzMigrateServerReplication -TargetObjectID [-DeleteMigratedResource] - [-SubscriptionId ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +Resume-AzMigrateServerReplication -TargetObjectID [-DeleteMigratedResource] [-SubscriptionId ] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ### ByInputObjectVMwareCbt ``` -Resume-AzMigrateServerReplication -InputObject [-DeleteMigratedResource] - [-SubscriptionId ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +Resume-AzMigrateServerReplication [-DeleteMigratedResource] [-SubscriptionId ] + -InputObject [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -225,4 +225,3 @@ To create the parameters described below, construct a hash table containing the - `InstanceType `: Gets the instance type. ## RELATED LINKS - diff --git a/src/Migrate/Migrate/help/Set-AzMigrateDiskMapping.md b/src/Migrate/Migrate/help/Set-AzMigrateDiskMapping.md index 28affde7dad2..0e7161b43d3a 100644 --- a/src/Migrate/Migrate/help/Set-AzMigrateDiskMapping.md +++ b/src/Migrate/Migrate/help/Set-AzMigrateDiskMapping.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Migrate-help.xml Module Name: Az.Migrate online version: https://learn.microsoft.com/powershell/module/az.migrate/set-azmigratediskmapping schema: 2.0.0 @@ -95,4 +95,3 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ALIASES ## RELATED LINKS - diff --git a/src/Migrate/Migrate/help/Set-AzMigrateHCIServerReplication.md b/src/Migrate/Migrate/help/Set-AzMigrateHCIServerReplication.md new file mode 100644 index 000000000000..22b96d1b3d8c --- /dev/null +++ b/src/Migrate/Migrate/help/Set-AzMigrateHCIServerReplication.md @@ -0,0 +1,235 @@ +--- +external help file: Az.Migrate-help.xml +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/set-azmigratehciserverreplication +schema: 2.0.0 +--- + +# Set-AzMigrateHCIServerReplication + +## SYNOPSIS +Updates the target properties for the replicating server. + +## SYNTAX + +``` +Set-AzMigrateHCIServerReplication -TargetObjectID [-TargetVMName ] [-TargetVMCPUCore ] + [-IsDynamicMemoryEnabled ] [-DynamicMemoryConfig ] + [-TargetVMRam ] [-NicToInclude ] [-SubscriptionId ] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +The Set-AzMigrateHCIServerReplication cmdlet updates the target properties for the replicating server. + +## EXAMPLES + +### EXAMPLE 1 +``` +Set-AzMigrateHCIServerReplication -TargetObjectID '/subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/protectedItems/503a4f02-916c-d6b0-8d14-222bbd4767e5' -TargetVMName "targetName1" +``` + +### EXAMPLE 2 +``` +$memoryConfig = [PSCustomObject]@{ + MinimumMemoryInMegaByte = 1024 + MaximumMemoryInMegaByte = 34816 + TargetMemoryBufferPercentage = 20 +} +``` + +Set-AzMigrateHCIServerReplication -TargetObjectID '/subscriptions/xxx-xxx-xxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/proj62434replicationvault/protectedItems/503a4f02-916c-d6b0-8d14-222bbd4767e5' -DynamicMemoryConfig $memoryConfig + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DynamicMemoryConfig +Specifies the dynamic memory configration of RAM. +To construct, see NOTES section for DYNAMICMEMORYCONFIG properties and create a hash table. + +```yaml +Type: ProtectedItemDynamicMemoryConfig +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IsDynamicMemoryEnabled +Specifies if RAM is dynamic or not. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NicToInclude +Specifies the nics on the source server to be included for replication. + +```yaml +Type: AzStackHCINicInput[] +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: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetObjectID +Specifies the replicating server for which the properties need to be updated. +The ID should be retrieved using the Get-AzMigrateHCIServerReplication cmdlet. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetVMCPUCore +Specifies the number of CPU cores. + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: 0 +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetVMName +Specifies the target VM name. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetVMRam +Specifies the target RAM size in MB. + +```yaml +Type: Int64 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: 0 +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: 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: 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.Migrate.Models.Api20210216Preview.IWorkflowModel +## 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. + +DYNAMICMEMORYCONFIG \: Specifies the dynamic memory configration of RAM. + MaximumMemoryInMegaByte \: Gets or sets maximum memory in MB. + MinimumMemoryInMegaByte \: Gets or sets minimum memory in MB. + TargetMemoryBufferPercentage \: Gets or sets target memory buffer in %. + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.migrate/set-azmigratehciserverreplication](https://learn.microsoft.com/powershell/module/az.migrate/set-azmigratehciserverreplication) + diff --git a/src/Migrate/Migrate/help/Set-AzMigrateServerReplication.md b/src/Migrate/Migrate/help/Set-AzMigrateServerReplication.md index 96c17f52af02..8a5f8ab95b65 100644 --- a/src/Migrate/Migrate/help/Set-AzMigrateServerReplication.md +++ b/src/Migrate/Migrate/help/Set-AzMigrateServerReplication.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Migrate-help.xml Module Name: Az.Migrate online version: https://learn.microsoft.com/powershell/module/az.migrate/set-azmigrateserverreplication schema: 2.0.0 @@ -14,29 +14,29 @@ Updates the target properties for the replicating server. ### ByIDVMwareCbt (Default) ``` -Set-AzMigrateServerReplication -TargetObjectID [-DiskToUpdate ] - [-NicToUpdate ] [-SqlServerLicenseType ] [-SubscriptionId ] - [-TargetAvailabilitySet ] [-TargetAvailabilityZone ] - [-TargetBootDiagnosticsStorageAccount ] [-TargetDiskName ] [-TargetNetworkId ] - [-TargetResourceGroupID ] [-TargetVMName ] [-TargetVMSize ] [-TestNetworkId ] - [-UpdateDiskTag ] [-UpdateDiskTagOperation ] - [-UpdateNicTag ] [-UpdateNicTagOperation ] - [-UpdateTag ] [-UpdateTagOperation ] - [-UpdateVMTag ] [-UpdateVMTagOperation ] +Set-AzMigrateServerReplication -TargetObjectID [-TargetVMName ] [-TargetDiskName ] + [-TargetVMSize ] [-TargetNetworkId ] [-TestNetworkId ] + [-TargetResourceGroupID ] [-NicToUpdate ] + [-DiskToUpdate ] [-TargetAvailabilitySet ] + [-TargetAvailabilityZone ] [-SqlServerLicenseType ] [-UpdateTag ] + [-UpdateTagOperation ] [-UpdateVMTag ] + [-UpdateVMTagOperation ] [-UpdateNicTag ] + [-UpdateNicTagOperation ] [-UpdateDiskTag ] + [-UpdateDiskTagOperation ] [-TargetBootDiagnosticsStorageAccount ] [-SubscriptionId ] [-DefaultProfile ] [] ``` ### ByInputObjectVMwareCbt ``` -Set-AzMigrateServerReplication -InputObject [-DiskToUpdate ] - [-NicToUpdate ] [-SqlServerLicenseType ] [-SubscriptionId ] - [-TargetAvailabilitySet ] [-TargetAvailabilityZone ] - [-TargetBootDiagnosticsStorageAccount ] [-TargetDiskName ] [-TargetNetworkId ] - [-TargetResourceGroupID ] [-TargetVMName ] [-TargetVMSize ] [-TestNetworkId ] - [-UpdateDiskTag ] [-UpdateDiskTagOperation ] - [-UpdateNicTag ] [-UpdateNicTagOperation ] +Set-AzMigrateServerReplication [-TargetVMName ] [-TargetDiskName ] [-TargetVMSize ] + [-TargetNetworkId ] [-TestNetworkId ] [-TargetResourceGroupID ] + [-NicToUpdate ] [-DiskToUpdate ] + [-TargetAvailabilitySet ] [-TargetAvailabilityZone ] [-SqlServerLicenseType ] [-UpdateTag ] [-UpdateTagOperation ] [-UpdateVMTag ] [-UpdateVMTagOperation ] + [-UpdateNicTag ] [-UpdateNicTagOperation ] + [-UpdateDiskTag ] [-UpdateDiskTagOperation ] + [-TargetBootDiagnosticsStorageAccount ] [-SubscriptionId ] -InputObject [-DefaultProfile ] [] ``` @@ -529,4 +529,3 @@ To create the parameters described below, construct a hash table containing the - `[(Any) ]`: This indicates any property can be added to this object. ## RELATED LINKS - diff --git a/src/Migrate/Migrate/help/Start-AzMigrateHCIServerMigration.md b/src/Migrate/Migrate/help/Start-AzMigrateHCIServerMigration.md new file mode 100644 index 000000000000..e3ebafa52462 --- /dev/null +++ b/src/Migrate/Migrate/help/Start-AzMigrateHCIServerMigration.md @@ -0,0 +1,224 @@ +--- +external help file: Az.Migrate-help.xml +Module Name: Az.Migrate +online version: https://learn.microsoft.com/powershell/module/az.migrate/start-azmigratehciservermigration +schema: 2.0.0 +--- + +# Start-AzMigrateHCIServerMigration + +## SYNOPSIS +Starts the migration for the replicating server. + +## SYNTAX + +### ByID (Default) +``` +Start-AzMigrateHCIServerMigration -TargetObjectID [-TurnOffSourceServer] [-SubscriptionId ] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + +### ByInputObject +``` +Start-AzMigrateHCIServerMigration [-TurnOffSourceServer] [-SubscriptionId ] + -InputObject [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +Starts the migration for the replicating server. + +## EXAMPLES + +### EXAMPLE 1 +``` +Start-AzMigrateHCIServerMigration -TargetObjectID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851" +``` + +### EXAMPLE 2 +``` +$InputObject = Get-AzMigrateHCIServerReplication -TargetObjectID "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.DataReplication/replicationVaults/testproj1234replicationvault/protectedItems/0ec082d5-6827-457a-bae2-f986e1b94851" +``` + +Start-AzMigrateHCIServerMigration -InputObject $InputObject + +$InputObject | Start-AzMigrateHCIServerMigration + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Specifies the replicating server for which migration needs to be initiated. +The server object can be retrieved using the Get-AzMigrateHCIServerReplication cmdlet. +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: IMigrateIdentity +Parameter Sets: ByInputObject +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -SubscriptionId +Azure Subscription ID. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TargetObjectID +Specifies the replcating server for which migration needs to be initiated. +The ID should be retrieved using the Get-AzMigrateHCIServerReplication cmdlet. + +```yaml +Type: String +Parameter Sets: ByID +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TurnOffSourceServer +Specifies whether the source server should be turned off post migration. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: 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: 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.Migrate.Models.IMigrateIdentity +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210216Preview.IWorkflowModel +## 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 \: Specifies the replicating server for which migration needs to be initiated. +The server object can be retrieved using the Get-AzMigrateHCIServerReplication cmdlet. + \[AccountName \\]: Run as account ARM name. + \[AlertSettingName \\]: The name of the email notification configuration. + \[ClusterName \\]: Cluster ARM name. + \[DatabaseInstanceName \\]: Unique name of a database instance in Azure migration hub. + \[DatabaseName \\]: Unique name of a database in Azure migration hub. + \[DeploymentId \\]: Deployment Id. + \[EmailConfigurationName \\]: The email configuration name. + \[EventName \\]: Unique name of an event within a migrate project. + \[FabricAgentName \\]: The fabric agent (Dra) name. + \[FabricName \\]: Fabric name. + \[HostName \\]: Host ARM name. + \[Id \\]: Resource identity path + \[IntentObjectName \\]: Replication protection intent name. + \[JobName \\]: Job ARM name. + \[Location \\]: The name of the Azure region. + \[LogicalNetworkName \\]: Logical network name. + \[MachineName \\]: Machine ARM name. + \[MappingName \\]: Protection Container mapping name. + \[MigrateProjectName \\]: Name of the Azure Migrate project. + \[MigrationItemName \\]: Migration item name. + \[MigrationRecoveryPointName \\]: The migration recovery point name. + \[NetworkMappingName \\]: Network mapping name. + \[NetworkName \\]: Primary network name. + \[OperationId \\]: The ID of an ongoing async operation. + \[OperationStatusName \\]: Operation status ARM name. + \[PolicyName \\]: Replication policy name. + \[ProtectableItemName \\]: Protectable item name. + \[ProtectedItemName \\]: The protected item name. + \[ProtectionContainerName \\]: Protection container name. + \[ProviderName \\]: Recovery services provider name. + \[RecoveryPlanName \\]: Name of the recovery plan. + \[RecoveryPointName \\]: The recovery point name. + \[ReplicatedProtectedItemName \\]: Replication protected item name. + \[ReplicationExtensionName \\]: The replication extension name. + \[ResourceGroupName \\]: The name of the resource group. +The name is case insensitive. + \[ResourceName \\]: The name of the recovery services vault. + \[SiteName \\]: Site name. + \[SolutionName \\]: Unique name of a migration solution within a migrate project. + \[StorageClassificationMappingName \\]: Storage classification mapping name. + \[StorageClassificationName \\]: Storage classification name. + \[SubscriptionId \\]: The ID of the target subscription. + \[VaultName \\]: The vault name. + \[VaultSettingName \\]: Vault setting name. + \[VcenterName \\]: VCenter ARM name. + \[VirtualMachineName \\]: Virtual Machine name. + +## RELATED LINKS + +[https://learn.microsoft.com/powershell/module/az.migrate/start-azmigratehciservermigration](https://learn.microsoft.com/powershell/module/az.migrate/start-azmigratehciservermigration) + diff --git a/src/Migrate/Migrate/help/Start-AzMigrateServerMigration.md b/src/Migrate/Migrate/help/Start-AzMigrateServerMigration.md index 75c29ae2bad6..e89c67c11c21 100644 --- a/src/Migrate/Migrate/help/Start-AzMigrateServerMigration.md +++ b/src/Migrate/Migrate/help/Start-AzMigrateServerMigration.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Migrate-help.xml Module Name: Az.Migrate online version: https://learn.microsoft.com/powershell/module/az.migrate/start-azmigrateservermigration schema: 2.0.0 @@ -14,14 +14,14 @@ Starts the migration for the replicating server. ### ByIDVMwareCbt (Default) ``` -Start-AzMigrateServerMigration -TargetObjectID [-OsUpgradeVersion ] - [-SubscriptionId ] [-TurnOffSourceServer] [-DefaultProfile ] [] +Start-AzMigrateServerMigration -TargetObjectID [-OsUpgradeVersion ] [-TurnOffSourceServer] + [-SubscriptionId ] [-DefaultProfile ] [] ``` ### ByInputObjectVMwareCbt ``` -Start-AzMigrateServerMigration -InputObject [-OsUpgradeVersion ] - [-SubscriptionId ] [-TurnOffSourceServer] [-DefaultProfile ] [] +Start-AzMigrateServerMigration [-OsUpgradeVersion ] [-TurnOffSourceServer] [-SubscriptionId ] + -InputObject [-DefaultProfile ] [] ``` ## DESCRIPTION @@ -179,4 +179,3 @@ To create the parameters described below, construct a hash table containing the - `InstanceType `: Gets the instance type. ## RELATED LINKS - diff --git a/src/Migrate/Migrate/help/Start-AzMigrateTestMigration.md b/src/Migrate/Migrate/help/Start-AzMigrateTestMigration.md index c1f43066f6dc..4d5b1a5b40e4 100644 --- a/src/Migrate/Migrate/help/Start-AzMigrateTestMigration.md +++ b/src/Migrate/Migrate/help/Start-AzMigrateTestMigration.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Migrate-help.xml Module Name: Az.Migrate online version: https://learn.microsoft.com/powershell/module/az.migrate/start-azmigratetestmigration schema: 2.0.0 @@ -14,15 +14,15 @@ Starts the test migration for the replicating server. ### ByIDVMwareCbt (Default) ``` -Start-AzMigrateTestMigration -TargetObjectID -TestNetworkID - [-NicToUpdate ] [-OsUpgradeVersion ] [-SubscriptionId ] - [-DefaultProfile ] [] +Start-AzMigrateTestMigration -TestNetworkID -TargetObjectID [-OsUpgradeVersion ] + [-NicToUpdate ] [-SubscriptionId ] [-DefaultProfile ] + [] ``` ### ByInputObjectVMwareCbt ``` -Start-AzMigrateTestMigration -InputObject -TestNetworkID - [-NicToUpdate ] [-OsUpgradeVersion ] [-SubscriptionId ] +Start-AzMigrateTestMigration -TestNetworkID [-OsUpgradeVersion ] + [-NicToUpdate ] [-SubscriptionId ] -InputObject [-DefaultProfile ] [] ``` @@ -57,7 +57,6 @@ TargetObjectId : 101883a0-23f7-538a-bbd5-6d8b4fa900e2 TargetObjectName : prsadhu-TestVM Task : {DisableProtectionOnPrimary, UpdateDraState} Type : Microsoft.RecoveryServices/vaults/replicationJobs - ``` By machine id. @@ -89,7 +88,6 @@ TargetObjectId : 101883a0-23f7-538a-bbd5-6d8b4fa900e2 TargetObjectName : prsadhu-TestVM Task : {DisableProtectionOnPrimary, UpdateDraState} Type : Microsoft.RecoveryServices/vaults/replicationJobs - ``` By input object. @@ -240,4 +238,3 @@ To create the parameters described below, construct a hash table containing the - `[TestSubnetName ]`: The test subnet name. ## RELATED LINKS - diff --git a/src/Migrate/Migrate/help/Start-AzMigrateTestMigrationCleanup.md b/src/Migrate/Migrate/help/Start-AzMigrateTestMigrationCleanup.md index d8588039af10..e1397727080d 100644 --- a/src/Migrate/Migrate/help/Start-AzMigrateTestMigrationCleanup.md +++ b/src/Migrate/Migrate/help/Start-AzMigrateTestMigrationCleanup.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Migrate-help.xml Module Name: Az.Migrate online version: https://learn.microsoft.com/powershell/module/az.migrate/start-azmigratetestmigrationcleanup schema: 2.0.0 @@ -20,7 +20,7 @@ Start-AzMigrateTestMigrationCleanup -TargetObjectID [-SubscriptionId [-SubscriptionId ] +Start-AzMigrateTestMigrationCleanup [-SubscriptionId ] -InputObject [-DefaultProfile ] [] ``` @@ -55,7 +55,6 @@ TargetObjectId : 101883a0-23f7-538a-bbd5-6d8b4fa900e2 TargetObjectName : prsadhu-TestVM Task : {DisableProtectionOnPrimary, UpdateDraState} Type : Microsoft.RecoveryServices/vaults/replicationJobs - ``` By machine id. @@ -89,7 +88,6 @@ TargetObjectId : 101883a0-23f7-538a-bbd5-6d8b4fa900e2 TargetObjectName : prsadhu-TestVM Task : {DisableProtectionOnPrimary, UpdateDraState} Type : Microsoft.RecoveryServices/vaults/replicationJobs - ``` By input object. @@ -183,4 +181,3 @@ To create the parameters described below, construct a hash table containing the - `InstanceType `: Gets the instance type. ## RELATED LINKS - diff --git a/src/Migrate/Migrate/help/Suspend-AzMigrateServerReplication.md b/src/Migrate/Migrate/help/Suspend-AzMigrateServerReplication.md index c23e4f982a6e..d8585097c8d0 100644 --- a/src/Migrate/Migrate/help/Suspend-AzMigrateServerReplication.md +++ b/src/Migrate/Migrate/help/Suspend-AzMigrateServerReplication.md @@ -1,5 +1,5 @@ --- -external help file: +external help file: Az.Migrate-help.xml Module Name: Az.Migrate online version: https://learn.microsoft.com/powershell/module/az.migrate/suspend-azmigrateserverreplication schema: 2.0.0 @@ -15,13 +15,13 @@ Suspends the ongoing replication. ### ByIDVMwareCbt (Default) ``` Suspend-AzMigrateServerReplication -TargetObjectID [-SubscriptionId ] - [-DefaultProfile ] [-Confirm] [-WhatIf] [] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ### ByInputObjectVMwareCbt ``` -Suspend-AzMigrateServerReplication -InputObject [-SubscriptionId ] - [-DefaultProfile ] [-Confirm] [-WhatIf] [] +Suspend-AzMigrateServerReplication [-SubscriptionId ] -InputObject + [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -210,4 +210,3 @@ To create the parameters described below, construct a hash table containing the - `InstanceType `: Gets the instance type. ## RELATED LINKS -